Commit Graph

35 Commits

Author SHA1 Message Date
ae0805f8c8 Merge pull request #1873 from CLHelper 2026-11-22 09:49:00 -05:00
4a20110919 GPU tests: vk_harness skips a device with fewer push-constant bytes than it pushes
vk_harness declared a 144-byte push-constant range (152 with
--mesh-compute) without checking maxPushConstantsSize. On a device with
128 bytes, the Vulkan minimum, that is invalid
(VUID-VkPushConstantRange-size-00298), and on an AMD Radeon 610M on
AMD's Windows driver ms_clip crashed (0xC0000005) and ms_w64x_ballot
under LEONIDA_W64_EMULATE=1 hung until the runner's timeout.

It now checks the limit once, right after it knows whether it runs a
--mesh-compute module, and exits 77 with "unsupported: need N push
constant bytes, device has M", as vk_texture_test (#862) and
vk_bindless_test/vk_image_fuzz (#1113) already do. The range and the
pushes use the same pc_bytes.
2026-11-22 14:44:30 +00:00
2828e0c892 TEST-251: GPU checks of wave64 vertex shaders split into two 32-lane halves
RADV runs the VS stage as wave64 by default and as wave32 with
RADV_PERFTEST=gewave32, so w64_graphics.py now draws seven vs_w64_*
fixtures (tiers A, B and C) both ways and compares the words each vertex
stores to the heap. vs_w64_c_lane_id is the probe that the wave size
changed. vk_harness gets VKH_VERTICES to draw enough vertices to fill
waves. Checked on an RX 9070 XT (GFX1201) and a Ryzen 9800X3D iGPU
(GFX1036), RADV Mesa 26.3.1: 21/21.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:36:08 +03:00
ce305ec6b3 Translator: wave64 VS/PS/GS on 32-wide subgroups when the halves can't tell (SHADER-10)
tools/wave64_halves.py classifies each wave64 VS/PS/GS by partition
invariance: A exact as translated, B exact by construction (waterfall loops,
wave-aggregated atomics up to slot order, readfirstlane/readlane of values
that are the same in every lane), C not exact (lane counts/ranks/ids,
readlane of varying data, stale scalars behind votes, masks as data, ...).
index.json gets wave64_graphics, wave64_graphics_reasons and
wave64_graphics_idioms; --wave64-graphics warn|error|off (error refuses
tier C). One rewrite: readlane of a proven-uniform VGPR reads the own copy.
--census prints tier counts from an index.json. ps_w64_* fixtures,
w64_graphics.py (fragment subgroup size required 64 vs 32) and semantic
tests; vk_harness gets VKH_HEAP_DUMP and a subgroup-size report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:03:37 +01:00
fdf8eebf13 vk_harness: guard the shader-fma feature struct for Vulkan headers without VK_KHR_shader_fma
The Linux CI's Vulkan headers predate VK_KHR_shader_fma, where ShaderFma has
no features member; the other tools chain it through link_after, which is
already guarded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:54:42 +01:00
e256a2547c Translator: --fma khr emits OpFmaKHR for fused multiply-adds
GLSL.std.450 Fma may be split into two roundings by a driver (Vulkan
environment: inherited from OpFMul followed by OpFAdd); RDNA2 v_fma_* round
once. --fma khr (default stays glsl) emits OpFmaKHR with capability FMAKHR and
SPV_KHR_fma and lists shaderFmaFloat32 in the index. Runtime device creation
and the vk_* test programs enable VK_KHR_shader_fma when present; cs_fma_fused
tests single rounding; the mini interpreter learns OpFmaKHR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:25:37 +01:00
caad84c32b Translator: --mesh-compute runs mesh shaders without VK_EXT_mesh_shader
9,282 of the 26,503 shaders are mesh shaders, and a device without
VK_EXT_mesh_shader (NVIDIA Pascal, for one) can't run any of them. With
--mesh-compute each becomes a GLCompute module with the same workgroup size
and code; only the epilogue changes. After the same barrier, lane 0 writes
the vertex and primitive counts, lane i its vertex and its primitive, into
this workgroup's slot of an output buffer whose address is in push-constant
dwords 36-37 (152 bytes). The slot layout is mesh_compute_layout() and the
index records it as mesh_compute.

- tools/mesh_compute_vs.py: the vertex shader that draws the slots with a
  non-indexed draw of groups * max_primitives * 3 vertices; unused and
  culled primitives are clipped away, params keep their locations.
- vk_harness: VKH_MESH_COMPUTE (+ VKH_MESH_SLOT, VKH_MESH_PRIMS) dispatches
  the module, adds a compute->vertex barrier and draws.
- run_gpu_tests.py / check.py: LEONIDA_MESH_COMPUTE=1 (check.mesh_env).
- tests/test_mesh_compute.py; docs/design.md row "Mesh shaders as compute",
  docs/testing.md section.

GTX 1060 (Pascal) with LEONIDA_MESH_COMPUTE=1 LEONIDA_W64_EMULATE=1: all five
ms_* tests pass (SKIP before), zero validation messages. Mesh corpus: 9,282 of
9,282 translate and pass spirv-val with --mesh-compute --wave64-emulate, and
all 9,282 generated vertex shaders validate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJXX67xeoorUsLJ2f9zms
2026-11-22 00:21:36 -08:00
d1d23d842d Merge pull request #804 from Jess-Doit 2026-11-22 01:37:54 -05:00
4030a386fb Translator: --bary-fallback for raw barycentrics without VK_KHR_fragment_shader_barycentric (SHADER-98)
The 321 pixel shaders that read the raw barycentric pair are translated to
BuiltIn BaryCoordKHR, so they can't run on a device without the extension
(NVIDIA Pascal, for one). With --bary-fallback the pair comes from an
ordinary vec3 input one location past the shader's attributes; the module
needs neither the capability nor the extension, and the index records the
location as bary_fallback_input. tools/bary_fallback_gs.py writes the
pass-through geometry shader that fills it: Position and the PS's inputs
copied unchanged, plus (1,0,0), (0,1,0), (0,0,1) at the three vertices,
whose perspective interpolation is the BaryCoordKHR value.

- LEONIDA_BARY_FALLBACK=1 for build.py, check.py and run_gpu_tests.py
  (like LEONIDA_W64_EMULATE): translate with the flag, build
  <name>.bary_gs.spv, draw those shaders through it.
- vk_harness: VKH_GS_HELPER=1 keeps VKH_SUBGROUP_SIZE on the fragment
  stage when the GS only feeds the pixel shader under test.
- tests/semantic/test_bary_fallback.py and the ps_bary fixture.
- docs/design.md contract row and index key, docs/testing.md section.

GTX 1060 (Pascal): ps_bary 4096/4096 exact, ps_uniform_branch and
ps_scc_mask32 pass with the fallback (SKIP without it). Pixel-shader corpus:
12,101/12,101 translate and pass spirv-val with and without the flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJXX67xeoorUsLJ2f9zms
2026-11-21 22:28:25 -08:00
6d7bb1755a Tests: shader tools honor LEONIDA_VK_DEVICE
The GPU tools picked a device with the shared ranker but never applied the
name filter the D3D12 tests have used since #861. Filter candidates through
vulkan_device_wanted in vk_device_pick.h, report a filter that matches nothing
instead of dereferencing a null device, and cover the filter cases in the
picker test. docs/testing.md no longer says the tools ignore it.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-22 00:02:29 -06:00
9806be2999 Tests: prefer the native Vulkan ICD over Mesa's Dozen on Windows
With the Compatibility Pack installed, Windows enumerates Mesa's D3D12
translation layer next to the real GPU, and Dozen reports DISCRETE_GPU. Every
harness used "the last discrete device wins", so it selected the wrapper and
the resulting failures looked like translator bugs (#915). One shared rank now
treats Microsoft's vendor as a translation layer, then prefers discrete over
integrated over virtual over CPU, keeping the first device on a tie. A CPU-only
test covers the reported enumeration without needing the Compatibility Pack.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 22:58:59 -06:00
f054ef9e43 vk_harness: fix the Float64 unsupported message (a raw newline had split the string literal)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:10:59 +01: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
25ca1d63f2 Merge upstream main into SHADER-7 and retain filtered clip dependencies 2026-11-21 15:31:09 -08:00
ce41eba4f7 Merge current main and preserve distinct mesh and clip harness modes 2026-11-21 14:33:12 -08:00
94ff4c9da9 Merge remote-tracking branch 'origin/main' into test19-vcc-x2-gpu
# Conflicts:
#	runtime/test/shaders/check.py
#	runtime/test/vk_harness.cpp
#	scripts/run_gpu_tests.py
#	tests/test_shader_checks.py
2026-11-22 00:24:49 +02:00
d9c0ab5b48 vk_harness: VKH_HEAP on a device without buffer addresses is a SKIP; stricter VKH_SGPRS/VKH_HEAP parsing
A device without bufferDeviceAddress or shaderInt64 now gets "unsupported: ..." and exit 77, which check.py and
run_gpu_tests.py report as SKIP (the same handling as #203), so ps_vcc_x2 doesn't turn into a FAIL there. Words
are decimal or 0x hex only (no octal, sign or spaces), a trailing comma is rejected, and an empty VKH_HEAP is unset.
2026-11-21 23:57:11 +02:00
58f3fe8f6b GPU tests: run ps_vcc_x2 on the GPU with a seeded V# and heap in vk_harness (TEST-19)
ps_vcc_x2 reads two dwords through the V# in s[0:3], but vk_harness pushed zeros and bound no memory, so on the
GPU it read address 0 and lost the device; run_gpu_tests.py skipped it and check.py left it out. vk_harness now
takes VKH_SGPRS (user SGPRs) and VKH_HEAP (addr=word seeds in a 64 KiB device-address heap, passed as the heap
base, with bufferDeviceAddress and shaderInt64 enabled only then). Both runners give ps_vcc_x2 the V# and words
tests/semantic uses and expect 0x11223344 0x55667788 0 0.
2026-11-21 23:51:16 +02:00
a81bcb8284 Merge pull request #207 from LouisRiverstone
# Conflicts:
#	runtime/test/vk_harness.cpp
2026-11-21 16:38:32 -05:00
e9cb0b0e68 Merge pull request #203 from Ayinaki
# Conflicts:
#	tests/test_shader_checks.py
2026-11-21 16:38:18 -05:00
49f24bf596 Merge pull request #219 from Diesel 2026-11-21 16:37:31 -05:00
e8a0b11ada Test mesh v5 against all 24 coordinates of a 3D draw 2026-11-21 22:33:25 +01:00
cdc67e4d20 GPU tests: report gs_tri/ms_tri as SKIP without geometry or mesh shaders (TEST-18)
vk_harness exits 77, the code vk_compute_test and vk_store_test already use for a
device that cannot run a test, when VKH_GS is set and the device has no
geometryShader, or VKH_MESH is set and it has no VK_EXT_mesh_shader. Before, a
missing mesh extension exited 1 and a missing geometryShader failed in
vkCreateDevice with VK_ERROR_FEATURE_NOT_PRESENT (MoltenVK, #166).

run_gpu_tests.py (gs_tri, ms_tri, ms_w64x_ballot, ms_clip) and check.py
(ms_w64x_ballot) turn that exit code into SKIP, quoting the harness's reason.
2026-11-21 18:29:45 -03:00
369a062595 Merge main and preserve clip fixtures alongside updated GPU test tooling 2026-11-21 13:26:15 -08:00
f348eb9be0 GPU tests: skip pixel tests without barycentrics and narrow subgroups 2026-11-21 21:17:07 +00:00
c45309e29f Integrate #188 and guard maintenance8 by its Vulkan header macro 2026-11-21 22:10:07 +01:00
b39592d530 Test two-plane vertex clip coverage against per-pixel CPU masks 2026-11-21 13:05:32 -08:00
1def0f7a1f CI: build vk_harness with Vulkan headers that lack maintenance8 2026-11-21 21:03:23 +00:00
12ddbc68f3 tests: add ms_clip GPU test and enable shaderClipDistance/shaderCullDistance in vk_harness 2026-11-21 16:57:03 -03:00
6f486f75d3 Merge pull request #13 from eIBart0 2026-11-21 11:46:54 -05:00
e72e13ecfe Vulkan tests: fix AMD vk_store_test bindings, add subgroupSizeControl, add GPU test runner 2026-11-21 10:55:05 -03:00
4146672f58 Vulkan tools: fix builds on Linux 2026-11-21 02:35:54 -03:00
95447e081e Translator: mesh and geometry shaders, SCC from scalar ALU, general buffer format stores, more CS ops
- Mesh shaders -> VK_EXT_mesh_shader: PSV0 limits/topology/group size, v5 = workgroup index, s3 = wave
  id << 24, NGG exports staged per thread and written after OpSetMeshOutputsEXT (GS_ALLOC_REQ counts).
  GPU-checked (VKH_MESH mode in vk_harness).
- Geometry shaders ($GS_VoxelizeGeneric): LDS-ring inputs/outputs mapped to gl_in / staged slots,
  EMIT/CUT -> OpEmitVertex/OpEndPrimitive. GPU-checked (VKH_GS mode).
- SCC is now set by s_and/or/xor/andn2/orn2/nand/nor/xnor/lshl/lshr_b32 (result != 0),
  s_add/sub_i32 and s_addk_i32 (signed overflow), s_min/max_u32; it was left stale before. GPU-checked.
- buffer_store_format(_d16) encodes every table format (sub-dword elements via atomics); it silently
  stored nothing for most formats before. GPU-checked with vk_compute_test.
- Far branches folded; d16 buffer loads; gather4_l(_o) emulation; gather offsets; 1D/a16 image stores;
  BITMASK_PERM swizzles; f64 add/convert; i24 mul/mad, alignbyte, xnor, ffbh_i32, swap, s_abs, s_bfm,
  64-bit ordered/cmpx compares, 16-bit compares, 8/16-bit global loads, neg() operands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 21:48:58 -05:00
bd2dd1c874 Translator: compute shaders, LDS, wave-uniform branches, typed image stores; all VS/PS failure groups
- Compute: FSSM word 0x138 is COMPUTE_PGM_RSRC2 (user SGPRs, workgroup-id enables, thread-id VGPRs,
  LDS size), 0x13C..0x144 the group size; checked against 2,689 CS. GPU-checked with vk_compute_test.
- LDS as a Workgroup array (reads/writes/read2/write2/st64/sub-dword/atomics/cmpst), ds_bpermute,
  s_barrier as a workgroup control barrier.
- s_cbranch_vccz/vccnz/execz/execnz decided wave-wide (OpGroupNonUniformAny); v_cmp writes 0 for
  inactive lanes. GPU-checked.
- image_store for 2D/2D array/3D with float/uint/sint views picked from the T# FORMAT at run time.
- Raw barycentric reads via BaryCoordKHR (321 PS), POPS via fragment-shader interlock, image_sample_o
  offsets, fma_f16 op_sel, 64-bit v_cmpx, vcc_lo scalar loads, s_addk to specials, undeclared vertex
  components, normalized-encoding re-anchoring, array image_get_lod/gather4_lz, image_sample_l LOD on
  arrays (was reading the layer).
- Duplicate vector/pointer type declarations merged; vk_harness enables barycentrics/interlock/maintenance8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 18:59:41 -05:00
db0dc8bd5e Initial commit: Leonida, build-it-yourself PC port groundwork
Shader pipeline (carve, FSSM unpack, gfx1013 disassembly, RDNA2 to SPIR-V),
asset export via rpf9-explorer's Core (submodule), PE loader and shim
skeleton, and make_game.py, which builds from the user's own copy of the game.
No game data, keys or executables are included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:22:16 -05:00