Commit Graph

51 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
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
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
39879ce0fd Merge main into RT-PROTON-STORY-LOAD (#984)
Merges main at 1154976d4 into the integration branch at 273b3bdf9 (merge base ece4ba5b3). 42 files conflicted;
this commit is the resolution only. Build and test repairs follow in their own commits.

Rule of resolution: where both sides added different things, both stay; where both made the same change in two
forms, main's reviewed form stays and whatever #984's form did in addition is carried into it; where the two
changed the same code for different purposes, both purposes are kept.

Xbox proxy code (runtime/shims/d3d12_xs_device.cpp, d3d12_xs_device.h, d3d12_xs.cpp, d3d12_xs_alloc_size.h,
d3d12_xs_desc_clean.h, registry.cpp):
- d3d12_xs_device.cpp is #984's file with main's differing pieces ported in: env_slot and the configurable device
  routes, XboxQueueSlotRoutes, PresentationHandler / set_presentation_handler, the console caller rule for device
  slots 61 and 74 (#383, #385), route_xbox_device_slot, slot 81 as GetFrameStatisticsX, create_host_device, the
  console-form rule for slots 25 and 56, the console list IID of #359, and the forms of queue slot 18 (#403) and
  list slot 139 (#396).
- Kept from #984: the list proxy with handle translation, queue slots 16/17 as Signal/Wait, the fence's
  completed-value mirror, the shared FrameTokenSource, PresentX through queue_present_x when no handler is
  attached (slot 30, or 32 on a queue detected as the newer layout), slots 27/53/55/57/70/71/133, the wider
  pc_resource_desc, S_OK for queue slots past the PC table.
- Dropped: #984's GetFrameEventsX and LEONIDA_XS_FRAME_EVENTS_SLOT, its second-word rule for slot 61, its
  undetected-layout rule for queue slot 18, its list IID mapping to GraphicsCommandList6; main's copy of the base
  list proxy, its null-view slot 70 and its refusing slot 133.

Proxy tests (runtime/test/xs_proxy_mock_test.cpp, device_proxy_test.cpp, queue_proxy_test.cpp):
- Checks of both sides, each run once; main's forms of the render-target size and layout checks with #984's extra
  cases added; main's --env-slots-74 and #984's --env-slots-70.
- Adapted to the merged code: the queue tail answers S_OK, slot 73 answers an unknown IID with the list proxy,
  the queue slot 18 case installs a console caller. Dropped: #984's slot 81 GetFrameEventsX cases.

D3D12/Vulkan layer (runtime/shims/d3d12_com.cpp, d3d12_vulkan_device.cpp, runtime/src/command_list.h,
frame_pacer.h, shader_library.h, vulkan_backend.h, vulkan_replay.h, runtime/test/command_list_test.cpp,
d3d12_close_parity_test.cpp, d3d12_execute_indirect_validation_test.cpp, replay_texture_barrier_test.cpp,
vk_pipeline_check.cpp, vk_test_device.h):
- Resource::create_texture: #984's title images (deferred placed, pending streamed, title pool) and main's
  ordinary textures (#1413 shared blocks, #1364 staging fallback) are exclusive branches chosen by the texture's
  origin, so both pools run on disjoint sets of textures.
- frame_pacer.h is main's pacer (#402) with #984's FrameTokenSource as the token counter.
- main's forms kept for ExecuteIndirect (#1066, #377), the barrier into LAYOUT_UNDEFINED (#1055), the B4G4R4A4
  stand-in, per-face stencil masks, the unaligned tile staging (#528) and the device-lost flag (#980).
- shader_library.h: main's block inflate; #984's `bulk` parameter now defaults to true so main's callers keep it.
- Dropped: #984's B8G8R8A8 stand-in for B4G4R4A4 targets, its refusal of separate stencil masks, its zero-count
  refusal in ExecuteIndirect, its wider UNDEFINED -> UNDEFINED release and the test case for it.

Other shims (runtime/shims/dstorage.cpp, file_system.cpp, gameinput.cpp, xgameruntime_offline.cpp,
runtime/test/xgameruntime_offline_test.cpp, xmem_test.cpp):
- ReadFile and DirectStorage reads: #984's pinned kernel_writes read, then main's touch_pages retry on
  ERROR_NOACCESS. main's rt::fs::read_file is folded into #984's read_file.
- gameinput: main's strict LEONIDA_INPUT_SCRIPT parser with #984's rsup/rsdown entries.
- Speech synthesis: main's one silent voice and handle checks; #984's accept-anything form dropped.

Build, tools, docs (runtime/CMakeLists.txt, runtime/cmake/translator_deps.cmake, scripts/build_runtime.ps1,
make_game.py, tools/rdna2spirv.py, shader_disasm.py, shader_ir.py, shader_library.py,
runtime/test/shaders/cs_imgload_tfe.asm, cs_imgload_d16_tfe.asm, docs/README.md, boot.md, d3d12_vulkan.md,
runtime/README.md):
- Unions of the test, target and source lists; spirv_loop_guard.py added to translator_deps.cmake.
- rdna2spirv.py: main's DPP compare rule (#957), SMEM vcc base (#647) and widen_wave64_masks (#1021); #984's
  restore_skipped_instructions and restore_dot4_inline_sel. #984's duplicate widen_wave64_valu_masks dropped.
- shader_disasm.py and shader_ir.py: main's structure with #984's one-line-per-dword llvm-mc input and wave flags.
- shader_library.py: main's structure with #984's --compute-hashes and per-state compute variants.

One file that did not conflict is changed here: tools/rdna2_decode.py. Git kept both sides' decoders for a VOPC
compare with a DPP operand, and #984's narrower one shadowed main's; it is main's file again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 19:38:04 -05:00
f03418595c wave64_halves: a vote on a scalar compare under whole-quad EXEC is no lane vote (SHADER-W64-WQM-UVOTE)
A pixel shader that needs derivatives starts with s_wqm_b64 exec, exec, and LLVM branches on wave-uniform conditions
inside that region as it does anywhere: v_cmp_* sN of scalars, s_and_b64 vcc, exec, s[N:N+1], s_cbranch_vccnz.
SHADER-10 took that for no lane vote only while EXEC was the launch mask, so here it was unsafe-vote-branch.

A compare of immediates and scalars is the same in every lane, so its mask is every lane of EXEC or none; the whole
quads of the launch mask have a lane in every 32-lane half that runs (a quad never straddles the halves). The analysis
carries "EXEC is the whole quads of the launch mask" as a dataflow fact, set by s_wqm_b64 exec, exec under the launch
mask and dropped by every other EXEC write. VGPR sources stay refused there, and so does a path on which a scalar was
read out of a uniform VGPR from a lane the launch mask may not have written.

Corpus (1.0.2.1, all 26,503, on top of SHADER-W64-SDST-PAIR): 452 pixel shaders go from tier C to A, none moves the
other way: C 7,741 to 7,289.

Tests: tests/semantic/test_wave64_halves_wqm_uvote.py; GPU fixture ps_w64_a_wqm_uniform_vote (RTX 4070 Ti, 620.70.06).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 11:47:35 -06: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
f9e7e3e1bf Merge pull request #265 from kotekompotek/contribution/wave64-halves-partial-dst-rmw
rdna2spirv: fix Wave64 halves partial destination read-modify-write
2026-11-23 22:28:20 -05: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
5d2a3707a2 docs: point wave64_halves at its --help usage line (#6663)
Squash-merged after diff review of PR #6663
2026-11-23 11:02:46 -06:00
d239fd8556 tools: accept UTF-8 BOM JSON inputs in ten utilities (#6779)
Squash-merged after diff review of PR #6779 - tools: fix BOM-prefixed JSON inputs in 10 utilities (batch 01)
2026-11-23 09:56:38 -06:00
ad1e53e42b wave64_halves: preserve destination taint on partial writes and reject asymmetric DPP row_mask
Fixes partial-destination writes in tools/wave64_halves.py that dropped prior taint and falsely marked divergent VGPRs uniform (miscompiling v_readlane_b32 in rdna2spirv.py):
- Track destination read in operands() for SDWA dst_unused:UNUSED_PRESERVE with sub-dword dst_sel, single-half 16-bit VALU ops (including 8-byte VOP3 / _nc_16 / v_interp_p2_f16), partial-lane DPP (row_mask/bank_mask != 0xf or bound_ctrl:0), v_fmac_legacy_f32, and partial d16 loads.
- Flag half-asymmetric DPP row_mask ((row_mask & 3) != (row_mask >> 2)) and dpp8 in transfer().

Verified locally (CPU-only):
- tests/semantic/test_wave64_halves_partial_dst.py (13 OK)
- tests/semantic/test_wave64_halves_soundness.py (30 OK)
- tests/semantic/test_wave64_halves.py (73 OK)
- tests/semantic/test_wave64_cross_half.py (9 OK)
- tests/semantic/test_wave64_subgroup_ops.py (6 OK)
- pytest tests/test_wave64_halves_fixtures.py tests/test_wave64_graphics_scan.py (25 passed, 1 skipped)
- docs, line-ending, resource hygiene, tool startup, compileall, git diff --check

# Conflicts:
#	docs/design.md

# Conflicts:
#	tools/wave64_halves.py
2026-11-23 17:15:35 +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
ae8c654dc4 Merge pull request #4620 from Luiz Neves
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/design.md
2026-11-22 23:16:32 -05:00
326417ae3e Merge pull request #4601 from plentilha
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:16:19 -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
2cbc8e0462 wave64_halves: a vote on a mask ends when the mask register is rewritten (SHADER-820)
@shdann: put() dropped the destination's own tag but not a ('vote', r) tag on
SCC naming it. v_cmp into the pair or VCC, s_mov_b64 and s_cselect_b64 don't
write SCC, so s_cbranch_scc0 voted on the old mask while the run side
narrowed EXEC to the new one: false tier A (one 64-lane wave writes v6 in 32
lanes two 32-lane waves skip). put() now drops the SCC vote when it writes
the voted register (or the pair's second SGPR); ops that vote on their own
destination set the new tag after it.

Tests in test_wave64_halves_soundness.py: shdann's three listings are tier
C and diverge 1x64 vs 2x32; an unchanged and a re-voted mask stay tier A
and invariant. docs/design.md SHADER-10 row extended.
2026-11-23 00:51:05 -03: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
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
9eee64d8a7 wave64_halves: allow tainted lane selector on uniform v_readlane_b32 (SHADER-314) 2026-11-23 00:02:50 -03: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
9c7a861906 wave64_halves: vote() takes st explicitly; the row says an exported uniform mask stays cross-lane (review nits) 2026-11-23 00:55:44 +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
d42f8b4631 Merge pull request #2674 from Linnard Alex Brown Jr.
# Conflicts:
#	docs/design.md
2026-11-22 16:59:33 -05: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
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
cdb907aa8f Merge pull request #2127 from AwkGrep256
# Conflicts:
#	docs/design.md
2026-11-22 11:42:03 -05:00
1222fd54a0 wave64_halves: propagate movrel dst taint across VGPRs and drop ANDN2 from narrows()
Address @Flyander's review comments on PR #1982:
- Propagate wt and rank/base tokens (st['r'], st['b']) across every referenced VGPR >= dst_base on v_movreld_b32/v_movrelsd_b32/v_movrelsd_2_b32/v_swaprel_b32 (and read-side VGPRs >= src_base on v_movrels_b32/relsd/swaprel in step()), so non-zero M0 targets (e.g. M0 = 1) preserve downstream taint into sinks.
- Remove s_andn2_saveexec_b64 and s_andn2_wrexec_b64 from narrows(); keep s_andn1_saveexec_b64 and s_andn1_wrexec_b64 excluded as well because ~S0 & EXEC runs all lanes when S0 == 0, which diverges on 1x64 vs 2x32 behind s_cbranch_vccz.
- Add regression and 1x64-vs-2x32 divergence tests for non-zero M0 v_movreld_b32 (both tainted and clean control) and ANDN1/ANDN2 in vote branches.
2026-11-22 13:05:32 -03: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
69bd312336 wave64_halves: fix soundness gaps in RMW, SCC, movrel, s_bfm_b64, and EXEC tracking
Closes several soundness gaps where partition-dependent wave64 VS/PS/GS programs could be classified as Tier A or B instead of Tier C:
- RMW destinations & s_pack: track in-place read-modify-write sources (s_addk_i32, s_mulk_i32, s_cmovk_i32, s_cmov_b32/b64, s_bitset*, v_*fmac/mac*, v_dot*c*), remove s_pack from NO_DEST, handle v_swap_b32 rank/base/tag/uniformity swap (conservatively unioning under narrowed/elected exec), and attach implicit vcc (len(srcs) == 2), scc (s_cmovk_i32), and m0 (MOVREL_OPS).
- SCC tracking: add SCC-preserving scalar ops (s_mul, s_pack, s_sext, s_flbit, s_ff0/ff1, s_brev, s_bfm, s_bitreplicate, s_get_waveid) to SCC_LESS, stop s_ff1_i32_b64 from marking SCC as a wave vote, and keep s_bcnt0_*/s_bcnt1_i32_b32 SCC taint without creating a vote.
- s_bfm_b64 & dynamic register indexing: taint s_bfm_b64 with LANE; propagate VGPR/SGPR taint, mask-SGPR/parked-VGPR-mask usage (MASKD | X), elected-lane taint, uniformity/literal invalidation, and stale SGPR checks across v_movrels_b32, s_movrels_b32/b64, v_movreld_b32, v_movrelsd_b32, v_movrelsd_2_b32, and v_swaprel_b32.
- EXEC / mask-half rules: check s_*_saveexec_b32 / s_*_wrexec_b32 via mask-half, handle s_andn1_saveexec_b*/s_andn1_wrexec_b*/s_andn2_wrexec_b64 narrowing and destination tokens accurately, evaluate SAVEEXEC source before overwriting dest, and check EXEC presence/operand order in s_and_b64 / s_or_b64 / s_andn2_b64.
- Add synthetic regression classification and 1x64-vs-2x32 wave-interpreter execution tests in tests/semantic/test_wave64_halves_soundness.py.

Claim: https://github.com/ItsNotRexed/Leonida/issues/1745#issuecomment-7080924095
2026-11-22 12:21:23 -03:00
106e75b247 wave64_halves: report a bad --census with one line, not a traceback
A path that does not exist, a folder, a file that is not JSON and a JSON list
each ended in a traceback (FileNotFoundError, PermissionError,
JSONDecodeError, AttributeError), so the census could not say what was wrong
with its input. It now reads and validates the index in main(): one ERROR line
and exit 2, nothing printed to stdout.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-22 06:56:16 -06:00
21a8e07168 Fix what the merge round broke: w64_graphics fixtures, the R24G8 FORMAT_SUPPORT check, four tools' stdout
- run_gpu_tests.py: #1541's wave64 pixel fixtures (runtime/test/shaders/w64_graphics.py FIXTURES, tiers A-C) are
  checked by that runner; run_gpu_tests picked up their .asm and failed 14 of them with "no checker defined".
  It now leaves w64_graphics.FIXTURES to that runner.
- d3d12_d24_support_test (#1493): expected DEPTH_STENCIL in FORMAT_SUPPORT for R24G8_TYPELESS. Measured here, the
  host D3D12 (RTX 4060 Ti and WARP) reports 0x001010b0 for R24G8_TYPELESS and 0x003110b0 (DEPTH_STENCIL) only for
  D24_UNORM_S8_UINT, which #1511's per-format rules follow; the check now expects the bit for the typed format only.
- fma_mix_probe, text_tables, wave64_halves, xdxr_bvh: new tools without #1428's stdout errors='replace' guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 07:29:31 -05:00