Commit Graph

33 Commits

Author SHA1 Message Date
ab09fd1f86 Merge main: keep --no-ftz32 and --integer-dot-fallback next to --explicit-lod-bias
tools/rdna2spirv.py: main's float-only typed implicit sample (OpImageSampleImplicitLod)
is used only without --explicit-lod-bias; with the flag the Grad path still
scales the derivatives by the S# bias.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 11:46:44 +01:00
b2c9695962 Fix NVIDIA sparse arena, MSVC TLS callbacks, FTZ32 probe, teardown leaks, and cross-GPU tests 2026-11-28 16:34:52 -05:00
a8b1abe4c2 Merge upstream ProjectLeonida/mandy main (0318164b8) into test/round10
# Conflicts:
#	tools/vk_subgroup_info.py
2026-11-28 08:35:30 -05:00
f238fb2756 Merge remote-tracking branch 'refs/remotes/origin/main' into HEAD 2026-11-28 14:30:44 +01:00
0513e00b07 rdna2spirv: the 4x8-bit dot products as SPV_KHR_integer_dot_product
v_dot4_i32_i8, v_dot4c_i32_i8, v_dot4_u32_u8 and v_dot4c_u32_u8 become one
OpSDot / OpUDot on the packed bytes plus OpIAdd for the addend, and
OpSDotAccSat / OpUDotAccSat under clamp (both saturate the addend plus the
exact sum, as the hardware does). op_sel halves are put together into one
dword first. RADV did not re-form v_dot4 from the old expansion (four
extracts, multiplies and adds each), which made the FidelityFX upscaler
passes ALU bound.

--integer-dot-fallback keeps the expansion for a device without
shaderIntegerDotProduct (required by Vulkan 1.3): vk_subgroup_info.py
reports integer_dot_product and make_game.py turns the flag on where it is
false. The runtime and vk_pipeline_check enable the feature where the
device has it; the interpreters of the semantic tests run the new ops.

