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>
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>
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>
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>
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>
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>
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>
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).
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>
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.
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.
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>
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>
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>
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
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").
tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The mode file is written before the translation starts (index.json is absent
then), not after it: a stop between the merge and the old write left an index
with no mode, which counted as "off" and either re-translated hours of work
or passed emulated shaders off as native.
- auto keeps shaders that were translated with emulation when this run would
not emulate (a GPU asleep or hidden, vulkaninfo missing): they are exact on
every GPU. An explicit --wave64-emulate off still translates natively.
- auto turns emulation on when tools/vk_subgroup_info.py says the runtime's GPU
can't be made to run compute and mesh 64-wide (subgroupSizeControl, both stage
bits: vk_pipeline_check's can_require_sg); it never turns it off.
- smallest_max_subgroup gives None (unknown, so on) when a device prints no
subgroup size instead of leaving it out of the minimum.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>