Commit Graph

1249 Commits

Author SHA1 Message Date
e06b7e92d5 Merge pull request #2135 from AAyberkU 2026-11-22 11:42:06 -05:00
2d692a355d Merge pull request #2102 from Vonsek 2026-11-22 11:41:49 -05:00
409d2973ae Merge pull request #2093 from Vonsek 2026-11-22 11:41:44 -05:00
3d1a9889df Merge pull request #2049 from Shrey Ratna 2026-11-22 11:41:12 -05:00
5cf0a1743d Merge pull request #1880 from Vonsek 2026-11-22 11:40:43 -05:00
ea00498d3f Merge pull request #664 from WHOISJARDAS 2026-11-22 11:40:30 -05:00
72d7e52dfa Translator: a mask copied to a VGPR respects EXEC (SHADER-21 part 2, #210) 2026-11-22 16:33:52 +00:00
fbe50b23fd rdna2spirv: align swizzled buffer addressing with native RDNA2 hardware (SHADER-343)
Measure MUBUF/MTBUF swizzled buffer addressing (V# SWIZZLE_ENABLE,
ADD_TID_ENABLE, INDEX_STRIDE, OOB_SELECT, multi-dword and typed
accesses, atomics, 32-bit offset wrap) natively on RDNA2 (gfx1036,
wave32 and wave64) via tools/buffer_swizzle_probe.py, and fix all six
observed silicon divergences in tools/rdna2spirv.py:

- idxen=1 ignores ADD_TID_ENABLE (both address and bounds).
- SWIZZLE_ENABLE=1 with idxen=0 and ADD_TID_ENABLE=0 stays linear and
  OOB_SELECT 3 remains RAW.
- Multi-dword raw accesses step by +4*IS only in scratch-swizzle mode
  (SWIZZLE_ENABLE=1, idxen=0, ADD_TID_ENABLE=1); indexed swizzle
  (idxen=1) steps linearly by +4 bytes even across IS boundaries.
- Scratch-swizzle mode suppresses typed formats > 4 bytes (MUBUF/MTBUF)
  and 8-byte buffer_atomic_*_x2 even under OOB_SELECT 2 (formats <= 4B
  execute normally); indexed swizzle executes them linearly.
- OOB_SELECT 3 with active swizzle and stride != 0 checks
  (index + soffset) >= num_records or off + payload > stride.
- off = uint32(voff + inst_offset) wraps at 32 bits before bounds
  checking, while RAW mode 3 uint64(off) + uint64(soffset) does not.

Update semantic tests, cs_buf_swizzle fixture expectation (word 4:
0x5eed0028 -> 0x5eed000c), unit tests, and docs/design.md /
docs/shader_validation.md.
2026-11-22 08:32:34 -08:00
3d1dbf1cef Merge main into test/coverage-gaps (#1299)
Conflicts: runtime/test/shaders/check.py, scripts/run_gpu_tests.py

AI-assisted.
2026-11-22 17:22:43 +01:00
9f03fc31e1 run_gpu_tests: ps_m3_query belongs to d3d12_m3_frame_test (OTHER_HARNESS)
#1825's single-output M3 occlusion shader is drawn by the ctest d3d12_m3_frame_test; run_gpu_tests picked it up
and failed it with "no checker defined".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:22:00 -05:00
7d370cdfbc Tests: GPU test for the 32-bit integer VOPC compares
ps_vcmp_int32 runs v_cmp_{eq,ne,lt,le,gt,ge,f,t}_{u32,i32} in the e32 and
e64 forms with inline constants and literals, on operands where signed and
unsigned disagree. Words derived by hand in the .asm header; the same shader
is a tests/semantic fixture with a plain-Python reference.

AI-assisted.
2026-11-22 17:21:18 +01:00
d78546fc92 rdna2spirv: apply the SDWA src_sel to an f16 inline float constant
In an f16 SDWA op, Gen.src_h returned a float inline constant as its f16
bits without the operand's src_sel. On RDNA2 the constant is the f16 value
over a zero high half and src_sel then narrows it like a register:
v_add_f16_sdwa d, 1.0, v src0_sel:WORD_1 reads +0.0 (measured on gfx1036).
The translator added 1.0.

GPU test ps_sdwa_f16_const (hand-derived words, measured on gfx1036) with a
semantic fixture; it also covers an SGPR source and the integer path
(v_cvt_f16_u16_sdwa of 1.0), which were already right. docs/design.md row.

AI-assisted.
2026-11-22 17:17:54 +01:00
bb147680c7 fix(audit): classify carry-in and carry-out operands separately
The scalar mask in the second operand is an output even when the instruction also has a separate carry-in. Mark it written to avoid reporting it as an incoming register value.
2026-11-22 17:17:45 +01:00
fc52e96723 Tests: let focused GPU runs require a pass (TEST-364) 2026-11-22 17:13:19 +01:00
ecc6bd286e rdna2spirv: a 16-bit SDWA result with dst_sel:DWORD zeroes the high half
A 16-bit op in SDWA form (f16 VOP1/VOP2, v_cvt_u16/i16_f16, v_cvt_f16_u16/i16)
with dst_sel:DWORD writes the result zero-extended on RDNA2, whatever
dst_unused says. Gen.insn only marked an SDWA destination for a dst_sel other
than DWORD, so write_lo16 applied the non-SDWA keep-the-high-half rule and the
translator returned 0xdead4000 where gfx1036 returns 0x00004000.

Mark every SDWA VGPR destination and let write_lo16 skip the keep for it.
ps_sdwa_dword_hi.asm (GPU) and its semantic fixture pin four ops and three
dst_unused values; docs/design.md gets the contract row.

AI-assisted.
2026-11-22 17:13:04 +01:00
b2fc3f20c3 Merge main into test/valu-int-misc (#1492)
Conflicts: scripts/run_gpu_tests.py

AI-assisted.
2026-11-22 17:12:54 +01:00
960eda9350 fix(stats): count VGPRs in non-contiguous image operands
The listing parser represents image address lists separately from ordinary register ranges. Include their highest register so the reported original span is comparable with the driver count.
2026-11-22 17:11:40 +01:00
bdfe5f88ec fix(wine): apply each CTest test environment
A test-specific setting can select a different adapter or feature. Pass the CTest environment to its subprocess so Wine covers the same settings and sibling tests still inherit the runner environment.
2026-11-22 17:08:47 +01:00
21d01a9570 fix(tests): enforce the GPU timeout for texture cases
The texture harness needs a shader working directory, so two branches launched it directly and bypassed the configured deadline. Pass the working directory through the shared launcher so those cases time out and the suite can continue.
2026-11-22 17:04:37 +01:00
c590469693 shader_stats: --help exits 0, and an unknown option is refused instead of ignored
`-h`/`--help` printed the usage to stderr with exit code 1, and any other `--` option was dropped without a
word: `--detail` (a typo for `--details`) printed the summary with exit code 0. Help now goes to stdout with
exit code 0, and an unknown option or a wrong argument count is a usage error with exit code 2, as in the
other hand-parsed tools.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ABh36DZ2sZNq3ChN6EZJs
2026-11-22 19:00:56 +03:00
91b53e294b GPU test cs_fmt_int_narrow: 8/16-bit UINT/SINT typed buffers, words from gfx1036
A compute fixture loads through the nine narrow integer formats (DST_SEL
XYZW, X011 and d16) and stores edge values through each with the
runtime's selectors. check.py's 136 expected words are the same program's
output run natively on gfx1036 (tools/hw_oracle, wave32 and wave64), and
the interpreter test runs the fixture against them too.

Depends on #1871.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:58:11 +01:00
0316d855bc fix(bench): report incomplete wave64 comparisons
A failed GPU configuration already makes the benchmark exit unsuccessfully, but the final line still claims all outputs match. Identify missing results in the summary so the text agrees with the outcome.
2026-11-22 16:58:07 +01:00
194dad2f4b fix(wine): honor disabled CTest entries
CTest marks disabled entries as skipped even when the command is unavailable. Check the property before resolving or starting the Windows test so the Wine report gives the same result.
2026-11-22 16:46:14 +01:00
b87dc1e9af Tests: GPU and CPU checks for the untested d16_xyz/d16_xy typed-buffer forms
buffer_load_format_d16_xyz, tbuffer_load_format_d16_xy/_d16_xyz and
buffer_store_format_d16_xyz were translated but no test ran them. Add the
GPU test cs_fmt_d16_xyz (one thread; integer, f16 and UNORM8 loads with the
kept high half of an odd final component, the 16-bit clamp of 32-bit UINT
channels, and stores into 32_32_32_UINT and 32_32_32_FLOAT), compared over
the whole 80-word heap, and run the same fixture in test_value_semantics.py.

AI-assisted.
2026-11-22 16:41:27 +01:00
a47749b8de Merge pull request #1996 from Joao vitor alves
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-22 10:40:16 -05:00
72a38ad24d Merge remote-tracking branch 'origin/main' into shader-33-vs-inputs
# Conflicts:
#	docs/design.md
2026-11-22 16:39:33 +01:00
e403590204 Merge pull request #718 from fearkov 2026-11-22 10:38:40 -05:00
81e520c327 Merge pull request #409 from JustDown 2026-11-22 10:38:36 -05:00
a0e8229a55 Tests: don't judge cs_signed_zero_nan's 0 * inf check on llvmpipe
Mesa llvmpipe returns 0 for out[5], the NaN check of 0 * inf with an
inline-constant 0, with or without SignedZeroInfNanPreserve, while its
other NaN checks give 1 (a run on #664, Mesa with LLVM 21.1.8). The CI
runs scripts/run_gpu_tests.py on llvmpipe, so the test would fail there.

APPLE_UNJUDGED_WORDS becomes UNJUDGED_WORDS, keyed by the first word of
the device name on vk_compute_test's "device:" line. Apple keeps words
0, 2 and 3, and llvmpipe gets word 5. Every other device still judges
all eight words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:38:11 +00:00
e45c973ff0 Tests: don't judge cs_signed_zero_nan's -0 products on Apple GPUs (#1203)
MoltenVK returns +0 for -0 products with or without SignedZeroInfNanPreserve,
in out[0] (v_mul_f32), out[2] (v_pk_mul_f16) and out[3] (v_mul_f16). The mode
still fixes the three NaN checks on Apple. Seen on an Apple A18 Pro and an Apple
Paravirtual device in #664, tracked as #1203 / SHADER-182.

- check.py: judged_words() leaves those three words of cs_signed_zero_nan
  unjudged when vk_compute_test's device line names an Apple GPU, and
  words_match() compares the rest. The other five words still have to match,
  and every other device judges all eight.
- run_gpu_tests.py: uses the same two functions and says which words weren't
  judged.
- tests/test_shader_checks.py: tests for the Apple and non-Apple cases, the
  NaN checks still judged on Apple, and run_gpu_tests' judge_cs_dump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:36:20 +00:00
bd8fb7c9f5 Translator: declare SignedZeroInfNanPreserve so drivers keep NaN, inf and -0
RDNA2 float ops return NaN, +-inf and -0 as computed. Without float controls,
Vulkan lets the driver assume none of them occur, and AMD's compiler does. On
an RX 9070 XT (26.11.2), x != x NaN checks fold to false and -0 products come
back +0. With integer f16 narrowing (#575), NaN results are never stored.

- rdna2spirv.py: every module declares the SignedZeroInfNanPreserve capability
  and OpExecutionMode SignedZeroInfNanPreserve 32. The index entry lists the
  property it needs (float_controls). --no-float-controls leaves both out.
- vk_pipeline_check: reads float_controls and skips a shader on a device
  without shaderSignedZeroInfNanPreserveFloat32.
- GPU test cs_signed_zero_nan (check.py, run_gpu_tests.py): without the mode,
  out[4..7] are 0 on AMD; with it, all eight words match.
- tests/test_translate.py: covers the mode, the index entry and the opt-out.
- docs/design.md: a "Float controls" contract row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:35:13 +00:00
e3cfc7f010 GPU runners: run the f16 interpolation tests under the bary fallback when the f16 fallback is on
run_gpu_tests.py skipped ps_interp_f16_high and ms_f16_pack whenever
LEONIDA_BARY_FALLBACK was set, and check.py skipped ps_interp_f16_high the
same way. The skip predates --f16-interp-fallback: --bary-fallback alone has
no PerVertexKHR inputs, so the f16 halves can't be interpolated. With
--f16-interp-fallback as well, which run_gpu_tests.py turns on by itself on a
device without fragmentShaderBarycentric (the usual reason for the bary
fallback), the pixel shader reads the decoded halves its producer exports,
and both tests run. Skip only when the bary fallback is on without it.

On llvmpipe (Mesa 26.0.8, no VK_KHR_fragment_shader_barycentric) with
LEONIDA_BARY_FALLBACK=1, both tests went from SKIP to PASS. Under the bary
fallback alone they would still fail (f16 halves off by 0.984), so that skip
stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:34:55 +00:00
502c1ce513 Runtime: M2 formats test (BC1/BC7 mip chains and a 2D array through a PSO)
Closes M2's open item "texture formats other than R8G8B8A8_UNORM, mips and arrays
through a PSO". d3d12_m2_formats_test samples, through the M2 descriptor path
(heap slots 9/10, CreateShaderResourceView, CreateSampler, two root tables,
translated vs_m2/ps_m2): an 8x8 BC1 and an 8x8 BC7 texture with 4 mips each and
an R8G8B8A8 2D array of 3 slices (new ps_m2_array.asm). Every subresource is
uploaded at its GetCopyableFootprints layout; POINT samplers with MinLOD = MaxLOD
pin each level; a view from mip 1 and two array views check that level and slice
are relative to the view. Blocks use endpoint colours only, so all 12 cases are
compared with the CPU byte for byte (error 0). Validation clean on RTX 4070 Ti
SUPER; no layer change was needed. Synthetic data only, no game files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01PiKMETzszqwfnV8QQyzocY
2026-11-22 12:26:05 -03:00
94f392ac75 Merge remote-tracking branch 'origin/main' into shader-33-vs-inputs
# Conflicts:
#	tests/test_shader_checks.py
2026-11-22 16:00:07 +01:00
df91c6624b Merge main into test/valu-int-misc (#1492)
Conflicted files: runtime/test/shaders/check.py, scripts/run_gpu_tests.py

AI-assisted.
2026-11-22 15:51:40 +01:00
2560485f76 Merge main into test/coverage-gaps (#1299)
Conflicted files: runtime/test/shaders/check.py, scripts/run_gpu_tests.py

AI-assisted.
2026-11-22 15:48:54 +01:00
c53024be39 Merge pull request #1858 from AlxcBTW
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-22 09:48:50 -05:00
3b7cd5e4bf Merge pull request #1791 from AlxcBTW 2026-11-22 09:48:16 -05:00
9df596963a Translator: v_cvt_pk_u8_f32 NaN gives 0, with RDNA2-measured GPU test (SHADER-48)
Measured natively on an RDNA2 iGPU (gfx1036): v_cvt_pk_u8_f32 rounds to
nearest even, clamps to [0, 255] and gives 0 for NaN. The RoundEven rule
was right; NaN reached FClamp, which is undefined for a NaN operand, so it
is now replaced by +0 first.

cs_cvt_pk_u8.asm holds eight hardware words (four byte selects), checked
by check.py and run_gpu_tests.py, and bit-for-bit on the CPU by
tests/semantic/test_cvt_pk_u8.py. Contract-table row added.

Fixes #358
2026-11-22 15:48:12 +01:00
f8ef313033 Merge pull request #1627 from nonverifiedperson 2026-11-22 09:48:05 -05:00
00452cfaa3 Merge pull request #1615 from Ewann 2026-11-22 09:48:04 -05:00
b83f74f6d2 Merge pull request #1612 from mokkymiah 2026-11-22 09:48:03 -05:00
b9e91c2af8 Merge pull request #1398 from ezwinxdlmao 2026-11-22 09:48:00 -05:00
f2ba7831ae Tests: v_cvt_f16_f32 output modifiers, in the interpreter and on a GPU
ps_outmods_f16 has six results; each changes a word when its modifier is dropped, and two change when the omod is applied before the rounding.
2026-11-22 10:40:54 -04:00
537486c875 Merge remote-tracking branch 'fork/m4-synthetic-gate' into buffer-uav-typed-counter
# Conflicts:
#	docs/d3d12_vulkan.md
#	runtime/shims/d3d12_vulkan_device.cpp
2026-11-22 15:34:07 +01:00
f209d86b8f D3D12 layer: typed buffer UAVs and UAV counters (V# FORMAT, counter V# in the slot), d3d12_buffer_uav_test
CreateUnorderedAccessView on a buffer with a typed Format writes a typed V# (GFX10_FORMAT code, element size as
stride, element count, OOB_SELECT structured, the format's own DST_SEL), and a structured view with pCounterResource +
CounterOffsetInBytes writes a second raw 4-byte V# in the upper 16 bytes of the slot (a hypothesis for the console
contract, documented in section 3.4). The combinations D3D12 documents as invalid leave a null slot.

d3d12_buffer_uav_test runs two hand-written RDNA2 compute shaders through the translator (typed store/load/atomic on
five formats with NUM_RECORDS as the bound; append by 256 lanes and consume by 128 on a counter at offset 4096, read
back with CopyBufferRegion) against a CPU reference, then compares typed-buffer and counter clears with the host D3D12
runtime on the same adapter (LUID).

Depends on: #1791

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:33:50 +01:00
cd6e21be84 Translator: tbuffer_store_format_* with the instruction's format
tbuffer_store_format_* and its d16 forms were Unsupported, though every
tbuffer_load_format_* form translates. They now go through buffer_store
with the instruction's format, as the loads go through
buffer_load_format:
- only that format is encoded, with no branch on the V#'s FORMAT;
- the bounds check uses its element size;
- a V# whose FORMAT is 0 (INVALID) still disables the store, as measured.
  (@Vonsek covers the MTBUF loads and @opit80 the raw MUBUF accesses
  through such a V#.)

The format parsing the loads did inline becomes mtbuf_format(), shared by
both: no modifier is GFX10's default BUF_FMT_8_UNORM, and a format
FORMATS has no encoder for stays Unsupported. read_before_write_vgprs
now counts a tbuffer store's data VGPRs as reads, as for buffer_store.

cs_tbuffer_store.asm stores into 13 sentinel-filled regions through V#s
whose format differs from the instruction's or is 0, and reads them
back. Every
expected word was measured by running the same body natively on a
Radeon 680M (gfx1035, RDNA2); wave32 and wave64 gave the same 52 words:
- the instruction's format decides the encoding, the element and the
  bounds;
- components the format has but the store doesn't give are 0, and extra
  ones are dropped;
- the default format is one byte, and its neighbours are kept;
- a FORMAT-0 V# leaves the region untouched.

check.py and run_gpu_tests.py compare the dump. The semantic fixture
runs through the interpreter in tests/semantic/test_tbuffer_store.py,
which fails on the old translator (Unsupported). It also fails on
versions that take the bounds from the V#'s element (5 words differ),
take the format from the V#, fill missing components with anything
but 0 (1 word), or drop the FORMAT-0 guard (2 words).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:33:18 +02:00
c5edaf72f7 Add ps_mandelbrot: a divergent backward loop with EXEC masking
A pixel shader that iterates z = z^2 + c per lane until it escapes or 64
rounds pass. Escaped lanes drop out of EXEC, s_cbranch_execz leaves the loop
once all lanes are out, and EXEC is restored before the export. check.py and
run_gpu_tests.py compare every pixel's iteration count with a pure-Python
float32 model (mul/add/sub only, no FMA, so the model is exact).

Tested on main 003e7812: run_gpu_tests.py 131/171 on RTX 5070 Ti (40
skipped) and 162/171 on AMD Radeon integrated graphics (9 skipped, run by
the d3d12 draw tests). AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:30:42 +01:00
ab55405c2c Tests: GPU coverage for ds_cmpst_b32 and the b64 LDS 2-address forms 2026-11-22 14:24:28 +00:00
8cc972b88b Merge remote-tracking branch 'origin/main' into shader-33-vs-inputs
# Conflicts:
#	runtime/test/shaders/check.py
2026-11-22 15:21:22 +01:00