Tested: tests/semantic/test_packed_dot4.py (new fixtures), the translator
suite, tools/dot_diff.py on the four ops, a wave32 GPU program on the
Radeon iGPU (gfx1036) and the RX 7900 XTX against the gfx1036-measured
words, RADV statistics of the upscaler passes (docs/design.md row).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 05:48:33 -05:00
828541806e Merge main into bary-raphael-old-amd
tools/vk_subgroup_info.py: main now confirms the per-vertex feature by its extension after a device is chosen; this branch adds the chosen driver version to the same tuple. Both kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 11:27:14 +01:00
b145659304 Merge remote-tracking branch 'origin/main' into fix/explicit-lod-bias-moltenvk
# Conflicts:
#	tools/vk_subgroup_info.py
2026-11-25 23:54:57 +01:00
a03715c46a vk_subgroup_info --lod-bias: measure mipLodBias with one compute dispatch, no test programs needed (SHADER-EXPLICIT-LOD-BIAS-MVK)
tools/vk_lod_bias.py clears a two-level R32_SFLOAT image to 0.0 / 1.0 and
samples it at explicit LOD 0 through samplers with mipLodBias 0 and +1, from
Python through ctypes. vk_subgroup_info.py --lod-bias reports the answer as
explicit_lod_bias; lod_bias_probe.py uses it first and draws ps_ssharp only as
a fallback, with the Homebrew llvm-mc hint when llvm-mc is missing (#1774
review). build.py and make_game.py can now measure too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 19:38:34 +01:00
66b27ac6e2 lod_bias_probe: measure whether the sampler applies mipLodBias instead of keying --explicit-lod-bias on MoltenVK's driver ID (SHADER-EXPLICIT-LOD-BIAS-MVK)
The same MoltenVK 1.4.2 drops the bias on an Apple M3 and applies it on an
Apple M5 Pro (#1774 review), so the driver-ID rule turned ps_ssharp red on
the M5 Pro. tools/lod_bias_probe.py translates vs_ids and ps_ssharp without
the flag and draws LOD_BIAS 0, +1 and -1 with vk_sampler_test; the flag is
on only when +1 and -1 read the no-bias levels. run_gpu_tests.py, build.py
and make_game.py take its answer; vk_subgroup_info.py is back as on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 15:18:12 +01:00
1d19671ebd rdna2spirv: --explicit-lod-bias applies the S# LOD bias in the shader where MoltenVK drops the sampler's (SHADER-EXPLICIT-LOD-BIAS-MVK)
MoltenVK 1.4.2 drops VkSamplerCreateInfo::mipLodBias from both explicit and
derivative-LOD samples, so ps_ssharp's S# LOD_BIAS cases fail on every Mac.
With the flag the translator adds the S# bias (word 2 [13:0], signed 5.8) to
explicit LODs and to _b biases, as a Bias operand on implicit samples, and as
a 2^bias scale of Grad derivatives. tools/vk_subgroup_info.py reports
explicit_lod_bias for MoltenVK's driver ID, and run_gpu_tests.py, build.py
and make_game.py turn the flag on from it. ps_ssharp gains +-0.3 cases, which
fail when the bias counts twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 12:16:05 +01:00
d239a9c802 vk_subgroup_info: take the barycentric fallback on a Raphael iGPU under AMD's 23.20.44 Windows driver (SHADER-BARY-RAPHAEL-OLD-AMD)
On a Raphael RDNA2 iGPU (Ryzen 7 7700, PCI 1002:164E) under AMD's proprietary Windows driver 31.0.22044.1 (Vulkan driverVersion 2.0.283, driver info and compiler 23.20.44), the GPU test ps_bary reads a wrong third BaryCoordKHR component (0.992 where 0.0039 is expected), and it passes with LEONIDA_BARY_FALLBACK=1. barycentric_fallback now returns true for that PCI ID under VK_DRIVER_ID_AMD_PROPRIETARY only while driverVersion is at most VK_MAKE_VERSION(2, 0, 283); newer drivers, other RDNA2 devices and RADV keep native barycentrics. query() reads driverVersion from VkPhysicalDeviceProperties and passes it on; an unreported version (0) takes no fallback from this rule. LEONIDA_BARY_FALLBACK=0 turns it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 17:26:40 +01:00
95fb20df04 vk_subgroup_info: reuse Vulkan 1.2 extensions and defer 1.3 query until chosen
Commit de286bf79 checked VK_KHR_fragment_shader_barycentric via
device_extensions(vk, d) inside the device-selection loop, which enumerated
extensions a second time on Vulkan 1.2 devices (already queried for
VULKAN_12_REQUIRED_EXTENSIONS) and on lower-ranked Vulkan 1.3 devices later
superseded by a higher-ranked GPU.

Reuse the cached Vulkan 1.2 extension set and defer the Vulkan 1.3
device_extensions() call until after the winning device is final. Add unit
tests verifying Vulkan 1.2 single-enumeration reuse and Vulkan 1.3 deferred
enumeration when an iGPU precedes a dGPU.

AI-assisted: yes (JARVIX: Antigravity + DeepSeek-V4-Pro + NVIDIA NIM Nemotron-3-Ultra-550B).
2026-11-24 10:04:03 +00:00
de286bf791 vk_subgroup_info: per_vertex_inputs needs VK_KHR_fragment_shader_barycentric listed
RADV (Mesa 26.2.6) sets fragmentShaderBarycentric on a gfx90c iGPU (Vega 8,
PCI 1002:15E7) that doesn't list VK_KHR_fragment_shader_barycentric, so
per_vertex_inputs read true there. run_gpu_tests.py then didn't turn on
--f16-interp-fallback and ps_interp_f16_high skipped; make_game.py reads the
same field and would keep PerVertexKHR inputs the device can't run.

The feature now counts only with its extension in the device's list. The
gfx90c/RADV measurement goes into docs/testing.md.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 10:02:30 +00:00
bcfabd83d7 Enable subgroup size control on Vulkan 1.2 devices 2026-11-24 02:56:34 +05:30
86a7807dd4 Barycentric fallback on by itself on AMD's Windows driver for gfx90c (#5933) (#6828)
Squash-merged after diff review of PR #6828
2026-11-23 10:42:42 -06:00
d9f8f9eb9a Merge pull request #2442 from ZazaJr24 2026-11-22 16:59:16 -05:00
c9817d623f Audit wave64 graphics pipelines for the selected Vulkan device
Combine real graphics-chain manifests and translator wave tiers with per-stage Vulkan subgroup properties. Report aggregate counts and offer a strict gate for approximate or unverified stages.

AI-assisted. Tested with synthetic 32/64-lane capabilities, translated hand-written RDNA2 programs, and the live Vulkan probe on Mesa llvmpipe.
2026-11-22 21:58:22 +01:00
d920bbd60b Merge pull request #2841 from Vonsek 2026-11-22 15:12:30 -05:00
9ab773298f fix(tools): probe Vulkan 1.2 devices with runtime extensions
The D3D12 runtime accepts qualified Vulkan 1.2 devices. Give the shader preparation probe the same eligibility rules so it does not choose a different adapter or misreport its capabilities.
2026-11-22 19:27:06 +01:00
5d7d68ddf4 Merge pull request #2508 from whoalin1 2026-11-22 13:15:49 -05:00
1064a48b09 make_game: expose maxPushConstantsSize and auto-enable --pc-tail-ubo
Read VkPhysicalDeviceProperties.limits.maxPushConstantsSize (offset 328 on
64-bit) in tools/vk_subgroup_info.py and expose it as max_push_constants_size.

Add --pc-tail-ubo to make_game.py's forwarded translator fallback flags (so it
reaches translate(), fspx_shaders(), preflight(), and spirv/translator_flags.txt)
and enable it automatically for the shaders stage when the GPU the runtime would
use reports maxPushConstantsSize below what the shaders need (144 bytes, or 152
with --mesh-compute).

