Commit Graph

5744 Commits

Author SHA1 Message Date
0425c07649 Merge pull request #302 from S1m0ne1997 2026-11-21 19:08:31 -05:00
3a928c5151 Merge pull request #295 from traeb0n 2026-11-21 19:08:30 -05:00
2da77d56e6 Merge pull request #269 from shelbykb2 2026-11-21 19:08:26 -05:00
8050194cef Merge pull request #258 from Parakeet-Wheat 2026-11-21 19:08:24 -05:00
63f05456f0 Runtime: command-list and allocator rules like the PC runtime (D3D-51)
d3d12_vulkan_device_test now runs the same 25 command-list, allocator, queue
and fence calls on the host D3D12 runtime and on the Vulkan layer, and
compares every HRESULT.

One list at a time records into an allocator, as on the PC runtime. Three
differences are fixed:
- allocator Reset while a list records into it: E_FAIL (was S_OK)
- CreateCommandList on an allocator a list records into: E_INVALIDARG (was S_OK)
- list Reset onto an allocator another list records into: E_INVALIDARG (was S_OK)

An open list now holds a reference to its allocator and marks it busy until
Close or destruction.

Two differences remain, and docs/d3d12_vulkan.md records both:
- Reset with a null allocator crashes the PC runtime (ours returns
  E_INVALIDARG), so that call is not compared.
- Executing an open list removes the PC device (DXGI_ERROR_INVALID_CALL). This
  layer submits nothing and keeps the device, since it has no device-removed
  state yet. The test prints it as a known difference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:06:27 +01: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
