Commit Graph

44 Commits

Author SHA1 Message Date
5eed9c43d5 Merge origin/main (f9f3ec4c6) into the carry of #1907
Current main after #2566; no new conflicts on top of the earlier carry merge.

Co-authored-by: Jordan <44410206+JordanWebDev@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:19:21 +01:00
0b367b089e Merge origin/main into #1907 (carry prep)
docs/design.md: SHADER-10 row keeps main's text and the PR's image-atomics sentence.

Co-authored-by: Jordan <44410206+JordanWebDev@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 09:41:14 +01:00
66d4723f40 Merge upstream ProjectLeonida/mandy main (d48a957bb) into test/round10
Resolved conflicts in docs/design.md, runtime/CMakeLists.txt, and tests/semantic/spirv_wave_interp.py.
AI-assisted: Antigravity (Gemini 4 Neon).
2026-11-28 07:00:01 -05: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
e38feff39d Merge pull request #805 from madhyn/fix/shader10-uvote-nonzero-combine
wave64_halves: recognize UVOTE under non-zero EXEC and boolean UVOTE combinations (SHADER-10)
2026-11-28 12:08:46 +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
0e9abdc7d4 TEST-722 follow-up: move PSB OpLoad out of OpAccessChain and tighten ps_w64 checks 2026-11-26 11:34:24 +00:00
d7f26f568c wave64_halves, rdna2spirv: a DPP v_cmpx is an EXEC write, and the restore pass recovers it (SHADER-VOPCX-DPP review)
- wave64_halves.transfer: the cross-lane branch caught v_cmpx in DPP form and
  returned before its EXEC write, so the analysis kept the old EXEC and could
  call a value uniform that is not (tier B readlane-uniform instead of C).
  It now goes through exec_write, never as a uniform vote.
- restore_skipped_instructions recovers v_cmpx_*_f32_dpp as it does v_cmp_*.

Found by adrianmjim's review of #1647.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 23:36:40 +01:00
1cfb452aad wave64_halves: model image_atomic_* as atomic memory sinks (SHADER-W64-HALVES-IMAGE-ATOMIC) 2026-11-25 09:21:42 -06:00
62e5472201 wave64_halves: restore EXEC launch mask across s_wqm_b64 + s_and_b64 2026-11-24 22:54:08 -03:00
d77ce933aa wave64_halves: recognize UVOTE under non-zero EXEC and boolean UVOTE combinations (SHADER-10) 2026-11-24 22:53:46 -03:00
273b3bdf9d [integration] Linux/Proton and native Windows: boot through the story load (RT-PROTON-STORY-LOAD)
One squashed commit of a fork that was developed on a Linux/Proton machine and
tested on two native Windows machines. On all of them the retail 1.0.2.1
package now launches, shows its launch movie, first-run pages and landing
prompt, runs the story load to its end with the loading slideshow drawing its
artwork, and enters the world phase. A first world frame is not verified yet.
docs/linux_proton.md has the setup, a healthy boot's timeline, the machines
and where it stops.

Runtime: frames in the title's own window; DirectStorage pinned reads,
page-list scatter/gather, BCPack and unshuffle with a locally generated
predictor file; pooled, device-local and deferred image backing for streamed
and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table
that degrades instead of refusing a submission; a descriptor hash finalizer
(off until a library carries it); directly indexed heap offsets for compute
dispatches and VS/PS/GS draws; title buffer windows outside a fragmented
arena; opt-in device-local copies of streamed buffer views; write-fault
retries under the tracker lock, shared trackers and write-watched title memory
for native Windows; device-loss, compute-input and memory probes.

Translator: loop bounds at structured exits, the eight FidelityFX programs
that use a packed-dot form the disassembler skips, buffer bounds modes per
view kind, a compaction option, the hash finalizer option.

Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows
boot script, the paired compute translation script.

