Commit Graph

72 Commits

Author SHA1 Message Date
f474c74b04 Merge origin/main (f9f3ec4c6) into the carry of #2174
Current main after #2566. New conflict on top of the earlier carry merge:
tools/rdna2spirv.py, _translate (straight-line and CFG paths): main passes
extra=meta_extra to _shader_meta.collect and reads the literal samplers
after it; the PR's g.note_pops_word(insns) runs right after that block,
before fit_shared_memory / needs_barrier_rounds as before.

Co-authored-by: QemmHD <290605352+QemmHD@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:30:43 +01:00
173c5d41a6 Merge origin/main into carry/pr-2174
vk_harness: main's has_cap scan of both stages, plus needs_interlock = has_cap(fs_code, 5378) from the PR.

Co-authored-by: QemmHD <290605352+QemmHD@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:51:23 +01:00
314b4e73dd Merge upstream ProjectLeonida/mandy main (b589e0fe0) into round10 base
# Conflicts:
#	docs/design.md
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/src/queue_holds.h
#	runtime/src/shader_library.h
#	runtime/src/vulkan_backend.h
#	runtime/src/vulkan_replay.h
#	runtime/test/vk_harness.cpp
#	tests/semantic/test_wave32_lane_select.py
#	tools/lane_masks.py
#	tools/rdna2spirv.py
2026-11-29 06:33:39 -05:00
b830bd3eb5 Merge pull request #1181 from whoalin1/shader-468-f16-varying
rdna2spirv: f16 interp deltas and toward-zero p2 narrow (SHADER-468)
2026-11-29 04:36:37 +01:00
181e9dfdda runtime: add GLC barriers, literal sampler specialization, and writes_buffer write-back gating
Enable Vulkan 1.2 vulkanMemoryModel/vulkanMemoryModelDeviceScope and emit
pre-dispatch/pre-rendering barriers for reads_glc_buffer shaders, wire
literal_sampler_spec_base VkSpecializationInfo specialization constants,
and gate passive title buffer write-back on shader writes_buffer metadata
with non-blocking async readback polling.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-27 21:10:54 -05:00
15350f6da6 rdna2spirv: seed the POPS collision word so the wait loop ends (SHADER-POPS-COLLISION-SEED)
A pixel shader with an ordered section (POPS) reads the hardware's collision word, which sits in the SGPR after the
user SGPRs and the primitive mask: collision wave id in bits 0-9, this wave's id in bits 16-25, overlap in bit 31.
The program waits until wave_id + ~collision_id is below src_pops_exiting_wave_id + ~collision_id (unsigned). The
translator orders the section with fragment-shader interlock and reads the exiting id as 0, and the word was
whatever the push constants held at that dword, usually 0. With wave id == collision id the test is
0xffffffff < 0xffffffff, never true, so a wave that reached the loop ran it until the loop guard (65,536 rounds).
The overlap test before the loop skips it whenever a lane is on in EXEC, so it is a wave (a host subgroup) with EXEC
all off there; on 32-wide subgroups that is either half of a wave64 program whose lanes are all off.

The SGPR is now the source of the program's wave-id extract (s_bfe_u32 with field 0x000a0010) when the program reads
that SGPR's entry value (shader_meta's user_sgpr_reads), and it is set at entry to 0x00010000 (no overlap, wave id 1,
collision id 0): the loop leaves after one round. A program without that extract keeps the old behaviour.

- tools/rdna2spirv.py: pops_collision_sgpr and the entry store.
- tests/semantic/test_pops_collision_seed.py: subgroups of 64 and 32 lanes, with and without the seed, and the SGPR
  search; the GPU fixture runtime/test/shaders/ps_pops_wait_loop.asm (check.py, run_gpu_tests.py) and its llvm-mc
  listing.
- tests/semantic/spirv_wave_interp.py: the interlock instructions run as no-ops (a run has no other primitive).
- runtime/test/vk_harness.cpp: a fragment shader that needs pixel interlock on a device without it is unsupported
  (77), as for barycentrics.
- docs/design.md, docs/d3d12_vulkan.md: the POPS rows.

GPU: on an RTX 4070 SUPER the fixture gives 4096 of 4096 pixels as expected; with the seed taken out every pixel's
round count is 0x00010000.

