Commit Graph

366 Commits

Author SHA1 Message Date
c64494b9fe Merge pull request #2411 from TurboSosiska304 2026-11-22 13:15:07 -05:00
45e4a2e370 Merge pull request #2404 from S1m0ne1997 2026-11-22 13:15:04 -05:00
c4bee344ef Merge pull request #2399 from AAyberkU 2026-11-22 13:14:44 -05:00
151c372ee1 Merge pull request #2395 from Matheus Gomes 2026-11-22 13:14:40 -05:00
fbd598c2d0 Merge pull request #2187 from Vonsek 2026-11-22 13:13:12 -05:00
407a53923e Merge pull request #2048 from whoalin1
# Conflicts:
#	docs/testing.md
2026-11-22 13:12:54 -05:00
51d954a2cd Merge pull request #436 from S1m0ne1997 2026-11-22 13:12:27 -05:00
64184fc835 Merge main into sdwa-dword-hi16 (#2187)
Conflicts:
	tests/semantic/test_value_semantics.py

AI-assisted.
2026-11-22 18:53:24 +01:00
97afefdebc Merge remote-tracking branch 'origin/main' into shader-33-vs-inputs
# Conflicts:
#	tests/test_shader_checks.py
2026-11-22 18:06:20 +01:00
a012fe0c1f SHADER-337: GPU test of image_sample_o, image_sample_b_o and image_gather4_l_o with texel offsets
ps_texoff_forms runs the three forms on vk_texture_test's texture with ps_texoff's per-pixel offset (all 64 pairs in
-4..3). check.py and run_gpu_tests.py judge it with texoff_words(..., "ps_texoff_forms"); unit tests check that a
dropped or swapped offset fails. 4096/4096 pixels exact on an RTX 4090 and on a gfx1036 iGPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:56:02 +01:00
a1343528f7 scripts, viewer: a redirected stdout no longer dies on a path outside the code page
Under `python -I` on Windows a redirected stdout is strict ANSI, so printing a path with a character outside the
code page raised UnicodeEncodeError. tools/ guards against it at the start of every __main__ block and
tests/test_tool_stdout_encoding.py enforces that, but only for tools/. viewer/serve.py died before it started
serving and scripts/audit_shader4_regs.py exited 1 after writing its report; bench_wave64.py and run_gpu_tests.py
print the same kind of output unguarded. All four get the guard, and the check now covers scripts/ and viewer/.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ABh36DZ2sZNq3ChN6EZJs
2026-11-22 19:55:36 +03:00
da3f01cee7 gpu tests: skip a fixture whose wave size the device cannot pin
cs_barrier_loop is a wave32 fixture (subgroup_size 32 in index.json): its
expected words are four waves of 32 lanes. run_gpu_tests.py pinned the size
through VKC_SUBGROUP_SIZE but, unlike check.py, judged the dump when
vk_compute_test reported "compute subgroup size: 32 not available" and ran it
at 64 lanes anyway. A device with 64..64 compute subgroups (GCN3/GCN4 on RADV)
therefore reported a failure that is really an unpinnable wave size: 139/180
passed with 1 failed, where check.py reported 0 failed on the same work folder.

Reuse check.py's unpinned_subgroup_skip for cs_barrier_loop only. The other
pinned dumps are still judged at the device's own width, which is how cs_store
and the cs_w32_* fixtures keep being tested on a 64-only device (skipping all
of them cost 12 passes: 128/180).

RX 570 (gfx803, RADV Mesa 26.2.6, Vulkan 1.4.354), commit 4947579:
run_gpu_tests 139/180 passed, 41 skipped, 0 failed; check.py 0 failed.
2026-11-22 19:54:22 +03:00
33456ca4e7 fix(test): enable shaderFloat64 for compute SPIR-V that declares it
Use the existing SPIR-V capability scan to request the feature before creating the Vulkan device, or report an unsupported-device skip. Add a synthetic compute case that checks both words of a binary64 result.
2026-11-22 13:53:56 -03:00
0ec464b0e1 GPU tests: bind the --pc-tail-ubo block, so 128-byte push-constant devices run the tests
With LEONIDA_PC_TAIL_UBO=1, build.py and run_gpu_tests.py translate with --pc-tail-ubo, and the test
programs (vk_compute_test, vk_store_test, vk_harness, vk_texture_test, vk_sampler_test, vk_bindless_test)
declare and push 128 bytes and, when a stage declares set 1, bind the tail block there
(runtime/test/vk_pc_tail.h: a host-visible buffer with one slot per dispatch or draw, bound as a dynamic
uniform buffer). vk_harness refuses --mesh-compute with the flag (exit 77): mesh_compute_vs.py's vertex
shader still reads its address from push constants. Without the variable nothing changes.

Step 2 of the uniform-buffer tail claimed in #1902.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:48:05 +02:00
ae21dddaa6 Merge pull request #2290 from 1TrickOmen 2026-11-22 11:43:51 -05:00
72758b9c5b Merge pull request #2270 from Tim Elery
# Conflicts:
#	docs/design.md
2026-11-22 11:43:39 -05:00
693b8c63af Merge pull request #2209 from Vonsek 2026-11-22 11:42:51 -05:00
94d7bfddae Merge pull request #2184 from AvantBras 2026-11-22 11:42:34 -05:00
1180c0b4a4 Merge pull request #2136 from Vonsek 2026-11-22 11:42:07 -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
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
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
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
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
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
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
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