Commit Graph

28 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
d477c94cd5 Merge remote-tracking branch 'lc/main' into lc/addr-no-int64 2026-11-28 14:48:48 +02:00
85205a6042 Merge pull request #910 from markankamaransheogarat-sys/ubiq/test-722-psb-load
TEST-722-PSB-OPLOAD: move PSB OpLoad out of OpAccessChain and tighten ps_w64 checks
2026-11-28 12:52:03 +01:00
9e085fa6c3 rdna2spirv: eliminate absent-lane subgroup UB and add static/GPU checks
Guard all cross-lane subgroup shuffles and broadcasts against unlaunched
lanes, eliminate %uint_0 fallbacks in favor of SubgroupLocalInvocationId,
and add static SPIR-V verifier (check_absent_lane_ub.py), wave-interpreter
unit tests, and a Vulkan GPU validation test.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-27 21:00:08 -05:00
de8604c3dc Merge ProjectLeonida/mandy main (431ceba4f) into test/round2
Preserves all Round 1/2/2.1 CPU/GPU runtime optimizations alongside upstream
mandy/main changes, resolves all 10 conflicted files, and fixes arena_window
accounting on retired/dropped title windows.

AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-27 19:57:44 -05:00
cab6609160 Merge remote-tracking branch 'lc/main' into lc/addr-no-int64 2026-11-27 23:49:06 +02: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
22a8be16cd rdna2spirv: decode only the components a typed load writes; fconst is an OpConstant (SHADER-FORMAT-DECODE-ONE-COMPONENT)
A buffer_load_format_* with a run-time FORMAT called the four per-component
decode functions %fmt_dec_c0..3 at every load, whatever it wrote. One
function %fmt_dec(format, element, component) replaces them, and a load
calls it once per register it writes, with the component that register's
DST_SEL picks: _x makes one call, not four. The function computes the four
components' channel width and offset as before and the parameter selects
one, so the values are the same.

fconst (and tof of a uint constant) emitted a new OpBitcast of the uint
constant at every use; they now give one cached OpConstant %float per bit
pattern, written so spirv-as reads back the same 32 bits (float_literal:
shortest decimal for a finite value, the SPIRV-Tools hex-float spelling for
an infinity or a NaN). The test interpreters read that spelling.

Tests: test_buffer_format_decode_one.py with hand-written fixtures
(calls per load, values for 16 codes, swizzles, out of bounds, _x/_xy
against _xyzw for all 128 codes) and test_fconst_constant.py (exact bits of
+-0, denormals, infinities and NaN payloads).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 08:58:14 +01:00
0e9abdc7d4 TEST-722 follow-up: move PSB OpLoad out of OpAccessChain and tighten ps_w64 checks 2026-11-26 11:34:24 +00: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
4f2628f83f rdna2spirv: 64-bit buffer addresses without Int64 (SHADER-423)
lower_addr64 rewrites the assembled module's 64-bit address arithmetic (the zero-extend, shift-by-32, OR/AND, add and
subtract with carry, narrowing, sign-extension, 64-bit bitcasts and pair compares the address idiom uses) into uint
pairs and an OpBitcast of a 2x32 vector to the PhysicalStorageBuffer pointer, and drops OpCapability Int64 when
nothing else needs it, so translated shaders run on devices without shaderInt64. --int64-addresses keeps the 64-bit
form. Semantic tests for the lowering, the interpreters learn the pair pointer form, design.md row.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
2026-11-24 16:26:16 +02:00
005ba67c55 Merge pull request #3508 from shdann
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:07:36 -05:00
c962d09d0c Merge upstream main into interp-int64-width
Keep null constant type information and composite constant handling. AI-assisted.
2026-11-23 05:41:38 +03:00
0600822f83 Check operand widths for signed and bit-search GLSL operations
AI-assisted.
2026-11-23 05:30:53 +03:00
e5bdbe01f5 Merge pull request #3556 from markankamaransheogarat-sys 2026-11-22 17:02:41 -05:00
b168216aba Merge pull request #3508 from shdann 2026-11-22 17:02:24 -05:00
d7d9a8e55b TEST-722: run ps_w64_* pixel shader fixtures on spirv_wave_interp 2026-11-22 20:54:42 +00:00
829af7fd6a tests/semantic: the interpreters run OpBitCount and the signed GLSL ops at the width of a 64-bit type
Both interpreters accept OpTypeInt 64 but treated a 64-bit operand of
OpBitCount, SMin, SMax, SClamp, SAbs, FindILsb, FindUMsb and FindSMsb as
32-bit: OpBitCount of 0xFFFFFFFF00000000 gave 0, and SMin(2^31, 1) on a
64-bit type gave 2^31.