Idea from Marvisak/VIctory 7ac1f54, written anew.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
2026-11-25 19:45:31 -05:00
9f98dcc617 Improve post-load GPU memory and pipeline handling (RT-POST-LOAD-GPU-MEMORY)
Fall back to a dedicated buffer allocation when the shared arena fills.
Update console descriptors and resource backing, preserve pipeline cache
entries, and replay mesh records using bounded indirect arguments. Keep
scripted input available until read and cover the runtime and translator
paths with synthetic tests.

Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-authored-by: ivanepsilondelta <264061546+ivanepsilondelta@users.noreply.github.com>
2026-11-25 14:30:51 -06:00
5657240e35 rdna2spirv: f16 interp deltas and toward-zero p2 narrow (SHADER-468)
Measured on the RDNA2 iGPU (gfx1036, tools/f16_interp_probe.py, 98,304
samples over 12 native draws): the SPI writes P10/P20 for a 16-bit
channel as per-half f16 differences (round to nearest even), the
weighted sum stays f32, and v_interp_p2_f16 narrows toward zero --
the driver's ISA runs the pair inside s_round_mode 0x000c, so the
narrow is toward zero whatever the shader's own MODE writes are.
The rdna2 model explains 98,274 of 98,304 samples; the previous
translation (f32 deltas, nearest-even narrow) explains 62,226.

