Commit Graph

148 Commits

Author SHA1 Message Date
84e1d2ebe9 Merge pull request #769 from mohamedsaad.lahlou 2026-11-21 22:08:46 -05:00
1b6cc3f2c2 Translator: ds_read_u8/i8_d16[_hi] 8-bit LDS reads into a 16-bit half (SHADER-85)
ds_read_u8_d16, ds_read_u8_d16_hi, ds_read_i8_d16 and ds_read_i8_d16_hi
(RDNA2 DS opcodes 162-165) were rejected. They reuse the u8/i8/u16_d16
path: the byte is zero- or sign-extended 8->16 into one half of the
destination and the other half is kept.

Tests: CPU value test on the new cs_w32_lds_u8_d16 fixture (mini
interpreter now accepts Workgroup variables for one invocation), GPU
dump cs_w32_lds_u8_d16.asm registered in check.py and run_gpu_tests.py,
lds_fuzz generates the four reads. Contract row in docs/design.md and
shader_validation.md updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:02:47 -05:00
9f8cac64f5 Tests: isolate shader inputs when reusing GPU test work 2026-11-22 03:46:04 +01:00
b0476248e8 Merge pull request #720 from fearkov 2026-11-21 21:37:52 -05:00
fcd51e74ba Merge pull request #708 from Spaghetih 2026-11-21 21:37:50 -05:00
1df0045b5c Merge pull request #500 from troythedecoyx 2026-11-21 21:37:44 -05:00
fcea57d5d9 Merge pull request #455 from fearkov 2026-11-21 21:37:44 -05:00
48f2164427 Merge pull request #399 from fearkov 2026-11-21 21:37:44 -05:00
f4fcbdc2bb Tests: run_gpu_tests.py reports a pixel test the device can't run once
A vk_harness exit 77 appended the SKIP row twice, so the shader was listed twice and the summary counted it twice (n/total and skipped).
2026-11-21 22:16:26 -04:00
54d3ea1a88 GPU test: s_barrier sites in different wave-uniform branches meet (SHADER-91)
cs_barrier_divergent: wave32, 128 threads. Wave 0 and waves 1-3 take different branches, each with its own s_barrier; on RDNA they count against the same workgroup barrier, so wave 0 reads what wave 3 wrote to LDS (out[i] = 127 - i). Registered in check.py and scripts/run_gpu_tests.py as a wave32 dump that doesn't need 32-lane subgroups.

Passes on an RTX 4070 Ti with the current translator; it guards the behaviour for any change to barrier handling.

AI-assisted.
2026-11-22 03:12:48 +01:00
b707035ca0 Tests: vk_texture_test enables shaderResourceMinLod for a MinLod clamp
A shader that declares MinLod (image_sample_d_cl) needs the feature, and without it the validation layer reports VUID-VkShaderModuleCreateInfo-pCode-08740. A device without it is now a skip (exit 77), as in the other texture tests.
2026-11-21 22:11:02 -04:00
bd880b85cc Tests: a16 bias, d_cl and depth compare samples on a GPU 2026-11-21 22:10:52 -04:00
8de6eb2875 Tests: vk_texture_test dref checks depth compare samples on a GPU 2026-11-21 22:10:21 -04:00
ad6bb01d06 GPU and value test for SHADER-46: s_ff0/s_ff1_i32_b32 of an immediate
The follow-up to #349 that the #374 coordination note asked for. #349
fixed s_ff0_i32_b32 reading an inline constant or literal as a lane mask;
this adds a hardware and interpreter check for it.

ps_sff_imm runs s_ff1_i32_b32 on the inline constant 4 and the literal
0x00100000, and s_ff0_i32_b32 on the inline constant 61 and the literal
0x0000ffff: 2, 1, 20, 16. Read as a lane mask (all ones or zero from bit
0) the two s_ff0 words are -1; the s_ff1 words guard the path that was
already right.

- runtime/test/shaders/ps_sff_imm.asm, with its expected words in
  check.py and run_gpu_tests.py
- the fixture (regen_fixtures.py) and a value test in
  tests/semantic/test_value_semantics.py that runs it through the
  interpreter, with an independent reference

AI-assisted (Claude Code). Tested on NVIDIA GeForce RTX 4060 Ti (subgroup
32), driver 32.0.16.2124, Windows 11: see the PR for the run on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 20:10:09 -06:00
2736407127 Merge pull request #665 from mohamedsaad.lahlou 2026-11-21 21:08:36 -05:00
a412225fcc Tests: reject unmatched GPU test filters 2026-11-22 02:43:37 +01:00
c0a93d29f0 Merge pull request #628 from SirAmong 2026-11-21 20:39:01 -05:00
e5d9f28a4f Merge pull request #489 from eIBart0 2026-11-21 20:38:47 -05:00
b95f0f8b25 Merge pull request #398 from troythedecoyx 2026-11-21 20:38:43 -05:00
dbb3319681 Shader: pack d16 image sample/gather results with integer f32->f16 RTE
Work around an amdvlk64 pipeline-creation crash (0xC0000005 on RX 9070 XT)
triggered when GLSL.std.450 PackHalf2x16 on an OpImageSampleExplicitLod d16
result feeds a structured loop (OpLoopMerge inside OpSelectionMerge) using
OpGroupNonUniformAny.

