Commit Graph

121 Commits

Author SHA1 Message Date
81f0bab87c Merge pull request #549 from NRXM 2026-11-21 20:09:19 -05:00
6a55f981e0 Merge pull request #503 from Tomgamer 2026-11-21 20:09:16 -05:00
2720df12a1 Merge origin/main into f64-output-modifiers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	runtime/test/shaders/check.py
#	scripts/run_gpu_tests.py
#	tests/semantic/regen_fixtures.py
2026-11-22 02:07:19 +01:00
9cc407c84d tests: skip the wave32 lane-mask dumps below 32 lanes (llvmpipe CI)
cs_wqm_w32 (SHADER-34) and cs_w32_lane_wrap (SHADER-52) check 32-lane
EXEC/VCC masks and lane selects. On Mesa llvmpipe, whose compute
subgroups are 8 wide, they can't produce their words, and the
"GPU tests on llvmpipe" step in runtime.yml has failed on main since
91b36cf. Skip them where vk_compute_test reports a widest subgroup
below 32 lanes, the rule ps_bitmask_perm already uses, in check.py and
run_gpu_tests.py (which reuses check.py's helper). Devices with 32 or
more lanes still run and judge them.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D7JEiKsTUaHQbCTdc4Eghy
(cherry picked from commit be466779a2a1e988f58803ab1eedca6cc6a07375)
2026-11-21 22:06:20 -03:00
c7ea4b4aaa Merge the upstream two-mip fixture with the a16 gradient test
Keep both texture draws in the standalone checker, the GPU runner and its expected case count.
2026-11-22 02:04:42 +01:00
a4996c7ab4 Merge origin/main into f64-output-modifiers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:55:11 +01:00
b3c2623554 Merge pull request #541 from SirAmong 2026-11-21 19:53:11 -05:00
3ac310acf2 Merge pull request #477 from tunczzzz 2026-11-21 19:43:41 -05:00
8e02b90c29 Merge pull request #350 from nicolas
# Conflicts:
#	docs/design.md
2026-11-21 19:43:25 -05:00
c03c2bfdb9 Merge pull request #296 from Vonsek 2026-11-21 19:43:21 -05:00
bcd38863f5 Merge pull request #268 from shelbykb2 2026-11-21 19:43:16 -05:00
737735aecb Translator: v_movrelsd_2_b32 with separate M0 source/destination fields
VGPR[D + M0[25:16]] = VGPR[S0 + M0[9:0]] (RDNA2 ISA VOP1 opcode 72; same
fields in the RDNA3 ISA). It raised Unsupported before (noted in #496).

- tools/rdna2spirv.py: masks M0 per side on the existing movrel path.
- tests/semantic/test_alu_movrelsd_2.py: 7 hand-computed cases through the
  translator and the interpreter, including ignored M0 bits set, the _e32
  spelling and a check that it differs from v_movrelsd_b32.
- runtime/test/shaders/cs_movrelsd_2.asm: GPU test (wave32 dump) with the
  ISA's own example; registered in check.py and run_gpu_tests.py.
- docs/design.md: contract row for the v_movrel* forms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 19:34:25 -05:00
879e1a798d Merge upstream texture and generated shader tests into the a16 fix
Use the canonical shader source for clip dependencies and preserve texel-offset checks next to explicit gradients.
2026-11-22 01:28:49 +01:00
3164a4107a Merge upstream texel-offset coverage with the two-mip fixture
Preserve maintenance8 and the existing texture checks when building the optional two-level view.
2026-11-22 01:25:34 +01:00
1565e63418 Merge commit '91b36cf86cb92a95836eed8af73abc0671a61e31' into codex/med3-result-modifiers
# Conflicts:
#	docs/design.md
#	runtime/test/shaders/check.py
2026-11-21 17:25:32 -07:00
81590d3b6d run_gpu_tests: uniform-branch check requires a bit=0 pixel with s5 = 8
check_uniform_branch (ps_uniform_branch, ps_scc_mask32) only asked for some
s5 = 8 and some s5 = 7, so a translator that decides the branch per lane
passed too. Like check.py, it now also needs a pixel whose own bit is 0 but
got 8 (the wave-wide vote). Reported by @Vonsek in #477: the parent 4abd545
gave 0 such pixels and still passed the runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:19:20 +00:00
d999bb9709 Merge pull request #421 from shelbykb2
# Conflicts:
#	tests/semantic/README.md
#	tests/test_shader_checks.py
2026-11-21 19:19:04 -05:00
3a83c29eae GPU tests for f16 op_sel and partial writes, hardware-measured; f16 inline constants fixed (SHADER-13)
Covers the "16-bit results" contract row, which ended with "not yet GPU-verified".

Hardware evidence: AMD RX 6800 (gfx1030), the instructions run as a raw compute kernel in wave32 and
wave64, IEEE off, DX10 clamp on, denormals kept, round to nearest. The bytes assemble identically for
gfx1013 and gfx1030 (llvm-mc 21; the kernels themselves were assembled by the driver's comgr).
- v_med3_f16: all 16 op_sel patterns, neg/abs on a selected high half, clamp, destination also a source.
- v_add/sub/mul/max/min_f16 (_e32, _e64 with neg/abs/clamp), v_fmac_f16 (_e32, _e64), f16 unary
  (rndne/floor/ceil/trunc/fract/sqrt/rcp/rsq, _e32 and _e64), v_cvt_f16_f32: low halves in, low half out,
  high half of the destination kept; the v_fmac_f16 accumulator is the low half of the destination.
  336 words per wave size, all as the rule says and as the translator computes.
- Not expressible: op_sel on the VOP2/VOP1 ops in VOP3 encoding (v_add/sub/mul/max/min_f16_e64,
  v_fmac_f16_e64, unary _e64). llvm-mc rejects the modifier and its disassembler drops the bits, so
  nothing was measured there and nothing was hand-encoded.

Translator fix (tools/rdna2spirv.py, new src_h): an inline float constant in an f16 operand is the f16
value in the low half over a zero high half. The translator unpacked the f32 pattern, whose low half is
zero, so v_add_f16 d, 1.0, v added 0.0 and v_cvt_f32_f16 d, 0.5 gave 0. Measured for v_add/mul/max_f16,
v_sub_f16_e64, v_fma_f16, v_fmac_f16, v_rcp_f16, v_med3_f16, v_cmp_lt_f16, v_cvt_f32_f16, v_cos_f16,
v_pk_add/mul_f16 and v_pack_b32_f16 (0.15915494 is 0x3118); the high half op_sel selects from a constant
reads +0.0. v_fma_mix* operands were not
measured and are unchanged.

Tests:
- runtime/test/shaders/ps_f16_{med3_opsel,med3_mods,vop2,vop2b,vop1,vop1b,const,const2,pack}.asm, wired into
  check.py and scripts/run_gpu_tests.py. Their expected words are the ones the hardware gave for the same
  instructions. Vulkan, AMD Radeon RX 6800, Windows, driver 26.11.2: 9/9 pass; with one expected word
  flipped per test 0/9 pass; without the translator fix ps_f16_const, ps_f16_const2 and ps_f16_pack fail.
- tests/test_f16_hw_words.py: header, check.py and run_gpu_tests.py hold the hardware words; a
  plain-Python reference of the rule and the translator (tests/spirv_interp.py) both give them. 12 of its
  tests fail without the fix.
- tests/semantic: ps_f16_vop2 fixture and value test; the v_sin_f16 mutation anchor follows the edit.
- tests/spirv_interp.py: Floor/Ceil/Trunc/RoundEven keep the sign of a zero result (trunc(-0.75) is
  0x8000 on the hardware and on Vulkan), Sin/Cos, component-wise vector arithmetic.
- python -m unittest discover -s tests/semantic: 388 -> 389, OK. pytest tests: 1467 -> 1514 passed.
  scripts/run_gpu_tests.py (test tools rebuilt): 48/49 -> 57/58 passed, 1 skipped.

docs/design.md: the "16-bit results" row says what was verified and what is not expressible; new row
"f16 inline constants".

AI-assisted.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:17:58 -07:00
2fd9504e92 Merge pull request #488 from LuanFreitas 2026-11-21 19:14:13 -05:00
edb8bb8643 Merge pull request #477 from tunczzzz
# Conflicts:
#	docs/design.md
#	runtime/test/shaders/check.py
2026-11-21 19:14:12 -05:00
06bd42a20e Translator: apply clamp and omod to v_add_f64
v_add_f64 is VOP3Inst<"v_add_f64", VOP3_Profile<VOP_F64_F64_F64>> in LLVM
AMDGPU; VOPProfile gives it HasClamp (f64 is a modifier type) and HasOMod
(floating-point destination). The translator dropped both. The double sum
is now scaled by mul:2/mul:4/div:2, then clamped to [0, 1] (FClamp, as the
f32 clamp_mods does), before it is split into the register pair.

- tests/test_f64_output_modifiers.py: SPIR-V data-flow check per modifier
  combination, plus NoContraction on the f64 add/scale.
- runtime/test/shaders/ps_f64_mods.asm: GPU test (registered in check.py,
  run_gpu_tests.py and regen_fixtures.py). vk_harness enables shaderFloat64
  when the fragment shader declares Float64, else exits 77 (SKIP).
- docs/design.md: contract row with the LLVM profile names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:09:07 +01:00
7d15dab8a3 Merge pull request #343 from Andrea
# Conflicts:
#	scripts/run_gpu_tests.py
2026-11-21 19:08:36 -05:00
2da77d56e6 Merge pull request #269 from shelbykb2 2026-11-21 19:08:26 -05:00
2c6f763e5f Merge pull request #240 from eIBart0 2026-11-21 19:08:23 -05:00
e66e969597 Merge pull request #193 from AREA52 Agent 2026-11-21 19:08:21 -05:00
aa1c217a57 SHADER-52: wave32 readlane/writelane mask lane select with 31
RDNA2 uses S1[4:0] in wave32 and S1[5:0] in wave64. Always ANDing with 63
left selects 32..63 pointing past a 32-wide subgroup. Fixture cs_w32_lane_wrap
checks lane 40 wraps to 8 on an RTX 5060.
2026-11-21 21:06:06 -03:00
e53b9e5450 Tests: add ms_wave_info_s3 mesh shader test for s3[27:24] wave ID 2026-11-21 21:05:43 -03:00
71a16c11cf FUZZ-8: control-flow/EXEC differential fuzzer; wave32 SCC of mask ops is wave-wide
tools/cf_diff.py generates seeded wave32/wave64 pixel shaders from the
control-flow shapes compilers emit (saveexec if/else, v_cmpx, VCC- and
SCC-voted branches, uniform and per-lane loops, two-entry cycles) and
compares every lane's export between:
  * tools/cf_ref.py: cpu_ref's Machine plus branches, compares, v_cmpx,
    saveexec and 64-bit masks (the ISA model, one wave)
  * rdna2spirv + tests/semantic/spirv_wave_interp.py: every invocation of
    one subgroup in lockstep, split at selections and rejoined at merges,
    with the subgroup operations the translator emits
in both the structured and the dispatch-loop form; --spirv-val also
validates each module, --minimize reduces a mismatch.

Finding (fixed here): in a wave32 program s_and/or/xor/andn2/orn2/nand/
nor/xnor_b32 on lane masks set SCC from the lane's own bit instead of the
whole mask, so `s_and_b32 s0, vcc_lo, exec_lo; s_cbranch_scc0` and loops
closed by `s_andn2_b32 exec_lo, ...; s_cbranch_scc1` split the wave. SCC
is now the same subgroup vote as for the _b64 forms. GPU test
ps_scc_mask32 (not run on a GPU yet).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:02:16 +00:00
add0b5cfce GPU test for texel offsets (image_sample*_o, image_gather4_lz_o)
SHADER-14. runtime/test/shaders/ps_texoff.asm samples vk_texture_test's 8x8
texture (every texel different, point sampler, clamp to edge) through the
translated shader and exports the texel coordinates it read as integers:

- image_sample_lz_o with an offset computed per pixel: all 64 pairs of x, y
  in -4..3 from the centre of texel (4, 4), each a different texel, none
  clamped;
- image_sample_l_o with (-3, +2) and image_sample_lz_o with (+16, -32), the
  offset dword loaded from an immediate. The second one tells 4-bit, 5-bit
  and 6-bit fields apart; it is outside Vulkan's guaranteed -8..7 and is
  judged only where the device's texel offset limits cover it;
- image_gather4_lz_o of red and of green with the per-pixel offset, at a
  texel corner (shaderImageGatherExtended, not maintenance8).

Expected words are derived by hand from the docs/design.md rule (signed
6-bit fields, x [5:0], y [13:8]) and the texture contents, before any run;
the derivation is in the .asm header and check.py's texoff_words().

Harness: vk_texture_test enables VK_KHR_maintenance8 and
shaderImageGatherExtended when the device has them, prints the texel offset
limits, and with VKT_NEED_MAINTENANCE8=1 exits 77 without the extension
(SKIP in check.py and scripts/run_gpu_tests.py).

vk_harness.cpp is unchanged: its maintenance8 guard (#if defined() on the
structure-type enumerator, never true) was already fixed upstream, which now
uses #ifdef VK_KHR_MAINTENANCE_8_EXTENSION_NAME.

tests/conftest.py: the sample validator retries with
--allow-offset-texture-operand (what rdna2spirv.py validates with) when
spirv-val rejects a non-gather Offset, and skips on a spirv-val that does not
know the flag.

Tested on an AMD Radeon RX 6800, Windows, driver 26.11.2 (texel offset limits
-64..63, gather -32..31, maintenance8 enabled):
  run_gpu_tests.py: 49/50 passed, 1 skipped (was 48/49, 1 skipped)
    PASS  ps_texoff  4096/4096 pixels exact (offsets +16/-32 judged)
  check.py: 45 of 45 pass, 0 skipped (was 44 of 44)
No translator bug found: tools/rdna2spirv.py is unchanged.

Negative controls (translator sabotaged, test run, reverted). FAIL: sample
offset dropped, x/y swapped, y field at bit 6, 4-bit fields, 5-bit fields;
gather offset dropped, x/y swapped, y field at bit 6; three corrupted
expectations. PASS, so not detected on this GPU:
- fields read unsigned (sample and gather): Offset 60..63 sampled as -4..-1
  and +32 as -32, so the sign extension cannot be seen through Vulkan here;
- 4-bit and 5-bit gather fields: the gather offsets stay in -4..3.
Both are pinned by the new structural test tests/test_texel_offsets.py
instead (signed, bit 8k, 6 bits; it fails with OpBitFieldUExtract).

The test shows that the translated SPIR-V implements the documented rule on
Vulkan; it does not measure the field layout on the hardware. Still not
GPU-tested: sign extension, gather field width, image_sample_o, _b_o,
_c_lz_o, image_gather4_l_o, the z field (3D), 1D/2D-array/cube targets, wrap
or mirror addressing, linear filtering, mips other than 0, other vendors'
drivers, devices without maintenance8.

unittest tests/semantic: 388 OK before and after.
pytest tests (LLVM_MC set): 1467 passed, 6 skipped, 1 xfailed before;
1478 passed, 6 skipped, 1 xfailed after.

AI-assisted.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 16:55:18 -07:00
b063c7a613 merge: integrate upstream shader test updates
Keep multi-config build discovery and vertex clipping fixtures while retaining the packed-coordinate sampling check in both GPU runners.
2026-11-22 00:54:32 +01:00
970b045cf8 Merge upstream vertex-clip and shader checks into the mip test
Keep the generated clip variants, whole-quad checks and multi-config tool search alongside the two-mip draws.
2026-11-22 00:53:34 +01:00
6828527241 fix(shader): preserve full-width gradients in a16 samples
Unpacking the full GFX10 address as half pairs reads sample coordinates from derivative words. Decode the full-width gradient prefix before the packed coordinates and check the resulting image against a synthetic RGBA gradient.
2026-11-22 00:44:45 +01:00
648a84a930 Merge pull request #400 from Ewann 2026-11-21 18:43:26 -05:00
b15eaa3ac0 rdna2spirv: global_load/store negative offsets were 4096 bytes too low
global_mem read the instruction offset with int(..., 0) and then did
"if inst & 0x800: inst -= 0x1000". llvm-mc prints the 12-bit field signed
(offset:-4 for 0xffc, range -2048..2047; it rejects offset:0xffc and
disassembles 0xffc back as offset:-4), so -4 & 0x800 was true and every
negative offset became base - 4096 + offset. Both repo paths (shader_disasm
--disassemble, build.py -show-encoding) deliver only the signed spelling. The
offset is now taken as written; a raw unsigned field (0x800..0xfff), which
llvm-mc never prints, still means the same negative offset, and anything
outside 12 bits raises Unsupported instead of being guessed.

Hardware (AMD Radeon RX 6800, gfx1030, raw compute kernel, wave32 = wave64):
dword at byte n = 0x10000000+n, pointer 0x1000: offset 0 reads 0x10001000,
-4 0x10000ffc, -2048 0x10000800, 2044 0x100017fc, -1024 0x10000c00.

Audit of the other offset / signed-immediate sites in rdna2spirv.py (widths
checked by assembling and disassembling with llvm-mc 21): MUBUF offset:
(12-bit unsigned; llvm-mc assembles a hand-written offset:4096 to field 0 while
echoing offset:4096, reachable only from hand-written sources, left alone),
DS offset: (16-bit unsigned), offset0/offset1 (8-bit
unsigned), ds_bpermute offset (16-bit unsigned), s_movk/s_addk/s_mulk and
s_cmpk_*_i32 (16-bit, masked then sign-extended, so 0xfffc and -4 agree),
s_cmpk_*_u32 (zero-extended), branch targets (16-bit signed, disassembled
unsigned as 65532, masked then sign-extended): all right. Not changed here:
scalar_load zero-extends a negative SMEM immediate (21-bit signed; -0x4 adds
0xfffffffc), which another branch is changing.

Tests: tests/semantic/test_global_mem_offset.py runs the emitted address
code (both addressing modes, dword/x2/x4, ubyte/sbyte/ushort/sshort, stores,
offsets -4, -2048, 2047 and 0, raw-field and out-of-range spellings): the negative-offset
cases fail on main's translator (0 and 2047 pass there too), all pass here. New GPU test
runtime/test/shaders/cs_global_neg_offset.asm (wired into check.py and
scripts/run_gpu_tests.py), expected words derived from its seeds. On AMD
Radeon RX 6800 / Windows / driver 26.11.2: run_gpu_tests 57/57, check.py
51 of 51; with main's translator the new test returns the 4096-lower seeds
and fails.

AI-assisted.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 16:43:16 -07:00
eb330b6864 Resolve generated clip variants through their shared assembly source 2026-11-21 15:40:46 -08:00
cdd98c1f8c Merge pull request #352 from AlxcBTW
# Conflicts:
#	docs/design.md
#	runtime/test/shaders/check.py
2026-11-21 18:38:00 -05:00
84c66f7196 Merge pull request #331 from fearkov 2026-11-21 18:37:54 -05:00
714531412f check.py: find the Visual Studio build folders too; say which one was used (TEST-38 follow-up)
Follow-up to #337, from the review points there:

- resolve_build_dir, CONFIG_DIRS and the "not found" message move from
  scripts/run_gpu_tests.py into runtime/test/shaders/check.py, which
  run_gpu_tests.py already imports from. check.py main() now finds the
  programs in build/RelWithDebInfo, Release, Debug or MinSizeRel as well,
  so `check.py <out>` (docs/design.md, "Reproduce the shader tests") works
  with the Visual Studio generator.
- When the programs come from a configuration subfolder, one line says
  which: `test programs: <folder> (newest of A, B)`, so a #166 report can
  name the build it ran and a stale pick is visible.
- The "Test programs not found" message says the configuration subfolders
  were searched too (and gets a space after the colon in run_gpu_tests.py).
- tests/test_gpu_build_dir.py: the printed line, the message, and two
  main()-level tests (run_gpu_tests.main hands the resolved folder to
  run_suite, check.main hands it to the first test) with the programs faked.

No GPU used. AI-assisted.
2026-11-22 00:35:00 +01:00
25ca1d63f2 Merge upstream main into SHADER-7 and retain filtered clip dependencies 2026-11-21 15:31:09 -08:00
5df3d01a5a Merge commit 'd937b7f092dbc188b59754e5c73c1a9dac553cf9' into codex/med3-result-modifiers
# Conflicts:
#	runtime/test/shaders/check.py
#	scripts/run_gpu_tests.py
2026-11-21 16:29:40 -07:00
8550970f10 Merge upstream GPU fixture dependencies into the two-mip test
Preserve the cube test's isolated vertex shader and count the new upstream compute checks alongside the two-mip draw.
2026-11-22 00:28:50 +01:00
03bd5a0b20 Tests: ps_fma_literal checks which operand the literal multiplies 2026-11-21 19:24:37 -04:00
0a5f0688c5 test: report missing GPU executables per build config 2026-11-22 00:13:33 +01:00
dbc785f9e5 Merge pull request #332 from fearkov
# Conflicts:
#	tests/semantic/regen_fixtures.py
2026-11-21 18:09:52 -05:00
697625209a Apply output modifiers to v_med3_f32 results 2026-11-21 16:09:40 -07:00
0d5ba399c0 Merge pull request #247 from crastinator
# Conflicts:
#	scripts/run_gpu_tests.py
2026-11-21 18:07:52 -05:00
7761916406 Merge pull request #303 from mrb-eel 2026-11-21 18:07:42 -05:00
76add28b8a Merge pull request #315 from Vonsek 2026-11-21 18:07:38 -05:00
988aeecf97 test: locate GPU test executables in VS build configs 2026-11-22 00:07:27 +01:00
abefe80779 Merge origin/main into shader-34-wqm; WQM review fixes
- vs/gs/ms: no OpGroupNonUniformQuadSwap (only guaranteed in fragment and
  compute); shuffle from the quad's four lanes there.
- 32-bit forms in wave64 write only their own half of EXEC/VCC and vote SCC
  over that half; mask_src accepts exec_hi. New GPU test cs_wqm_w64_half.
- cs_wqm_w32: read SCC right after s_wqm.
- test_wqm_on_data checks the real constants and shifts; new vs and half tests.
- docs: narrowed claims (SCC vote needs 64-wide or emulation, lane
  assumptions, partial quads, helper invocations untested).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:06:34 +01:00