- Gen.f16_round: f32 -> nearest-f16 value via f16_bits +
  UnpackHalf2x16 (integer-built bits, so no driver folds the round
  trip away, #512/#513); applied to the P1-P0 / P2-P0 deltas of
  16-bit-channel reads in attribute().
- v_interp_p2_f16 narrows with f16_bits(rtz=True) and keeps the
  SHADER-430 partial-write high half via write_lo16.
- vk_harness: scan both stages for Float16 / StorageInputOutput16 /
  Float64 capabilities (77 when the device lacks them), enable the
  matching Vulkan 1.1/1.2 features, VKH_PC_BYTES to shrink the
  push-constant range for hand-written fixtures, and VKH_SHADER_INFO
  to dump the driver's fragment disassembly.
- tests/semantic/test_interp_f16_round.py: the two telling cases
  (f16 delta overflow to inf; toward-zero vs nearest-even tie).
- tests/semantic/test_interp_p1lv_f16.py: reference oracle updated
  to the measured model (f16 deltas, f32 sum, toward-zero narrow).
- docs/design.md: 16-bit interpolation row records the SHADER-468
  measurements and remaining unverified items.

Co-Authored-By: Devin <noreply@cognition.ai>
2026-11-25 18:45:22 +02:00
3e648aa10f vk_harness: build without VK_KHR_pipeline_binary headers, exit 77 with the flag
The VKH_BINARY_OUT/VKH_BINARY_IN path needs VK_KHR_pipeline_binary, which is newer than
some Vulkan header sets: Ubuntu 24.04 ships 1.3.275 and CMake's find_package(Vulkan)
picks those up when VULKAN_SDK is not set, so the whole target failed to compile with
"VkPhysicalDevicePipelineBinaryFeaturesKHR was not declared in this scope" and seven
follow-on errors.

Guard the feature on the two extension macros the code already needs. With old headers a
VKH_BINARY_OUT/VKH_BINARY_IN run now prints "unsupported: these Vulkan headers have no
VK_KHR_pipeline_binary" and exits 77, the skip code the harness uses elsewhere, and
everything else in the harness is unchanged.
2026-11-24 00:35:10 +03:00
ced4057a98 TEST-468/469: GPU test tools request shaderInt64 only when a module declares Int64; vk_bindless_test honours LEONIDA_VK_DEVICE (#2647)
Squash-merged after diff review of PR #2647
2026-11-23 09:35:16 -06:00
57aafb761b Measure emitted geometry primitives in synthetic Vulkan draws (#6316)
Squash-merged after diff review of PR #6316 - TEST-GS-PRIMITIVE-READBACK: count emitted primitives in synthetic geometry draws
2026-11-23 08:21:47 -06:00
11839cf711 Merge pull request #4530 from AGInformatique81
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:15:38 -05:00
33531bda5b Merge pull request #4262 from gabsilvs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:12:54 -05:00
e2ecb50cf1 Merge pull request #3855 from Oleg Makarov
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:08:56 -05:00
c3afb65c2f Report Vulkan pipeline binary export failures 2026-11-23 03:08:22 +01:00
b9a8aca16a GPU tests: skip a draw when any stage needs OpFmaKHR the device lacks
docs/testing.md says a module that needs OpFmaKHR exits 77 (a SKIP) on a
device without VK_KHR_shader_fma, but only the fragment module was checked
in vk_harness, and vk_texture_test, vk_sampler_test and vk_bindless_test
never refused the vertex module (vs_ids carries FMAKHR). Under
LEONIDA_FMA=khr such a pair failed vkCreateGraphicsPipelines with -13 and
run_gpu_tests.py reported a FAIL.

ShaderFma::accepts_file() checks one module file. vk_harness (vertex module,
VKH_MESH_COMPUTE module), vk_texture_test, vk_sampler_test and
vk_bindless_test use it for every stage; vk_sampler_test also enables the
feature when the device has it, like the others. judge_cs_dump treats exit 77
with an "unsupported:" line as a skip for the non-wave64 dumps too
(cs_w32_new_ops).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015z45kpL5aWzXuYTbhn6b52
2026-11-22 21:19:17 -03:00
fcda84bb0d Merge hw4-ps-oracle into hw4-ps-formats (#3499)
docs/shader_validation.md
tools/ps_oracle.py

AI-assisted.
2026-11-23 00:19:13 +01:00
aec744e39d Tests: account for KosmicKrisp NaN readback (TEST-783) 2026-11-23 01:03:29 +03:00
3a1ed28beb Merge main into hw4-ps-formats (#3499)
docs/shader_validation.md

AI-assisted.
2026-11-22 22:01:03 +01:00
0d58747e0d ps_oracle: --format runs the pixel shader against other color targets
vk_harness takes VKH_COLOR_FORMAT=<VkFormat>:<bytes> for its color target
and writes the target's texels as stored. ps_oracle.py --format picks it
(the driver then picks the export format, as for a game pipeline), with
an integer-output const template for integer targets. docs gets the
export behaviour measured on gfx1036: 32_GR / 32_R take the last enabled
channels, a compr export reaches 16-bit UNORM/SNORM/UINT/SINT targets bit
for bit, FP16 targets get the halves as f16 (a NaN half becomes 0xfe00).

AI-assisted.
2026-11-22 21:42:29 +01:00
1363748aeb Merge pull request #3061 from Vonsek
# Conflicts:
#	docs/shader_validation.md
2026-11-22 15:14:29 -05:00
7e1aecf0cb first_light: fix VKH_TSHARP_VA overflow guard, subgroup size, preview env, and test docs
Addresses @Kam471's review on #2806:
- Fix uint32 wraparound in VKH_TSHARP_VA bounds check (tsharp_va > heap_bytes - 32) so 0xFFFFFFE0 is rejected with exit 2 instead of writing OOB; add regression test in tests/test_first_light.py.
- Clarify exact test counts in docs/first_light.md (14 tests: 11 pass, 3 skip without LEONIDA_FIRST_LIGHT_DIR; 14/14 pass with LEONIDA_FIRST_LIGHT_DIR).
- Require --obj when --dds is passed so textured probes are always populated, include all texture env vars in the non---run preview command, and pass VKH_SUBGROUP_SIZE from manifest['ps']['subgroup_size'].
2026-11-22 21:06:15 +01:00
faf8268e3f vk_harness: enable shaderSampledImageArrayDynamicIndexing for VKH_TEX_RGBA 2026-11-22 21:06:15 +01:00
3763517741 First light: add textured draw path with T#/S# bindless set and CPU oracle (TEST-524)
Implements TEST-524:
- runtime/test/vk_harness.cpp: adds optional VKH_TEX_RGBA, VKH_TSHARP_VA, and VKH_SSHARP (inert when unset) to upload an RGBA8 texture to set 0 image index 1 (with 1x1 magenta fallback at index 0), write the 8-dword T# at VKH_TSHARP_VA in the 64 KiB heap, decode S# via gfx10_descriptors.h into sampler index 1, and bind DescriptorTable at binding 2.
- tools/first_light.py: adds --dds <path.dds> (decoding via tools/dds_png.py to texture.rgba), defaults --ps to PS_Copy_3ea4b38a_Wrapped (wave32, single image_sample_lz, compatible with DEFAULT_VS), reads ptr32_lo SGPR and literal_samplers from index.json, and adds a bilinear clamp-to-edge CPU texture oracle (centre_rgba + rgba_probes) in check_image.
- tests/test_first_light.py: shares fl.harness_env() so package-gated tests cover both untextured and textured runs, and adds 6 synthetic TexturedOracleTests (no GPU or game files).
- docs/first_light.md: documents the textured path and RTX 3060 verification (counts and hashes only; no game data).
2026-11-22 21:06:14 +01:00
4c414d1216 tools: ps_oracle.py runs hand-written RDNA2 pixel-shader ISA on AMD GPUs
hw_oracle launches compute kernels only. vk_harness can now write a
pipeline's VK_KHR_pipeline_binary data and build a pipeline from it
(VKH_BINARY_OUT / VKH_BINARY_IN). ps_oracle.py puts assembled ISA in
place of _amdgpu_ps_main in the driver's PAL ELF, raises the pixel
stage's register counts in the msgpack metadata, optionally changes
other metadata entries, and draws with it, reading every pixel's mrt0
words back.

Checked on gfx1036 (driver 26.10.1): v_interp of a varying and the
parameter words P0 / P10 come back as expected. Tests in
tests/test_ps_oracle.py, docs in docs/shader_validation.md.

AI-assisted.
2026-11-22 20:15:34 +01:00
7c65aa6d0c Merge pull request #2635 from whattheflop 2026-11-22 13:16:41 -05:00
407a53923e Merge pull request #2048 from whoalin1
# Conflicts:
#	docs/testing.md
2026-11-22 13:12:54 -05:00
51d954a2cd Merge pull request #436 from S1m0ne1997 2026-11-22 13:12:27 -05:00
458c21946d Make vk_harness GPU writes visible to host readback 2026-11-23 03:39:42 +10:00
97afefdebc Merge remote-tracking branch 'origin/main' into shader-33-vs-inputs
# Conflicts:
#	tests/test_shader_checks.py
2026-11-22 18:06:20 +01:00
0ec464b0e1 GPU tests: bind the --pc-tail-ubo block, so 128-byte push-constant devices run the tests
With LEONIDA_PC_TAIL_UBO=1, build.py and run_gpu_tests.py translate with --pc-tail-ubo, and the test
programs (vk_compute_test, vk_store_test, vk_harness, vk_texture_test, vk_sampler_test, vk_bindless_test)
declare and push 128 bytes and, when a stage declares set 1, bind the tail block there
(runtime/test/vk_pc_tail.h: a host-visible buffer with one slot per dispatch or draw, bound as a dynamic
uniform buffer). vk_harness refuses --mesh-compute with the flag (exit 77): mesh_compute_vs.py's vertex
shader still reads its address from push constants. Without the variable nothing changes.

Step 2 of the uniform-buffer tail claimed in #1902.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:48:05 +02:00
8f1370ce4a Merge pull request #2260 from Linnard Alex Brown Jr.
# Conflicts:
#	docs/design.md
2026-11-22 11:43:33 -05:00
03b38d8419 TEST-319: an RX 580 (one subgroup size, 64) is the 64-lane reference; all 24 fixtures checked on an RTX 5070 against it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:24:13 -05:00
72a38ad24d Merge remote-tracking branch 'origin/main' into shader-33-vs-inputs
# Conflicts:
#	docs/design.md
2026-11-22 16:39:33 +01:00
07cc6efb20 first_light: a real game model with its own translated VS/PS
tools/first_light.py carves the game's shaders, translates one real VS/PS pair,
converts an exported OBJ to a mesh, writes a manifest and runs vk_harness. The
harness gains VKH_DRAW_MESH/VKH_VERTEX_LAYOUT (indexed mesh, vertex input), inert
when unset. The package-gated test draws the model and checks coverage and the
centre pixel; docs/first_light.md records the measured result.
2026-11-22 12:28:20 -03:00
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
1955e1b958 Merge remote-tracking branch 'origin/main' into r436
# Conflicts:
#	scripts/run_gpu_tests.py
#	tests/test_shader_checks.py
#	tools/rdna2spirv.py
2026-11-22 14:16:49 +01: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
07bd05fa95 Translator: zero-based VS v0/v3 (VertexIndex - BaseVertex, InstanceIndex - BaseInstance); VS is legacy, not NGG (SHADER-33)
Corpus (scripts/vs_input_survey.py, all 2,236 VS): no exp prim, no s_sendmsg, no v_mbcnt, every
VS exports pos0/param, so the console runs them as legacy hardware VS. Their input VGPRs are
Mesa's GFX10 legacy layout (radv_shader_args.c, declare_vs_input_vgprs, not is_ngg): v0 vertex
id, v1 unused, v2 primitive id, v3 instance id; no VS reads v1/v2 on entry, 788 start with the
fetch call and read attributes from v4.

Those ids are zero-based on the hardware (ac_nir_lower_intrinsics_to_args.c: vertex_id is
load_vertex_id_zero_base, instance_id is load_instance_id; the bases come in SGPRs), while
Vulkan's VertexIndex/InstanceIndex include firstVertex|vertexOffset/firstInstance. The
translator now seeds v0 = VertexIndex - BaseVertex and v3 = InstanceIndex - BaseInstance
(DrawParameters; feature shaderDrawParameters in every VS's metadata).

GPU test vs_base_ids.asm, drawn with VKH_DRAW=16,7 (new vk_harness option): 0x101 on every
pixel, where before it was 0x7111. Run by check.py and run_gpu_tests.py. vk_harness,
vk_pipeline_check, vk_bindless_test, vk_texture_test and the runtime's Vulkan device enable
shaderDrawParameters. design.md's "Inputs and outputs" row replaces the "unverified" note.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:59:04 +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