tests: wave reductions and lane-spilled masks under --wave64-emulate, and the emulated CPU model runs the LDS min/max/sub atomics (TEST-W64-EMU-WAVE-REDUCE)
s_load_dwordx2/4/8/16 and s_buffer_load_dwordx2/4/8/16 read their dwords as
uvec4 / uvec2 loads instead of one uint each. An s_buffer_load with a
run-time bound checks its last dword once and takes the wide loads; a load
that is partly out of range keeps the per-dword path, so out-of-range dwords
are still 0 and not read. The vectors go through a NonWritable block (SMEM
on RADV) only in modules that write no memory: with the decoration in a
module that stores, RADV ordered the load before the store and
valu_fuzz --family mem read old words in 18 of 600 programs.
Tested: tests/semantic/test_wide_scalar_load.py (new fixture),
SmemHardwareRuleTests, the translator suite, valu_fuzz --family mem on the
Radeon iGPU (600/600, wave32 and wave64), scripts/run_gpu_tests.py on the
iGPU (same results as before), a synthetic GPU program on the RX 7900 XTX
(docs/design.md row).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
translate() re-translated every emulated wave64 program whose inline
structured form has an OpControlBarrier under a selection or loop as the
round loop (barriers_under_control_flow), for NVIDIA, which hangs on a
barrier only part of the workgroup reaches. A single-wave workgroup
(plan mode inline_all) is one wave: its barriers sit at the top level or
under %pc-only guards, which every invocation takes alike, so the
fallback only applies to multi-wave plans now.
The round form keeps nearly the whole register file live across the
loop and drove RADV/ACO's spiller past 12 GiB (53 GB uncapped) on large
single-wave programs, and made programs with long loops 10-100 times
slower. 666 main-set compute shaders return to the structured form;
translated and spirv-val counts are unchanged.
Restores the single-wave expectations in test_wave64_emulate_opt.py,
test_loop_ballot_barrier.py and test_loop_iteration_guard.py (its round
scheduler check now uses --dispatch-loop), adds
test_wave64_single_wave_barrier.py with a hand-written fixture, and a
docs/design.md contract row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
plan_structured_emulation gave no plan for any multi-wave program with an s_barrier under a guard or in a loop, which every mesh program has (NGG epilogue). The tail scheduler used from an early s_endpgm on now takes over from that s_barrier on, and what comes before is emitted structured.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
run_emulated_workgroup, the CPU model that runs --wave64-emulate output on
all 64 lanes, executed only the OR, add, AND, XOR and exchange atomics: a
program with ds_min_u32 stopped at "unsupported op OpAtomicUMin". It now
runs OpAtomicUMin, UMax, SMin, SMax and ISub, in a branch of its own below
the existing one.
tests/semantic/test_wave64_emulate_wave_reduce.py uses it for two sequences
a compiler emits for a wave64 and that need both 32-lane halves to agree:
- a reduction over the wave (EXEC widened, the identity for lanes that were
off, four DPP steps per 16-lane row, v_permlanex16_b32, v_readlane_b32 of
lanes 0 and 63) that the first active lane alone commits with ds_or_b32 or
ds_min_u32; a ds_add_u32 counter shows exactly one lane ran each commit
- a 64-bit lane mask kept in two lanes of a VGPR with v_writelane_b32 and
read back with v_readlane_b32 after its SGPRs were reused
- ds_min_u32, ds_max_u32, ds_min_i32, ds_max_i32 and ds_sub_u32 from all 64
lanes of one wave
Each program is translated without and with --wave64-emulate and run on 64
lanes, natively and emulated; both must match a plain-Python reference in
every lane. The translator is right for all of it: this is coverage.
Four planted translator faults each fail the new file and pass again when
removed: LDS atomics not ordered before a later LDS read, v_readlane_b32
selecting lane & 31 in a wave64, v_permlanex16_b32 reading its own row
half, a parked mask reloaded by a lane shuffle. Without the interpreter
change the reduction test stops at the NotImplementedError above.
scripts/run_semantic_tests.py tests/semantic: 475 files, 6199 tests, 0
files failed.
AI-assisted. No game files.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The emulated scheduler resets %x_buf words every round. The lane that owns
a word stores to it and every other lane aims the same store at one sink
word; the prologue's zeroing clamps its index the same way. Several
invocations therefore store to one Workgroup word at once: a data race,
harmless because the word is never read, but GPU-assisted validation
reports it in every emulated shader and so hides any real race.
Those 16 stores are now OpAtomicStore (Workgroup scope, relaxed), the same
operands as the OpAtomicOr already used on this buffer. The values written
are unchanged.
On an RTX 3080 Ti, run_gpu_tests.py with LEONIDA_W64_EMULATE=1 under
GPU-assisted validation goes from 44 failed fixtures to 12; without it the
result is unchanged (229/248).
Two test-local interpreters learn OpAtomicStore, and a new case checks that
no plain OpStore targets a shared %x_buf word.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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>
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>
Squash-merged after diff review of PR #6895 - wave64_emulate_opt: cache opcode metadata, fuse liveness/body pass, and precompute superblock dirty transfer
Since 70e739fd7 (coalesce hoisted spine guards) the tail program is one tail scheduler, so
test_tail_scheduler_after_a_mini_scheduler and the interpreter check of the mini scheduler's clears fail after the
merge, though they pass on the branch (based on aa2988cc).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
find_local_exec_folds built the region's sub-CFG from edges inside the region only. An s_cbranch_scc0/scc1 (or any branch) from inside the region straight to the join lost that edge, so cfg_structure.structure placed the next block without a %pc guard and emit_folded_region ran it on the exit path too. Edges to the join now go to an exit node that is dropped from the tree. Test and design.md row added. AI-assisted.
test_w64x_clear_single_writer.py gains a mesh shader and whole-workgroup runs of
programs that take the inline helpers (one wave and several), two local round
loops, and a round loop after a local one. The lockstep interpreter of
test_wave64_emulate_opt.py also fails when one invocation plain-stores a %x_buf
word that another loads or updates between two barriers. With any one of the
four places put back, both files fail. The design.md row has the numbers
measured on main aa2988cc.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
main split x_scheduler into x_prologue and x_round_loop_head and added structured
emulation (x_mini_scheduler, the x_pre_* helper functions). The one-writer clears
are ported to all four places that stored to the sink word. The helper functions
now have a selection, so the inliner of tests/semantic/test_wave64_emulate_opt.py
keeps their labels, and its lockstep interpreter fails when two invocations store
to one %x_buf word between two barriers.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Reduces redundant round barriers and OpSwitch cases under --wave64-emulate (Issue #884) via two exact CFG/dataflow passes in tools/wave64_emulate_opt.py: (1) backward SCC liveness skips scc_from_mask/scc_any_half votes when SCC is dead-out; (2) safe lane-local s_cbranch_execz/execnz region folding inlines single-entry/single-exit read-only regions with no cross-lane ops, no barriers, no EXEC-widening, and no live-out scalars behind if (%active) and chains single-predecessor continuations.