f0f9ea35c6 Merge origin/main into bpermute-wave32; wave32 bpermute CPU test
Resolve the conflicts with the test lists again. cs_bpermute32 now goes
through main's WAVE32_DUMPS/CS_DUMPS instead of its own W32_DUMPS list, and
the LDS row keeps main's d16 and ds_permute wording. A new pytest asserts
the wave32 ds_bpermute sequence (EXEC select, ballot bit, shuffle, select).
It fails with main's translator, so the fix is covered without a GPU, as a
review asked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:05:51 +01:00
1284712038 Docs/Tools: record SHADER-4 corpus counts and add audit_shader4_regs.py 2026-11-21 21:05:25 -03:00
e9773f181d Tools: f16, buffer memory and cross-lane differential fuzzers on the GPU (FUZZ-2, FUZZ-5, FUZZ-7) 2026-11-22 01:04:35 +01:00
f2c72c2662 docs(runtime): document multisample resolve feature queries 2026-11-22 01:04:12 +01:00
8a6deb1ee1 Merge origin/main into fuzz-3-f32-valu
Keep both sides in docs/design.md (contract rows), regen_fixtures.py
(ps_f32_mods + ps_fma_literal), spirv_mini_interp.py (our OpFDiv,
Floor/Ceil/Trunc, Exp2/Log2/Sqrt/InverseSqrt and RoundEven sign fix;
upstream's OpIsNan/OpIsInf, OpConvertUToF/SToF and FMax/FClamp) and
rdna2spirv.py (upstream fmamk/fmaak fix; v_mac_f32 stays with v_mad_f32).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:03:21 +01: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
eb5a414c32 d3d12_vulkan.md A.2/A.3: the loader registers .pdata since #176
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:00:20 +01:00
be91840c07 Runtime: SetPredication on VK_EXT_conditional_rendering (D3D-18)
- command_list.h: a Predication command (offset 8-byte aligned, EQUAL_ZERO or
  NOT_EQUAL_ZERO; a null buffer turns it off), recorded by
  GraphicsCommandList::SetPredication.
- vulkan_replay.h: begin/end conditional rendering (INVERTED for NOT_EQUAL_ZERO),
  ended before a new predicate and at the end of the list. While predicated,
  whole-view clears go through vkCmdClearAttachments, which conditional rendering
  covers. New ReplayResult::invalid_predication; PreparedList::unpredicated_copies
  counts copies Vulkan cannot predicate.
- Device: VK_EXT_conditional_rendering and its feature enabled when present, and
  buffers created with VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT; without it a
  predicated list is unsupported.
- Tests: command_list_test (recording rules), vk_command_replay_test part C (GPU).
- docs/d3d12_vulkan.md 4.7: what is done; copies and the 64-bit value are open.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:59:11 +11:00
6416481c7b fsr/bvh tests and A.2/A.3: unwind is #176's (or the test's), #93 is TLS only; FSR host imports are 82 on current main
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:58:24 +01:00
7b28e72909 bvh_builder_test: record slot 62 per call, decode thrown HRESULTs; measured results in d3d12_vulkan.md A.2
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:58:24 +01:00
0729e58ac0 Runtime: optional FSR test through the real loader and the Xbox-ABI device proxy
fsr_dispatch_test maps the package's amd_fidelityfx_upscaler_xbox.dll with rt::Loader (static
TLS and unwind from #93), calls DllMain, and drives it through the public FidelityFX API
(declarations in ffx_api_min.h, from the MIT FidelityFX SDK headers) on a PC D3D12 device
behind the Xbox-ABI proxy. SKIP without LEONIDA_GAME_DIR.

Measured on 1.0.2.1 (RTX 4090) and written up in d3d12_vulkan.md A.3: 0 unimplemented
imports; the PC struct type ids work for configure and the CPU queries; one provider
"4.1.1"; the shipping build only has 1280x720 -> 1920x1080 Quality with HDR, inverted depth
and auto exposure, and wants a version descriptor <= 4.1.1. ffxCreateContext then returns
ERROR without touching the device for the PC DX12 backend descriptor, three guesses at the
Xbox one, and none at all: the Xbox backend descriptor is the missing piece.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:58:24 +01:00
a7ce844d2a d3d12_vulkan_device_test: skip tiling layouts the host runtime refuses
@CharlyRien found in #295 that an RTX 3090 on driver 616.56 (tiled tier 3)
refuses reserved texture arrays whose mips reach the packed tail (cases 2, 6
and 8), which an RTX 5070 on 621.01 accepts; the comparison counted that as a
mismatch. A layout the host refuses is now logged and skipped; one the host
accepts and the layer refuses is still a mismatch; with every layout skipped
the comparison reports itself skipped. The skip path was checked by making
the host refuse one case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:57:06 -06:00
8c8388f599 Runtime: reserved resources and GetResourceTiling on Vulkan (D3D-20)
CreateReservedResource (and 1 and 2) reserve the whole resource linearly, as
docs/d3d12_vulkan.md section 4.2 plans for the first boot: a committed
resource on a default heap underneath, so every tile is backed and starts
zeroed. D3D12's description rules are kept as measured on the PC runtime
(ROW_MAJOR buffers, 64KB swizzle layouts for textures, a format with a tile
shape; GetHeapProperties is E_INVALIDARG on a reserved resource). The Xbox
tiled layout word 0x101 is accepted as 64KB_UNDEFINED_SWIZZLE.

GetResourceTiling comes from src/resource_tiling.h: the standard 64 KiB tile
shapes, standard and packed mips, per-mip tile counts and the tile order. The
device test compares it with the host PC runtime for 18 buffer, 2D, array,
block-compressed and volume layouts; resource_tiling_test checks the same
arithmetic without a GPU. Packed-mip tile counts are the driver's choice and
are this layer's own rule (tight linear size in whole tiles).

UpdateTileMappings and CopyTileMappings log once and do nothing; what that
loses (aliasing, unmapped tiles keeping data) is written down in section 4.2.

Tested on an RTX 5070 (driver 621.01) under VK_LAYER_KHRONOS_validation.
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:57:06 -06:00
3de32fb363 Translator: s_lshl1_add_u32 ... s_lshl4_add_u32
All four raised Unsupported. D = (S0 << N) + S1; SCC is the unsigned
overflow of the sum taken in 64 bits (RDNA ISA pseudocode), so a bit shifted
out of S0 sets it as well as a carry out of the add.

tests/semantic/test_salu_lshl_add.py checks D and SCC against a plain-Python
reference, and the carry feeding s_addc_u32; docs/design.md gets a contract
row.
2026-11-21 20:56:40 -03:00
068b53b122 Translator: s_absdiff_i32 and s_mul_hi_i32
Both raised Unsupported. s_absdiff_i32 is |S0 - S1| with the 32-bit
difference wrapped first (RDNA2 ISA pseudocode), SCC = D != 0. s_mul_hi_i32
is the high word of the signed 64-bit product and leaves SCC alone.

tests/semantic/test_salu_absdiff_mul_hi.py checks both, with SCC, against a
plain-Python reference; docs/design.md gets a contract row.
2026-11-21 20:55:31 -03: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
500255da2a Merge main and retain typed view cache with bindless preparation 2026-11-21 19:55:10 -04:00
e7f5ecb4eb test(shader): check a16 gradient register order
Exercise the mixed-width address on CPU by tracing the gradient operands of the existing synthetic shader to its full 32-bit VGPRs. The GPU fixture remains the coordinate-selection check.
2026-11-22 00:54:33 +01: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
d9e629288a FUZZ-5: memory differential fuzzer (tools/mem_diff.py)
tools/mem_diff.py runs seeded s_load, s_buffer_load, buffer load/store/atomic and global load/store programs through a small reference model written from the RDNA2 addressing rules and through the translation in spirv_mini_interp, and compares the exported words and the whole final memory. Accesses are generated in bounds; OOB, OOB_SELECT, swizzle and the s_buffer_load truncation are left for GPU-confirmed rules.

spirv_mini_interp gains OpSConvert and 32-bit PhysicalStorageBuffer atomics (spec semantics, one invocation), with tests.

The fuzzer found the global_* negative-offset bug that #421 fixes; its global family and tests/test_mem_diff.py's regression test pass once #421 is in.

AI-assisted.
2026-11-22 00:52:32 +01:00
eaae31f609 Merge main; leave the s_ff fix to #349; review fixes for salu_diff
SHADER-46 (#349) fixes the same s_ff0_i32_b32 bug and was opened first, so
this branch drops its translator change and ps_salu_ff and keeps the
fuzzer. s_bfe_* control words stay inside offset + width <= 32 unless
--bfe-any; --programs/--max-ops below 1 is an argument error; the tests
no longer exclude s_min/max_i32 (#332 is on main) and check the BFE range.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:50:03 +01:00
399b8ff839 Merge main into D3D-26: the replay test's new part D, the resolve-region section
main's vk_command_replay_test now has a part D (sync/access pairs), so the
D3D-26 test becomes part E. The device test's D3D-26 section signals fence
value 7, after main's resolve-region section took 5 and 6. The docs keep
both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:49:29 +00:00
f6431b626b docs: explain nested bank paths in short audio exports 2026-11-22 00:48:17 +01:00
43ed7531b6 runtime: residency and power methods on the Vulkan device as documented no-ops (D3D-33)
MakeResident, Evict, SetResidencyPriority, EnqueueMakeResident, SetStablePowerState and
SetBackgroundProcessingMode. Vulkan memory stays resident until it is freed and paging is the
kernel driver's job, so there is nothing to do; each method still checks its arguments
(E_INVALIDARG) and EnqueueMakeResident signals its fence so a queue waiting on it does not hang.
SetBackgroundProcessingMode sets its completion event at once. d3d12_vulkan_device_test covers the
success paths, bad arguments, and the fence signal seen by a queue Wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:47:00 +00:00
7b6139cdff Report invalid BVH roots and clarify index output 2026-11-21 23:46:04 +00:00
19a5b1e165 docs: identify shader profile counts as historical 2026-11-22 00:45:42 +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
8b58a7206d tests/docs: run_gpu_tests' draw-shader test knows #193's vs_clip variants; drop a duplicated docs row
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 18:44:31 -05:00
47d25c431f Merge pull request #399 from fearkov 2026-11-21 18:43:25 -05:00
81de10e385 Merge pull request #396 from Andrea 2026-11-21 18:43:25 -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
19d4dbb665 docs: mention the llvmpipe section in the docs index
AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D7JEiKsTUaHQbCTdc4Eghy
2026-11-21 23:42:25 +00:00
49f4958a4b CI: run the GPU tests on Mesa llvmpipe
The linux-gpu-tools job built the GPU test programs but never ran them.
It now installs llvmpipe (software Vulkan), llvm-mc and SPIRV-Tools and
runs scripts/run_gpu_tests.py twice: natively (31 pass, 29 expected
skips: 8-wide subgroups, no fragment barycentrics) and the compute tests
with LEONIDA_W64_EMULATE=1 (33 pass). The emulated mesh tests are left
out because llvmpipe's compiler aborts on them. docs/testing.md gets a
section on running the suite without a GPU.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D7JEiKsTUaHQbCTdc4Eghy
2026-11-21 23:39:29 +00:00
ebe20364d6 Merge pull request #390 from Luiz Neves 2026-11-21 18:38:08 -05:00
b7165a474b Merge pull request #387 from nicolas 2026-11-21 18:38:06 -05:00
d71451f29d Merge pull request #380 from FreddyxS 2026-11-21 18:38:05 -05:00
de3da41ab8 Merge pull request #368 from crastinator 2026-11-21 18:38:02 -05:00
d661e9e808 Merge pull request #359 from Rayhan Robin 2026-11-21 18:38:00 -05: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
99f39062e3 Merge pull request #347 from Kam471 2026-11-21 18:37:57 -05:00
b6c30e6e35 Merge pull request #345 from kotorvr 2026-11-21 18:37:57 -05:00
f3c2158d8a Merge pull request #342 from Kam471 2026-11-21 18:37:56 -05:00
84c66f7196 Merge pull request #331 from fearkov 2026-11-21 18:37:54 -05:00
e70a4f3bbd Merge pull request #328 from Jan Trencansky 2026-11-21 18:37:54 -05:00