Commit Graph

12 Commits

Author SHA1 Message Date
cab6609160 Merge remote-tracking branch 'lc/main' into lc/addr-no-int64 2026-11-27 23:49:06 +02: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
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
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
60e63dae1a tests: test_loop_ballot_barrier follows #2089's structured wave64 emulation
The merge of #2089 (1cc7497b) made a reducible multi-block loop take the
structured emulation and outlined the per-round exchange setup into
single-block helpers called with OpFunctionCall. The test's own workgroup
interpreter could not run the calls and still expected the round scheduler,
so five subtests failed on main.

The interpreter now expands single-block helper calls inline (as
test_wave64_emulate_opt.py does), the emulated cases expect "emulated wave64
structured", and the same cases also run with --dispatch-loop to keep the
round scheduler covered against the same native words.

AI-assisted.
2026-11-22 23:48:51 +01:00
804f4aeff7 rdna2spirv, lane_masks: fix wave64 split SGPR-pair masks, emulate x_mcache, and b64 mask+imm tracking 2026-11-22 08:19:56 -08:00