Replace PackHalf2x16 at the two d16 image_gather4*/image_sample* sites in
tools/rdna2spirv.py with a branchless pure-integer IEEE-754 binary16 RTE
packer (Gen.f32_to_f16_int / Gen.pack_f16_pair_int). Leave all other
PackHalf2x16 call sites unchanged.

Add unit tests covering edge cases and a 58,368-value sweep across all 256
exponents (tests/test_d16_pack.py), SPIR-V translation/validation tests for
d16 image_sample and image_gather4 (tests/test_translate.py), and a synthetic
GPU sample shader (runtime/test/shaders/ps_texture_sample_d16.asm).
2026-11-21 22:24:31 -03:00
b3688332f2 Merge origin/main into fuzz-3-f32-valu (regen_fixtures.py: keep ps_f32_mods and ps_f64_mods)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:22:45 +01:00
0726e3f26b Translator: ds_permute_b32, the forward (scatter) cross-lane permute (SHADER-90)
Each source lane on in EXEC sends its data to lane ((addr + offset) >> 2) mod 32
of its own half (like ds_bpermute_b32); a destination nobody targets gets 0, an
off destination keeps its VDST. Highest-numbered source wins a collision.
Native: per-source shuffles with a ballot guard for missing lanes; wave64
emulation: two buffer rounds and a %x_perm variable.

Tests: tests/semantic/test_ds_permute.py, GPU tests cs_w32_permute and
cs_w64x_permute. Contract row in docs/design.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-21 20:22:15 -05:00
b92801178b GPU tests: run #300's cs_cvt_f32_sat on every input through VKC_SGPRS
cs_cvt_f32_sat (#300) takes its binary32 input in s4, so neither runner
ran it. Now both do: one dispatch per input of
tests/semantic/test_float_to_int.py (check.CVT_F32_SAT_CASES), each
judged on both words (v_cvt_u32_f32 in out[0], v_cvt_i32_f32 in out[1]).

- check.cvt_f32_sat_test() and the run_gpu_tests.py branch report
  "16/16 inputs exact", or how many were wrong and the first one.
- tests/test_shader_checks.py: the fake device answers from the word in
  VKC_SGPRS; every input must be sent, one wrong input must fail and be
  named, and the table must equal the interpreter test's CASES.

On NVIDIA this checks the fixed translation, but it cannot catch the old
bug: with the translator from before #300 (273e53c^1) the RTX 4060 Ti
also gives 16/16, since SPIR-V leaves an out-of-range conversion
undefined and this hardware saturates anyway. A driver that does not
(@EchoTD's RADV case on #300, constant inputs) is where it can fail;
tests/semantic/test_float_to_int.py pins the rule itself.

AI-assisted (Claude Code). Tested on NVIDIA GeForce RTX 4060 Ti (Ada,
subgroup 32), driver 32.0.16.2124, Windows 11, on main d937b7f:
run_gpu_tests.py cs_cvt_f32_sat "16/16 inputs exact" natively and with
LEONIDA_W64_EMULATE=1; check.py cs_cvt_f32_sat ok;
tests/test_shader_checks.py 18/18.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 19:22:13 -06:00
95ab84432d vk_compute_test: seed s4.. from VKC_SGPRS, so a compute test can take an input word
vk_compute_test always put the output V# in s[0:3] and zero in every
other user SGPR, so a compute test shader could not be given an input
word: #300's cs_cvt_f32_sat reads its float from s4 and could only be
checked on a GPU by building one shader variant per input by hand.

- VKC_SGPRS=w4,w5,... sets s4, s5, ... up to s31 (s[0:3] stay the output
  V#), with the same syntax and checks as vk_harness's VKH_SGPRS: decimal
  or 0x hex, no sign, nothing above 32 bits, no trailing comma, at most
  28 words; anything else exits 2 with a message.
- cs_user_sgprs.asm declares eight user SGPRs (RSRC2 0x8090) and stores
  s4..s7 back. Both runners seed it with 0x4f000000,0xdeadbeef,7,
  0xffffffff (check.USER_SGPRS) and expect those words, then the
  0xEEEEEEEE fill.
- check.compute_test() takes an env for vk_compute_test.
- tests/test_shader_checks.py: the fake harness only answers
  cs_user_sgprs with the seeded words when VKC_SGPRS was passed, and no
  other test may get VKC_SGPRS.

AI-assisted (Claude Code). Tested on NVIDIA GeForce RTX 4060 Ti (Ada,
subgroup 32), driver 32.0.16.2124, Windows 11, on main d937b7f:
- run_gpu_tests.py cs_user_sgprs PASS natively and with
  LEONIDA_W64_EMULATE=1; check.py cs_user_sgprs ok
- vk_compute_test directly: unset -> s4..s7 read 0; "5" sets s4 only;
  28 words accepted; "1,2,", "-1", "0x1ffffffff", "abc" and 29 words
  exit 2
- test_shader_checks.py fails (7) if check.py stops passing VKC_SGPRS
- full suite: see the PR

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 19:22:03 -06:00
8521b0b465 Merge origin/main into fuzz-3-f32-valu
spirv_mini_interp.py: keep main's _F32 (sNaN bits, #533) and its vector-aware
RoundEven/Floor/Ceil/Trunc; keep this branch's fma_f32, OpFDiv and
Exp2/Log2/Sqrt/InverseSqrt. regen_fixtures.py: both sides' shaders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:21:00 +01:00
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