Co-Authored-By: Gemini 4 Neon <noreply@google.com>
2026-11-22 19:17:34 +02:00
d811bde9fa fix: use native wave64 on AMD Windows RDNA1 (BUILD-629) 2026-11-22 18:45:41 +02:00
d0c4fcc5d6 Merge pull request #1762 from Dominik 2026-11-22 10:38:52 -05:00
c505b623a0 test_vk_subgroup_info: a tester's own LEONIDA_VK_DEVICE no longer fails 45 cases
QueryTest and MainCliTest build fake devices and expect the unfiltered
pick, but read the caller's environment: with LEONIDA_VK_DEVICE=radeon set
(as docs/testing.md suggests on a multi-GPU PC) 45 of them failed on main.
setUp now clears it under mock.patch.dict; the filter tests still set it
themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:26:33 +00:00
d693fc6eef vk_subgroup_info: require bufferDeviceAddress and rank devices like vk_device_pick.h
Two differences from the GPU the runtime takes remained after #1755's
LEONIDA_VK_DEVICE filter:
- d3d12_vulkan_device.cpp skips a device without bufferDeviceAddress;
  the tool didn't check it (VkPhysicalDeviceVulkan12Features index 38).
- "the last discrete GPU wins" took Mesa's Dozen (Microsoft vendor
  0x1414, reported as discrete) over the native driver it wraps, the
  #915 problem vk_device_pick.h fixed. The tool now picks the first
  usable device of the highest rank (native over Microsoft's layers,
  then discrete > integrated > virtual > CPU), as vk_device_pick.h does
  and as the runtime does with #1799.

test_device_selection_rule: native vs Dozen in both orders, Dozen only,
integrated over an earlier CPU, first discrete wins a tie; a
no_buffer_device_address rejection case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:26:32 +00:00
8da0fd3d0b test(tools): add unit tests for vk_subgroup_info feature bitmasks and constants 2026-11-22 16:24:14 +01:00
0a3c6d71b9 Merge pull request #1755 from Alex Arenas 2026-11-22 09:15:06 -05:00
c96fdf1c56 vk_subgroup_info: filter physical devices by LEONIDA_VK_DEVICE (TEST-258) 2026-11-22 14:56:22 +01:00
95a89a75d3 make_game: --wave64-emulate auto leaves emulation off on RDNA2 under the AMD Windows driver (#857)
AMD's Windows shader compiler for RDNA2 crashes (access violation in
vkCreateComputePipelines) on many --wave64-emulate compute shaders with LDS
(#857). auto turns emulation on when any device is 32-wide, so an Intel iGPU
next to an RX 6000 card gets emulated modules, and the runtime then runs them on
the RX 6000.

tools/vk_subgroup_info.py now reports vendor_id, device_id, driver_id and
rdna2_amd_windows for the runtime's GPU (RDNA2 by PCI device ID, AMD proprietary
driver). auto leaves emulation off when that GPU is one and runs wave64
natively; on and off are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:15:04 +01:00
1681f3dc1e Translator: --f16-interp-fallback reads f16 halves without PerVertexKHR (SHADER-196)
MoltenVK can't compile PerVertexKHR to MSL, so ps_interp_f16_high failed at
pipeline creation on every Mac. With --f16-interp-fallback every VS/mesh param
(and the --mesh-compute VS) also exports its two f16 halves decoded to f32,
low halves at location 29 - 2N and high halves at 30 - 2N, and a PS *_f16 read
takes them as ordinary smooth inputs. A producer skips halves that would land
on its own params; a PS whose half location is also an attribute is rejected.
The index records f16_halves on both sides.

tools/vk_subgroup_info.py reports per_vertex_inputs (false without
fragmentShaderBarycentric or on MoltenVK); make_game.py and run_gpu_tests.py
turn the flag on where it is false. Without the flag all 139 GPU-test modules
are byte-identical to main's, so NVIDIA/AMD keep the exact per-vertex path.

Apple A18 Pro, macOS 26.6.2, MoltenVK 1.4.2: ps_interp_f16_high passes, all
4096 pixels bit-exact; run_gpu_tests.py 84 pass/50 skip/1 fail -> 85/50/0
native, 112/22/1 -> 113/22/0 with wave64 emulation; ms_f16_pack passes through
--mesh-compute. Semantic suite 1194 -> 1203 OK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-assisted
2026-11-22 14:32:28 +03:00
8abf740a7e [TEST-192] Detect default 64-wide subgroup path 2026-11-22 11:27:17 +01:00
da8420e8a5 Use the same MoltenVK library as the C++ subgroup checks on macOS 2026-11-21 22:21:52 -03:00
35b769453d test(tools): add synthetic unit tests for vk_subgroup_info 2026-11-22 00:55:59 +01:00