No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted
by people on the machines named in docs/linux_proton.md.

Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 11:42:12 -06:00
34406f5cdf wave64_halves: an aggregated (elected) atomic needs a wave-uniform address
Only the elected lane runs the atomic, at its own address. Each 32-lane half
elects its own lane, so with a per-lane address (an untainted pixel coordinate
too) the halves bump different counters and their slots collide:
ps_w64_b_ballot_atomic with the counter offset from y gives {0: 16} for the
wave and {0: 8, 4: 8} with 8 lost slot words for the halves, yet was tier B.
Accept the elected atomic only when each address VGPR is uniform, or was
written by the elected lane from scalars and constants since EXEC last
changed; otherwise tier C elected-lane.
2026-11-23 18:37:51 -03:00
9ea3d32adf test_wave64_halves: a redefined mask's branch is a tainted one since SHADER-820 (#4620)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 03:54:55 -05:00
af16f2220b Merge pull request #4655 from tedin7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/design.md
2026-11-22 23:16:53 -05:00
c58c58067e Merge pull request #4585 from francisco parata
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:16:10 -05:00
9770b8ff3b Merge pull request #4423 from JavierBlanco23
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:14:35 -05:00
7680301628 Merge remote-tracking branch 'origin/main' into w64-idea
# Conflicts:
#	docs/design.md
#	runtime/test/shaders/w64_graphics.py
#	tests/semantic/test_wave64_halves.py
#	tests/test_wave64_halves_fixtures.py
#	tools/wave64_halves.py
2026-11-23 04:50:52 +01:00
f502d1fc55 fix: track word3 literals with rdna2spirv's scalar folds (s_mov_b64, s_pack, s_bfm, ...), pin offen/tbuffer/store_format (SHADER-833) 2026-11-23 04:48:34 +01:00
6ba2aafa31 fix: wave64 halves analysis gives tier C to a buffer access without idxen through a literal V# with ADD_TID_ENABLE (SHADER-833) 2026-11-23 04:41:04 +01:00
747b4313c9 wave64_halves: packed converts, SAD and VOP2 16-bit integer ops write the whole register (review of the partial-write rule) 2026-11-23 04:16:36 +01:00
33905dc9dd Fix what the round-43 merges broke (pytest)
Merges that each passed alone but clash together:
- v_cmp_class_f64: the earlier cmp_class_f64 (685d16ed9) (operand-form checks, test_cmp_class_f64) and the later f64 branch
  in cmp_class both handled the opcode; f64 goes to cmp_class_f64 again, f16 stays in cmp_class.
- rdna2spirv CLI tests: spirv-as/spirv-val now run in the output folder with the staging file's bare name, so
  the test doubles resolve it against cwd; assemble_spirv decodes the output only when it is bytes. (The doubles
  had been writing .spirv-*.tmp files into the repository root.)
- ps_w64 fixtures (TEST-722): an 18th fixture (ps_w64_a_discard) landed; its killed lanes export nothing and
  keep the clear value.
- first_light: a run without an OBJ removes mesh.bin, and harness_env reads manifest["files"]; batch_glb's stats
  name failures and dropped textures; run_gpu_tests reports a frame never written as a missing readback
  (TEST-837).
- make_game TRANSLATION_SOURCES and runtime.yml's paths include spirv_opt.py and report_paths.py (and
  wave64_emulate_opt.py), which the translator imports.
