Commit Graph

4163 Commits

Author SHA1 Message Date
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
e53b9e5450 Tests: add ms_wave_info_s3 mesh shader test for s3[27:24] wave ID 2026-11-21 21:05:43 -03:00
1284712038 Docs/Tools: record SHADER-4 corpus counts and add audit_shader4_regs.py 2026-11-21 21:05:25 -03:00
d546ab799e test(runtime): report resolve comparison and match counts accurately 2026-11-22 01:05:21 +01:00
69d8741e1a test(runtime): add unit tests for PE loader boundary validation 2026-11-22 01:04:19 +01:00
fb5524f8ac test(runtime): clear multisampled resolve inputs as attachments 2026-11-22 01:03:51 +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
bdb57efee8 test(runtime): tidy resolve comparison support checks 2026-11-22 01:03:05 +01:00
a818069fbd test(runtime): fix readback descriptor construction in resolve cases 2026-11-22 01:02:44 +01:00
5eda82746f test(runtime): compare resolve results with the host D3D12 runtime 2026-11-22 01:02:26 +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
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
fb0d52c60c fsr/bvh tests: read the module TLS index from either loader (#95's tls_slot or #93's tls_index)
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:58:24 +01:00
ba62e9ec9f bvh_builder_test: LEONIDA_BVH_DEVICE=vulkan puts the builder on the Vulkan-backed device (#119)
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:58:24 +01:00
1e7a6c6846 fsr/bvh tests: run on main's loader (#95): Loader::initialise, unwind registered here until #93; FSR checks its TLS block
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
0feffed584 WIP: bvh_builder_test (local, measuring the constructor) 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
b4e31e3d3a d3d12_vulkan_device_test: the reserved-resource copies wait on fence value 9
The resolve-region test on main now signals 5 and 6, so a wait on 5 returned
before the copies ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:57:57 -06: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
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
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
f6b3d3a24c Loader: reject a delay-import descriptor with no name table
An IAT without an INT still holds delay thunks, not name RVAs, so eager binding has no symbol to resolve. Reject the form with a clear error. A scan of the installed x64 System32 tree found 4,620 DLLs and 17,558 delay descriptors, none with a missing INT or without dlattrRva. The test now expects the rejection.
2026-11-21 15:51:43 -08: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
76782b4b9b Runtime: skip the 1.2 path in d3d12_xs_root_signature_test on old runtimes
test_version_1_2 serialized a 1.2 signature before checking feature support,
so it would fail on an in-box runtime that lacks 1.2 (e.g. Windows 11 23H2).
Check CheckFeatureSupport(D3D12_FEATURE_ROOT_SIGNATURE) up front and skip the
whole 1.2 path when HighestVersion < 1.2, matching the root_sig_test fix.

AI-assisted (Cline).
2026-11-22 00:47:28 +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
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
86bbb87fcc Runtime: make the deserializer host-check robust to runtime behaviour
The host deserializer rejects an Xbox-high-byte blob on newer runtimes but
accepts it (keeping the high byte) on older ones such as Windows 11 23H2, so
"host deserializer rejects the Xbox high byte" failed there. Replace it with a
check that holds either way: if the host accepts, it must keep the high byte
(which is the bug the shim fixes); if it rejects, print that instead.

AI-assisted (Cline).
2026-11-22 00:44:27 +01:00
648a84a930 Merge pull request #400 from Ewann 2026-11-21 18:43:26 -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
5f2456327b Runtime: skip the 1.2 serializer checks when the host runtime lacks 1.2
Older in-box D3D12 runtimes (e.g. Windows 11 23H2) refuse root signature 1.2
entirely, so root_sig_test's 1.2 serializer checks fail there even though the
flag clearing is correct. Gate the serializer-dependent 1.2 checks on
CheckFeatureSupport(D3D12_FEATURE_ROOT_SIGNATURE) >= 1.2, printing SKIP
otherwise. The byte-level helper checks never touch the serializer and stay
unconditional.

AI-assisted (Cline).
2026-11-22 00:42:08 +01:00
eb330b6864 Resolve generated clip variants through their shared assembly source 2026-11-21 15:40:46 -08:00
215ccc665d Merge pull request #376 from Codex 2026-11-21 18:38:05 -05:00
de3da41ab8 Merge pull request #368 from crastinator 2026-11-21 18:38:02 -05:00
4674267f00 Merge pull request #361 from Luis Baker 2026-11-21 18:38:01 -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
ed6b5236e5 Merge pull request #348 from traeb0n 2026-11-21 18:37:58 -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
537176f4d7 Merge pull request #316 from IAmNotSiob 2026-11-21 18:37:52 -05:00
8b92bcef0d Merge pull request #193 from AREA52 Agent 2026-11-21 18:37:42 -05:00
99e4044d6b Merge pull request #93 from Kam471 2026-11-21 18:37:42 -05:00
421207afdc Runtime: clear the Xbox flag high byte in the d3d12_xs deserializer
The d3d12_xs shim masked 0x03000000 on a copy before the host serializer but
forwarded D3D12CreateRootSignatureDeserializer blobs unchanged. The host
deserializer rejects a blob whose RTS0 flags carry that high byte (measured
E_INVALIDARG), and docs/d3d12_vulkan.md says the flags "must be masked on a
copy before the host serializer/deserializer".

copy_rts0_blob_clear_xbox_flags walks the DXBC chunk table to the RTS0 chunk,
clears bits 24-31 of its flags on a copy, and the deserializer forwards that
copy when a rewrite is needed. root_sig_test adds test_deserializer: it
tampers a serialized blob with 0x03000000, checks the host rejects it, and
checks the registered shim deserializer clears it and returns flags 0.

AI-assisted (Cline).
2026-11-22 00:36:18 +01: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
6ae02af006 Merge main into d3d-25-uav-clears
Conflicts: main moved texture create info into texture_create_info (the UAV
attachment usage now goes there, so placed-resource sizing agrees) and edited
the same docs paragraphs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:33:19 +00:00