OpBitCount now counts every bit of its operand's type, and SMin, SMax,
SClamp and SAbs read their operands as signed at the width of their type.
FindILsb, FindUMsb and FindSMsb raise UnsupportedConstruct for a type that
is not 32-bit, since GLSL.std.450 limits them to 32-bit components. Results
for 32-bit types are unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 23:44:12 +03:00
521ba3b1f6 Merge pull request #3070 from Vonsek 2026-11-22 15:14:33 -05:00
15f5b2fbc0 Fix what the round-41 merges broke
- tests/semantic: BaseVertex/BaseInstance read 0 in the wave interpreter; the LDS MockGens follow
  SHADER-309 (lds_bound, lds_access, lds_atomic); abs emission tests load their operand, since
  SHADER-315 folds scalar ALU on constants.
- test_translate: the dynamic gather sampler is a loaded word, not s16 + 0 (SHADER-315 folds it).
- test_world_build: DDS downscale weights colours by alpha (62804d0d).
- test_fspx_shaders_stage: the fake disassembler writes the listing make_game now checks.
- xgameruntime_test: re-read the package id after clearing the LEONIDA_PACKAGE_ID override.
- docs: one row per topic again in design.md (72 topics) and README.md; one Other languages line;
  embedded_shaders.md keeps one copy of each bullet; animation.md links the heading anchor.
- tools/scripts: character_textures uses report_paths.same_report_path; stdout guard on six programs;
  LF write in vs_input_survey; the cl.exe fallback compiles winhttp_offline.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:30:33 -05:00
52d8e0d36c fix(test): match signed SPIR-V switch literals
The wave interpreter stores integers as unsigned bit patterns. Normalize each switch literal to the selector width so a negative case reaches its target.
2026-11-22 20:16:43 +01:00
f9ca6192a8 tests/semantic: the interpreters reject a Function variable outside the first block
spirv-val requires Function-storage OpVariable in a function's first
block. check_structure (per function) and spirv_wave_interp now raise
InvalidModule for one elsewhere. All 23,003 modules the semantic suite
translates already follow the rule.
2026-11-22 11:24:36 -03:00
9aa1f816d5 tests/semantic: the interpreters reject an OpPhi that isn't first in its block
spirv-val requires OpPhi to be the first instructions of a block (only
OpLabel or OpPhi before it). The translator merges every guarded load
with an OpPhi, so an instruction emitted before it in the merge block
would pass the semantic tests and fail every driver, as #1633's merge
ordering did. check_structure and spirv_wave_interp now raise
InvalidModule for it. All 22,993 modules the semantic suite translates
already follow the rule.

test_interp_merge_check.py: a translated global_load with its phi moved
after another instruction, and the rule on hand-made blocks.
2026-11-22 11:24:36 -03:00
834b71cf10 tests/semantic: the interpreters reject a merge not directly before its branch
spirv-val requires OpSelectionMerge to directly precede OpBranchConditional
or OpSwitch, and OpLoopMerge to directly precede OpBranch or
OpBranchConditional. Both interpreters skipped merges, so #1633's first
version (OpLoad %active between the merge and its branch) passed every
semantic test while spirv-val rejected every module it produced.

spirv_mini_interp.check_structure and spirv_wave_interp now raise
InvalidModule for it. Every module the current semantic suite translates
already follows the rule (1398 tests OK). With the new interpreters,
#1633's first commit (2fe13e73) fails 220 of its own tests.

tests/semantic/test_interp_merge_check.py moves an instruction between a
merge and its branch, and drops a branch, in a translated module.
2026-11-22 10:31:38 -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
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