Commit Graph

45 Commits

Author SHA1 Message Date
8aada4fc2d Test append/consume barriers in one-wave branches 2026-12-01 00:14:52 +00:00
c06660c318 Merge origin/main (f9f3ec4c6) into the carry of #1906
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
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
e7c3366210 Merge origin/main into #1906 (carry prep)
docs/design.md: wave64 emulation row keeps main's barrier text and the PR's s_bitset 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:15 +01:00
d477c94cd5 Merge remote-tracking branch 'lc/main' into lc/addr-no-int64 2026-11-28 14:48:48 +02: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
38bec0f92b Merge pull request #1381 from milk4sale/test/w64-emulate-wave-reduce
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)
2026-11-28 12:52:30 +01:00
cab6609160 Merge remote-tracking branch 'lc/main' into lc/addr-no-int64 2026-11-27 23:49:06 +02:00
2e54980149 rdna2spirv: multi-dword scalar loads as wide loads with one bound check
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>
2026-11-27 05:48:40 -05:00
8bc59a74c2 Merge pull request #2102 from DadaCap/mesh-epilogue-tail
wave64_emulate_opt: a guarded s_barrier keeps only the tail in the round scheduler (SHADER-W64-STRUCTURED-SBARRIER-TAIL)
2026-11-26 22:42:30 +01:00
3f78e6d022 Merge remote-tracking branch 'lc/main' into lc/addr-no-int64
# Conflicts:
#	tools/rdna2spirv.py
2026-11-26 16:54:48 +02:00
a02a5ef7a9 rdna2spirv: no round-loop fallback for single-wave emulated programs
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>
2026-11-26 09:07:28 -05:00
3677e3217a Merge remote-tracking branch 'lc/main' into lc/addr-no-int64
# Conflicts:
#	docs/design.md
2026-11-26 13:30:48 +02:00
84816055d5 wave64_emulate_opt: a guarded s_barrier keeps only the tail in the round scheduler (SHADER-W64-STRUCTURED-SBARRIER-TAIL)
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>
2026-11-25 21:45:21 +01: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
6112644606 Merge remote-tracking branch 'lc/main' into lc/addr-no-int64
# Conflicts:
#	docs/design.md
2026-11-25 18:58:21 +02:00
e11c0017ca wave64_emulate_opt: model s_bitset0/1_b32/b64 as read-modify-write and SCC-less (SHADER-W64-EMU-BITSET-RMW) 2026-11-25 09:21:42 -06:00
82f033512c Merge pull request #1110 from klikso/carry/shader-w64-sink-race
rdna2spirv: wave64 emulation resets shared words with OpAtomicStore (SHADER-W64-SINK-RACE-CARRY)
2026-11-25 03:38:02 +01:00
aad0d61b15 tests: wave reductions and lane-spilled masks under --wave64-emulate (TEST-W64-EMU-WAVE-REDUCE)
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>
2026-11-24 16:56:39 -06:00
19e42d6de7 rdna2spirv: wave64 emulation resets shared words with OpAtomicStore
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>
2026-11-24 18:32:21 +00: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
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
268389e20d Merge pull request #263 from kotekompotek/contribution/wave64-emulate-barrier-sync
rdna2spirv: wire Wave64 emulate barrier/sync optimization pass
2026-11-23 22:28:16 -05:00
bed6382f78 wave64_emulate_opt: an SGPR pair with one mask half and one constant half counts as a lane mask 2026-11-24 08:38:20 +05:30
80417b9c4e wave64: align emulate barrier prediction for s_flbit, mixed s_cmp_*_u64, and ds_nop
Fixes three --wave64-emulate AssertionError crashes and sync mismatches:
- tools/wave64_emulate_opt.py (_classify_block_body, _insn_may_barrier): recognize s_flbit_i32_b32 and s_flbit_i32 on lane masks, and s_cmp_eq_u64/s_cmp_lg_u64 on mixed mask+data SGPR pairs via _has_any_lane_mask_word().
- tools/rdna2spirv.py (Gen.x_memory_order): treat ds_nop as a no-op matching NOOPS and wave64_emulate_opt._x_memory_order_access().
- tests/semantic/test_wave64_emulate_opt.py: add FindSMsb to run_emulated_workgroup OpExtInst handler.
- tests/semantic/test_wave64_emulate_barriers.py: add unit and 64/128-thread workgroup interpreter regression tests.
- docs/design.md: document the wave64-emulate barrier alignment rules and CPU verification scope.