Repo rules: stdout guard on six tools; encoding on two opens (gen_gdk_runtime_classes' helper is read_utf8);
newline on one write; anim_skeleton_match's joaat encodes like hashdict.joaat; test_feature_scan's new test is
listed with the others its globals() runner reaches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:07:41 -05:00
da8fc14400 wave64_halves: a partial write keeps the register's other bits, so it is uniform only if the whole register was (review: @shdann) 2026-11-23 04:07:10 +01:00
50241a19d8 wave64_halves: count v_cmpx as an EXEC write
operands() sends every op with a NO_DEST prefix to its first branch,
except s_cmp and s_bitcmp. NO_DEST includes v_cmpx, so the later
`elif op.startswith("v_cmpx"): defs.append("exec")` was unreachable:
EXEC was taken as unchanged and the tainted-exec check never ran.

A wave64 VS that narrowed EXEC with a lane-dependent v_cmpx and then
wrote an output was tier A, although one 64-lane wave and two 32-lane
waves give different words for lanes 32..63. The same shader written
as v_cmp plus s_and_b64 exec was already tier C, tainted-exec.

v_cmpx now leaves the first branch, so it reaches the branch that adds
the EXEC def. A v_cmpx on a wave-uniform value stays tier A.
2026-11-22 23:48:39 -03:00
f418e0e0f0 wave64_halves: handle slist scalar register lists in _regs and VOP3b operands 2026-11-23 02:22:10 +01:00
03f7056e0a tests: a uniform mask whose high half is rewritten is a lane vote again (review case) 2026-11-23 00:37:41 +01:00
8c15367820 wave64_halves: a vote on a wave-uniform compare is not a lane vote (new SHADER item) 2026-11-23 00:33:30 +01:00
e5bdbe01f5 Merge pull request #3556 from markankamaransheogarat-sys 2026-11-22 17:02:41 -05:00
d42f8b4631 Merge pull request #2674 from Linnard Alex Brown Jr.
# Conflicts:
#	docs/design.md
2026-11-22 16:59:33 -05:00
d7d9a8e55b TEST-722: run ps_w64_* pixel shader fixtures on spirv_wave_interp 2026-11-22 20:54:42 +00:00
f822ea5b1c wave64_halves: fix active-EXEC readfirstlane escape and nonlinear count scaling
Addresses review findings on PR #2469 (@duudiis):
- Track active-EXEC-only v_readfirstlane_b32 results with ACT_RFL + ('act_rfl', exec_tok):
  clears on vector ops while EXEC remains a descendant of exec_tok, and degrades to X
  (tier C cross-lane) if read after EXEC restore/widening or in branches/sinks where an
  empty-EXEC half's lane-0 fallback would escape.
- Tighten scaled_cnt_token(): for s_lshl_b32 / v_lshlrev_b32 only allow the shifted value
  operand (never the shift distance) to carry CNT, and drop v_mul_u32_u24 (24-bit
  truncation is nonlinear).
- Add classification and 64-vs-2x32 execution regression tests for all three cases.
2026-11-22 21:22:11 +01:00
005534090c wave64_halves: lower pure SGPR spills to parked slots and widen sound Tier B idioms
- Lower pure scalar-spill VGPRs (touched only by immediate-lane v_writelane_b32 / v_readlane_b32 with non-VGPR source, never aliased by v_movrel*/v_swaprel_b32, never holding a lane mask) to parked scalar slots in rdna2spirv.py, making SGPR spills across lanes 0..63 exact on 32-wide subgroups (tier B lane-spill) while preserving stale-scalar control-dependence and taint propagation.
- Track active-EXEC uniformity (st['ua']) so v_readfirstlane_b32 on a VGPR uniform across all currently active lanes inside a narrowed-EXEC block is recognized as tier B readfirstlane-uniform (resets to full-EXEC uniformity on any non-narrowing EXEC write, restore, or mismatched-EXEC join).
- Fix operand-order handling for global_atomic_*/flat_atomic_*/ds_* atomics and global_store_*/flat_store_*/scratch_store_*/ds_write* sinks, and propagate lane-count tokens through uniform linear stride scaling (s_lshl_b32, s_mul_*, v_lshlrev_b32, v_mul_*) for wave-aggregated atomics.
- Add classification and 64-vs-2x32 wave-interpreter execution tests in tests/semantic/test_wave64_halves.py.
2026-11-22 21:22:11 +01:00
8722380517 wave64_halves: SAVEEXEC as the kill run side's first narrowing; docs row matches the code
The run side of a pixel kill's early exit was rejected when its first narrowing was
`s_and_saveexec_b64 sN, <wqm mask>` (OFF_OK had only s_mov/s_and/s_wqm), which also left
confine_step's `old_inside or ok(x)` branch unreachable. Allow s_and/s_andn2 _saveexec/_wrexec
while EXEC is not yet inside: their new EXEC is S0 & EXEC or S0 & ~EXEC, so it is inside when S0
is, and the saved old EXEC is not treated as inside. s_or_saveexec first stays tier C, as does a
restore of the saved EXEC.

The design.md row now says the exit may export (an export is not required) and lists every EXEC
write the must-dataflow keeps inside.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:03:37 -05:00
cc4231d34b wave64_halves: tier A for the early exit of a pixel kill
A wave64 pixel shader that kills pixels with `s_andn2_b64 live, live, exec/vcc` and branches with
`s_cbranch_scc0` to a block that only empties EXEC from that mask, exports and ends was tier C
unsafe-vote-branch. It is exact on 32-wide subgroups: a half whose live mask is empty writes nothing in
the exit and discards its pixels, and in the wave its lanes stay off to the end.

The rule accepts it only when:
- the branch tests the mask's own "not empty": the last SCC writer is a 64-bit logic op into that mask
  (or s_cmp_lg_u64 mask, 0) and nothing rewrites the mask before the branch (or vccz/vccnz);
- the exit only sets EXEC from that mask (or 0), exports and ends: no other code, store or successor;
- the run side narrows EXEC into the mask's whole quads before anything but mask arithmetic runs and
  keeps it inside on every path, loops included (a must-dataflow over narrowings and copies, unions and
  s_wqm of registers known to be inside);
- no `exp ... vm` can run before the vote (a latched vm export would keep the pixels alive in the wave).

Also: s_mov_b64 / s_cselect_b64 of a lane mask no longer tag SCC as a vote on their destination (they
do not write SCC); the branch could take a lane-count compare for a vote and come out tier A.

Tests: classification of the kill (wqm + s_and, v_cmpx + s_mov, direct s_and / s_mov / s_wqm exec,
exit through exec 0, an if/endif after it) and near misses (exit with code, a store, an SGPR write,
another mask, a jump back; a run side that does not narrow or widens again; the mask rewritten after
the vote; SCC = mask == 0; a vm export before the vote; a shared exit), and 64 vs 2x32 vertex runs.
GPU fixture ps_w64_a_discard: RX 580 (RADV, required size 64) and RTX 5070 (32, against the 580
reference) equal the derived words.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:03:30 -05:00
d04ae898a7 Merge pull request #2675 from Linnard Alex Brown Jr. 2026-11-22 13:16:59 -05:00
51d954a2cd Merge pull request #436 from S1m0ne1997 2026-11-22 13:12:27 -05:00
d4750a12d2 wave64_halves: s_mov_b64 / s_cselect_b64 of a mask are no SCC vote
The generic 64-bit mask path tagged SCC as a vote on the destination of s_mov_b64 and s_cselect_b64, which
write no SCC (s_cselect reads it). With the cmp_eq "empty" polarity that reopened a false tier A, and a
s_mov_b64 between a compare and its branch moved the vote to the wrong mask. They now keep the SCC value
and tag; the other mask logic ops still set SCC = (result != 0).

Tests: the mov / cselect after s_cmp_eq_u64 (classification and 64 vs 2x32 runs).

Found in review by @tupacfan04.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:07:50 -05:00
664f21558a wave64_halves: s_cmp_eq_u64 mask, 0 votes the other way
`s_cmp_eq_u64 m, 0` sets SCC when the mask is empty, but it was tagged as the same vote as
`s_cmp_lg_u64 m, 0`, so `s_cbranch_scc1` after it took the empty side for the side the lanes that
vote yes run. A branch that jumps to the narrowing when the mask is empty and skips it otherwise
was tier A, while a half with no lane in the mask empties EXEC and the wave does not (lane 32
writes 35 in the wave and 0 in the halves); the correctly oriented skip was tier C. The cmp_eq
vote now carries an "empty" sense and the branch inverts which side is the yes side.

Also: `s_mov_b64 exec, <mask>` (an EXEC restore) tagged SCC as a vote on EXEC though s_mov writes
no SCC, so a later `s_cbranch_scc*` reading an earlier mask vote was checked as an EXEC skip
(tier A, outputs differ between 64 lanes and two halves). Only `s_or_b64 exec, ...` tags it now.

Tests (wave interpreter, 64 lanes against two halves of 32): the wrong-sense eq branch is tier C
with outputs that differ; the eq skip (both operand orders) and the lg skip are tier A with equal
outputs; the eq branch with scc0 is tier C; the s_mov restore case is tier C with differing outputs.
All four fail without the change; no existing test changed.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:39:23 -05:00
8f1370ce4a Merge pull request #2260 from Linnard Alex Brown Jr.
# Conflicts:
#	docs/design.md
2026-11-22 11:43:33 -05:00
fd2050071a TEST-251: GPU checks of wave64 geometry shaders, and no false tier C for a GS's ring address
rdna2spirv maps a legacy GS's LDS write to an output slot from its
offset alone and drops the VGPR address (the lane's GSVS area), but
wave64_halves read that address as the store's data, so a GS whose lane
id only forms its GSVS base was tier C lane-id. It now checks only the
data operands of a GS ds_write.

w64_graphics.py draws gs_w64_a_ring and gs_w64_c_lane_id at wave64 and
wave32 (RADV_PERFTEST=gewave32), build.py builds gs_* fixtures with
gs_tri's signatures, docs/testing.md explains how to run and extend the
wave64 graphics checks, and docs/design.md records the rule and that the
corpus GS are written for wave64. Checked on an RX 9070 XT (GFX1201) and
a Ryzen 9800X3D iGPU (GFX1036), RADV Mesa 26.3.1: 23/23.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:03:34 +03:00
6e4294befc TEST-319 review: no lane-id modulus through SDWA, DPP, op_sel, clamp or neg/abs; fixture headers name the full-wave assumption
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:51:49 -05:00
56998dcd23 TEST-319: GPU fixtures for wave64 graphics permutes; lane-id bpermute addresses are tier A
ps_w64_a_permlane, ps_w64_a_swizzle and ps_w64_a_bpermute check v_permlane16/x16, ds_swizzle
(quad-permute, swap, broadcast) and ds_bpermute in a wave64 pixel shader with words that only
depend on the 2x2 quad layout of fragment lanes. They give the derived words on an RTX 5070.

wave64_halves.py called a ds_bpermute/ds_permute whose address comes from the lane id tier C
(lane-id). The id is 0..63 in the wave and 0..31 in a half, equal modulo 32 lanes, and a wave64
permute uses address bits 2..6 of its half only, so an address that is the same modulo 128
bytes reads the same lane. The classifier now tracks that modulus through sums, differences,
bitwise ops with invariant values and left shifts; shifts by less than 2, right shifts and the
low count alone stay tier C. Classification and wave-interpreter tests (64 lanes against two
waves of 32) cover the rule and its near misses.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:45:05 -05:00
4e99a4951d tests/semantic: wave64 halves harness supplies BaseVertex/BaseInstance 2026-11-22 14:22:14 +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