Verified locally (CPU only, no GPU/spirv-val/llvm-mc):
- python -I tests/semantic/test_wave64_emulate_barriers.py -> 13/13 OK
- python -I tests/semantic/test_wave64_emulate_opt.py -> 22/22 OK
- pytest -q (12 test files) -> 70 passed

# Conflicts:
#	docs/design.md

# Conflicts:
#	docs/design.md
#	tools/wave64_emulate_opt.py

# Conflicts:
#	tools/wave64_emulate_opt.py
2026-11-23 21:13:20 +05:00
8c22bf40a0 wave64_emulate_opt: cache opcode metadata, fuse liveness/body pass, and precompute superblock dirty transfer (#6895)
Squash-merged after diff review of PR #6895 - wave64_emulate_opt: cache opcode metadata, fuse liveness/body pass, and precompute superblock dirty transfer
2026-11-23 09:45:26 -06:00
0e8c9bc28f wave64_emulate_opt: handle slist operands and src_scc in liveness and mask checks (#5500)
Squash-merged after review of PR #5500 - wave64_emulate_opt: handle slist operands and src_scc in liveness and mask checks
2026-11-23 08:09:39 -06:00
ab1c07eb65 Revert #4247: its tail-scheduler tests need a mini scheduler that main's planner no longer makes
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>
2026-11-23 03:54:49 -05:00
4c17a68fed Merge pull request #4574 from Bloh09
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/design.md
2026-11-22 23:16:04 -05:00
8cbd3fbac9 Merge pull request #4392 from leather147
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/design.md
2026-11-22 23:14:19 -05:00
1aa3e384f6 Merge pull request #4300 from DoubleD17
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:13:18 -05:00
ee067ef34f Merge pull request #4247 from Emma
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/design.md
2026-11-22 23:12:45 -05:00
a54ea0eebf wave64_emulate_opt: keep a folded EXECZ region's exits to the join, so a scalar branch there skips the rest
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.
2026-11-22 18:25:27 -08:00
6214c46850 wave64: synchronize scalar flbit reads of lane masks
AI-assisted (Codex).
2026-11-23 04:11:25 +03:00
7b1836fde8 wave64: keep SCC live for explicit src_scc reads 2026-11-23 00:35:25 +00:00
5f16276d12 tests, docs: every clear of the wave64 exchange buffer has a test that fails without it (SHADER-708)
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>
2026-11-23 01:43:24 +02:00
c06d841f49 Merge main aa2988cc into shader-708-wave64-clear-race; port the single-writer clears
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>
2026-11-23 01:06:33 +02:00
70e739fd70 wave64_emulate_opt: coalesce hoisted spine guards across early exits and loop headers 2026-11-22 16:28:35 -04:00
1551d2cc36 rdna2spirv: unwrap known-pc spine guards and outline inline x_round setup 2026-11-22 16:01:58 -04:00
496f5e47a4 Merge branch 'perf/wave64-emulate-dead-scc-exec-fold' into perf/wave64-emulate-structured
# Conflicts:
#	docs/design.md
#	tests/semantic/test_wave64_emulate_opt.py
#	tools/rdna2spirv.py
2026-11-22 14:37:04 -04:00
5131dece32 wave64-emulate: track implicit SCC read in s_cmovk_i32 and M0 read in v_movrel/v_swaprel 2026-11-22 12:32:41 -04:00
5ddfd09fc5 wave64-emulate: make transfer_superblock strictly monotone (fix phantom dirty_in clear) 2026-11-22 12:09:22 -04:00
4d9ef4eb27 wave64-emulate: add acyclic single-write folding and structured inline/hybrid emulation (#884) 2026-11-22 11:54:15 -04:00
d93e53178d wave64-emulate: handle reused saveexec pairs and align is_mask_op SCC check 2026-11-22 11:13:00 -04:00
18abefa47b wave64-emulate: elide dead SCC votes and fold safe lane-local execz regions
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.
2026-11-22 10:57:54 -04:00