Commit Graph

5744 Commits

Author SHA1 Message Date
570b441d70 translator: lane-mask data reads gather the wave word under narrowed EXEC
A lane mask in an SGPR, EXEC or VCC is one wave-wide word on hardware.
The EXEC-coverage gate added earlier in this pull request could not prove
the independent-SGPR restore idioms crosslane_fuzz uses, so it fell back
to this lane's 0 / ~0 bit for exactly the programs the read is meant to
fix. It also encoded the wrong control-flow model: EXEC narrowing is a
per-lane value here, not a SPIR-V edge. Mask-data readers are already
kept out of lane-local `if (active)` runs, and the eager wave-mask store
keeps lowering from moving the subgroup gather into an EXEC-selected
arm, so lanes EXEC has off still contribute their mask bits.

Remove the gate and the CFG EXEC provenance analysis it needed, gather
the mask word for every lane-mask data read, and cover narrowed SGPR and
VCC reads, an independent all-ones SGPR EXEC restore, and the composed
vector-bitwise mask words. The vector-bitwise expectations now check the
uniform mask words and the resulting per-lane cndmask bits and popcounts
rather than the old fallback artifact.

Co-Authored-By: SWE-2.1 Max <noreply@google.com>
2026-11-30 22:23:09 +00:00
28944c1921 rdna2spirv: the wave mask gather is stored before it is read, so every lane runs it (SHADER-WAVEMASK-EAGER)
A register holds this lane's bit of a lane mask; v_mbcnt, s_bcnt1 and
s_ff1 gather the other lanes' bits with a subgroup operation
(Gen.wave_mask). v_mbcnt writes a VGPR, so its result is selected on the
lane's EXEC, and MoltenVK's SPIRV-Cross inlined the single-use gather
into the taken arm of that ternary:

    v6 = active ? popcount(simd_or(mine ? bit : 0) & below) + acc : v6;

A lane that is off never ran the gather, so its bit was missing from
every other lane's count. Gen.wave_mask now stores the gather to a
variable of its own with Gen.eager, as SHADER-529 did for DPP's ballot
and shuffle.

On an Apple M5 (MoltenVK 1.4.2), tools/crosslane_fuzz.py with wave 32,
native and no maskdata goes from 92 of 100 programs matching to 100 of
100, and from 193 to 200 of 200 with DPP at seed 7.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Co-Authored-By: SWE-2.1 Max <noreply@google.com>
2026-11-30 22:22:44 +00:00
b3cc377020 translator: s_mov copies of EXEC keep the narrowing's tag through SGPR round-trips
Review follow-up on the mask-word gather gate (#1397): `s_mov_b32 s4,
exec_lo` under an unknown EXEC narrowing recorded nothing for s4, so the
later `s_mov_b32 exec_lo, s4` restore minted a fresh ("n", id) tag in
_exec_src_ex. mask_exec_sigs coverage then failed and the read kept this
lane's 0 / ~0 bit, while the equivalent literal `s_mov_b32 exec_lo, -1`
resolved to a constant half-state and gathered — register and literal
restores of the same runtime value disagreed.

_mov_sgpr_vals now returns an ("al", halves) alias for an EXEC source
whose half-state is an unknown narrowing, the same scheme saveexec uses:
exec_lo gives (state, None), exec_hi (None, state), exec gives each half
in its own register for b64 moves. _exec_src_ex already resolves those
aliases, so the restore reproduces the original tag and the gather stays
exact; untracked SGPR sources still mint a fresh narrowing and stay
conservative.

Tests: two semantic cases (wave32 and wave64) assert the register
round-trip gathers OpGroupNonUniformBitwiseOr identically to the literal
-1 restore; cs_exec_copy.asm (+ fixture, check.py/run_gpu_tests.py dump
entries) stores the mask word, exec_lo's own word and the literal-restore
word side by side on real hardware — PASS on RTX 4070 and Radeon
(64-wide), wave64 exec filters 9/9 on AMD.

Co-Authored-By: Devin <noreply@cognition.ai>
2026-11-30 22:22:44 +00:00
1725e0818a translator: gate mask-word gathers on EXEC coverage; scalar mask number reads
Review fixes for the mask-as-data change:

- The wave-mask gather is a group op over the lanes EXEC leaves active,
  and drivers differ on whether lanes EXEC has off still vote: NVIDIA,
  AMD and KosmicKrisp return the whole subgroup's bits, MoltenVK's
  ballot/reduce saw only the lanes a narrowed EXEC left on and produced
  the EXEC value instead of the frozen mask word (cs_mask_vgpr_exec).
  mask_word_read_ok now gathers only when a CFG must-analysis
  (mark_exec_state) proves every lane that can hold a set bit of the
  mask is EXEC-active at the read: each EXEC half is tracked as clean,
  a constant mask, or an unknown narrowing (s_mov/s_cselect resolve
  constants, saved-EXEC aliases and unchanged EXEC, so the common
  restore idioms still gather), and mask_exec_sigs records every EXEC
  state seen while each mask register held a mask. Unproven reads keep
  this lane's 0 / ~0 bit, the pre-change answer.
- Scalar number ops read a lane mask operand as data too
  (MASK_NUMBER_READERS, #1043's NUMBER_READERS): s_add_u32 s20, s10, K
  after v_cmp wrote s10 yields the wave's mask word, while mask moves
  and mask logic ops keep this lane's bit for the saveexec idioms.
- wave64_emulate_opt treats ins["mask_words"] (a mask read that will
  gather) as a cross-lane exchange for the lane-local fold planner and
  barrier scheduler, covering the scalar readers as well.
- test_slot67_operand_forms' expectedFailure comes off: the packed
  vcc_hi word now reaches the data read.

Co-Authored-By: Devin <noreply@cognition.ai>
2026-11-30 22:22:13 +00:00
51b0b9d340 translator: a VALU data read of a lane-mask operand yields the wave's mask word
A lane mask (EXEC/VCC or a mask-tracked SGPR) that a VALU op reads as a
32-bit value — v_mov_b32 of it into a plain VGPR, or any VALU source
where the mask is data rather than a mask operand — materialized each
lane's own 0 / ~0 bit. Hardware holds the whole wave's mask word there
(tools/crosslane_fuzz.py's op_maskdata model: the uniform word written
to the active lanes), so every lane gets the word, the same in each.

- src_u materializes the wave mask word (lane_mask_word) for SGPR and
  EXEC/VCC operands when the instruction's VGPR destination makes the
  read a data read (mask_read_is_data); SGPR/EXEC/VCC destinations keep
  this lane's bit, which mask_src readers rely on. Mask-holding VGPRs
  already store the word, so their reads are plain loads.
- mask_src extracts this lane's bit back out of a mask-holding VGPR
  (_vgpr_mask_lane_bit), half-aware in wave64 via mask_half.
- mask_data_src keeps instructions that materialize the word out of
  EXEC-gated active runs (a subgroup op can't sit inside if (active)).
- v_readfirstlane_b32 of a mask VGPR broadcasts the first active lane's
  copy — the only lane guaranteed fresh after an EXEC-gated v_mov_b32 —
  as the word itself into a VGPR destination (VGPR writes are never
  mask-tracked), or this lane's bit for a mask-tracked SGPR/special
  one; fixes cs_wavemask lanes 48-63.

Found by tools/crosslane_fuzz.py (#293). docs/design.md's whole-wave
mask contract updated.

Co-Authored-By: Devin <noreply@cognition.ai>
2026-11-30 22:21:36 +00:00
407f71a237 Merge pull request #2784 from TheGeogeo/d3d12-gate-driver-mod
mods: gate_driver takes a run from the menus into the world (D3D12-GATE-DRIVER-MOD)
2026-11-30 22:41:53 +01:00
0b6e0e3bc4 Merge pull request #2782 from TheGeogeo/d3d12-game-gate
d3d12: an in-game gate: one command, one run folder, one summary.json (D3D12-GAME-GATE)
2026-11-30 22:21:34 +01:00
46ea66693f gate: untracked files in run.json, under_2_at_s from 60 s in the world (review)
run.json's dirty leaves untracked files out; a new untracked count says how many there are. The first
second under 2 frames counted from the world's first second, so the arrival's streaming dip was the
run's; it now counts from 60 s in the world, like the median. The longest gap with no frame stays
from the world on: a freeze on pipeline compiles comes right after arrival. The docs say both, and
that world_at_s counts from the gate's start, the precompile included.
2026-11-30 21:58:26 +01:00
1f08a8abb1 scripts: red_green.py checks a pull request red and green locally (TEST-RED-GREEN-LOCAL)
Green is current main with the pull request merged. Red is current main plus only the pull request's
tests: its test files, and the hunks of other Rust files that change only #[cfg(test)] items,
committed on the merge base and cherry-picked with a 3-way merge. It runs the touched D3D12 crates'
cargo test and the changed tests/**/test*.py on both sides, in one worktree and one target dir under
the git common dir, and prints per test: red then green, pass on red and fail on green, fail on both,
on one side only, with a verdict and an exit code. docs/testing.md has it next to the fork-CI recipe.
2026-11-30 21:52:48 +01:00
8b79ed2720 mods: gate_driver presses at the menus' pace after a probe that shows no move (review)
A probe that showed no move pressed Enter at once, and the menus then probed again at once: Enter came
every 3 to 5 s (68 times in 6 min on a cold cache), with no press_every and no check that frames had
moved on. It now asks the menus for one press at their pace, and a probe waits for Enter to be up.
The docs say what idle cannot tell (a held player) and what a cold cache does to CONTROL.
2026-11-30 21:49:19 +01:00
923dc26741 mods: gate_driver takes a run from the menus into the world (D3D12-GATE-DRIVER-MOD)
A Lua mod for in-game gates and A/Bs: it presses Enter through the title's menus only once frames
have moved on since the last press, shows control by holding W (the player must walk 1 to 30 m in
3 s; more is the title placing the player, which it waits out without a press), then stands still
(idle) or walks a fixed loop (roam). It logs GATE PRESS/PROBE/CONTROL/MARK/SHOT/FAIL lines with
distances only, never a position. It ships disabled; a run enables a copy with LEONIDA_MODS and
needs LEONIDA_GAME_ACTIONS=1 for the player's position.

The logic is in driver.lua and takes the calls it uses as an argument, so leonida-lua's tests run
it on a stub with a simulated clock: menus, control, roam, no position, no control, a jump.
2026-11-30 21:02:29 +01:00
c05f43403a docs: measuring_fps names no file of another pull request
test_docs_repo_paths failed: docs/measuring_fps.md named scripts/game-gate.ps1, which only #2782 adds.
Name the game gate's run folders instead, here and in the tool's docstring.
2026-11-30 20:57:07 +01:00
22e096e479 docs: the gate's command example names no play-script switch as its own (review)
test_docs_cli_flags read the -SeriesS -NoFrameGen inside -PlayArgs '...'
in the fenced command as flags of game-gate.ps1. The block now shows a
placeholder, and the text gives the example.
2026-11-30 20:52:03 +01:00
76b543a097 tools: d3d12_ab_compare reads an A/B of the D3D12 runtime (D3D12-AB-COMPARE)
docs/measuring_fps.md tells how to read an A/B (neighbouring pairs, the
effect with its standard error, ABBA after a throwaway run), but the
scripts it named were never in the repository, and testers' two-run
verdicts turned out to be noise.

`abba` takes runs in the order they ran (folders of scripts/game-gate.ps1
or logs), one value a run (its world median frame time: frames within a
run are not independent), pairs neighbouring runs and gives the mean
difference with its standard error and a 95 % t interval, the median of the
differences and how many agree in sign. It needs at least 4 pairs, as many
with A first as with B first, so a linear drift cancels; with 3 runs a side
it fits the side and a linear trend instead. It says "B faster" or "B
slower" only when the interval leaves 0 out and all pairs but one agree.
Gate runs that did not PASS are left out with their pair.

`phases` does the same inside one LEONIDA_AB run, per switch, for the
median frame time and the `A/B counters` line, leaving out pairs of blocks
whose draws a frame differ by more than a tenth. `plan` prints a balanced
order. Numbers only, never log text.
2026-11-30 20:44:09 +01:00
b535fb0dc3 d3d12: an in-game gate: one command, one run folder, one summary.json (D3D12-GAME-GATE)
Testers ran in-game gates and A/Bs by hand on five machines, each with
their own launcher wrapper and log parsers, and lost runs to consoles and
key files. scripts/game-gate.ps1 runs leonida.exe through the checkout's
play-d3d12.ps1 and writes one folder per run: run.json, launch.ps1, the
-DryRun settings, the F1 settings file, the launcher's output (the
precompile lines nobody kept), the runtime's log, events.jsonl and a copy
of the tester's data template (their own saves are never touched). It
stops the game with WM_SYSCOMMAND/SC_CLOSE (the runtime's own end: suspend,
pipeline cache saved) once -WorldSeconds were spent in the world, on a
STOP file or after -MaxMinutes, and kills it only 60 s later; it keeps the
game's exit code. `start` runs the same detached (created through CIM, so
an agent's or console's end does not end it); `stop` asks a run to end.

tools/game_gate.py (standard library) reads the folder into
summary.json (leonida-gate-summary/1): build, card, settings (the run's
settings line, no paths), precompile counts, time to the world (two frame
lines with 500 draws or more, cutscenes included), when the pipeline
cache went warm (60 s with nothing being made), fps from the presents
(median, p5, frame p95, end median, the first second under 2 frames, the
longest gap with no frame), crashes by kind (device lost, panic, fault by
module kind), exit, stop and a verdict: PASS needs 300 s in the world,
no device loss, panic or fault, no gap over 10 s, alive at the stop. The
testers' answers to a draft on the bridge are folded in. Its tests use
synthetic logs and check that the runtime still writes what it reads.
2026-11-30 20:39:48 +01:00
d99ba5c095 Merge main: drop the macos job as main does, keep this PR's runtime.yml path filters
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 20:24:47 +01:00
22d58b8629 Merge upstream main into the PR branch 2026-11-30 18:31:59 +00:00
99167bcaf3 Merge pull request #2737 from OreoFR/carry/pr-2062
reprend #2062: d3d12: say when the driver's pipeline cache stops keeping new pipelines (RT-PIPELINE-CACHE-GROWTH-STALL)
2026-11-30 18:38:24 +01:00
f0143cd5ff Merge pull request #2732 from OreoFR/carry/pr-2173
reprend #2173: d3d12_xs: say so when LEONIDA_D3D12=vulkan is asked of a runtime built without the Vulkan device (RT-VULKAN-REQUESTED-NOT-BUILT)
2026-11-30 18:37:45 +01:00
149e3835f3 Merge pull request #2716 from OreoFR/carry/pr-1050
reprend #1050: runtime: replay the console list's inline records as their vtable calls (BL-3)
2026-11-30 18:15:03 +01:00
61666057a2 Merge pull request #2747 from OreoFR/docs/fork-ci-red-green
docs/testing: red and green of a runtime pull request on your fork's CI
2026-11-30 17:50:13 +01:00
be454caa42 Merge pull request #2763 from aslan2142/ci/disable-macos-ci
ci(runtime): disable macOS CI job for now
2026-11-30 17:44:57 +01:00
bd466f8839 Merge pull request #2730 from OreoFR/carry/pr-2362
reprend #2362: rdna2spirv: forward DPP src0 neg/abs to op readers instead of eager 32-bit modify (SHADER-DPP-F16-AND-SIGN-MODS)
2026-11-30 17:24:41 +01:00
1c78b8219e Merge pull request #2728 from OreoFR/carry/pr-65
reprend #65: rdna2spirv: translate FLAT loads and stores as global accesses
2026-11-30 17:24:22 +01:00
35e75b7a9d Merge pull request #2731 from OreoFR/carry/pr-2174
reprend #2174: rdna2spirv: seed the POPS collision word so the wait loop ends (SHADER-POPS-COLLISION-SEED)
2026-11-30 17:24:02 +01:00
ae90109e79 ci(runtime): disable macOS CI job for now
The runtime and GPU test suite passes on real Apple Silicon hardware, while the hosted macos-26 paravirtual VM runner hits MoltenVK-specific failures on main. Disable the macos job in .github/workflows/runtime.yml and document it in docs/testing.md while keeping all Windows, Wine, and Linux CI jobs intact.
2026-11-30 11:18:37 -05:00
e324ad55ed Merge pull request #2720 from OreoFR/carry/pr-2093
reprend #2093: spirv_opt: scalar-replace surviving static Function arrays (SHADER-SPIRV-OPT-SROA)
2026-11-30 17:02:39 +01:00
ca5b392cec Merge pull request #2723 from OreoFR/carry/pr-1994
reprend #1994: rdna2spirv: extract per-lane bits for non-mask special sources in s_mov_b32 exec_hi (SHADER-EXEC-HI-SPECIAL-SRC)
2026-11-30 17:02:03 +01:00
db6c0d0afd Merge pull request #2623 from hardly-relevant/feat/d3d12-stall-trace
d3d12: save a rolling timeline after a frame stalls (D3D12-STALL-TRACE)
2026-11-30 16:58:12 +01:00
be76908059 Merge pull request #2722 from OreoFR/carry/pr-1906
reprend #1906: wave64_emulate_opt: model s_bitset0/1_b32/b64 as read-modify-write and SCC-less (SHADER-W64-EMU-BITSET-RMW)
2026-11-30 16:12:58 +01:00
9f2ca58992 docs/testing: commit the red side's test before pushing (review on #2747)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 15:56:55 +01:00
0703aebb4e docs/testing: red and green of a runtime pull request on your fork's CI
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 15:46:35 +01:00
f474c74b04 Merge origin/main (f9f3ec4c6) into the carry of #2174
Current main after #2566. New conflict on top of the earlier carry merge:
tools/rdna2spirv.py, _translate (straight-line and CFG paths): main passes
extra=meta_extra to _shader_meta.collect and reads the literal samplers
after it; the PR's g.note_pops_word(insns) runs right after that block,
before fit_shared_memory / needs_barrier_rounds as before.

Co-authored-by: QemmHD <290605352+QemmHD@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:30:43 +01:00
de2acaf955 Merge origin/main (f9f3ec4c6) into the carry of #2362
Current main after #2566. New conflict on top of the earlier carry merge:
docs/design.md, DPP row: main rewrote the absent-lane part of the row
(present-lane ballot for FI=1); main's text is kept and the PR's sentence on
Gen.dpp_insn forwarding neg/abs is inserted at the same place as before,
after the HW-DPP-NEG-INVALID-LANE sentence.

Co-authored-by: ShotTechOp <95485630+ShotTechOp@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:30:06 +01:00
bede3ad0d3 Merge origin/main (f9f3ec4c6) into the carry of #2062
Current main after #2566; no new conflicts on top of the earlier carry merge.

Co-authored-by: Galaxy <23423870+thegalaxydev@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:29:20 +01:00
0590fe2777 Merge origin/main (f9f3ec4c6) into the carry of #2173
Current main after #2566; no new conflicts on top of the earlier carry merge.

Co-authored-by: quartz-heron-58 <245169279+quartz-heron-58@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:29:05 +01:00
5b34dc36fd Merge origin/main (f9f3ec4c6) into the carry of #65
Current main after #2566; no new conflicts on top of the earlier carry merge.

Co-authored-by: tiagonogueiraa-bit <360313680+tiagonogueiraa-bit@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:28:57 +01:00
e7d32a034a Merge origin/main (f9f3ec4c6) into the carry of #1994
Current main after #2566; no new conflicts on top of the earlier carry merge.

Co-authored-by: ShotTechOp <anurag7870977875@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:19:22 +01: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
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
57f3a3c1c5 Merge origin/main (f9f3ec4c6) into the carry of #2093
Current main after #2566; no new conflicts on top of the earlier carry merge.

Co-authored-by: JARVIX <273200855+jarvixaiassistant-glitch@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:19:20 +01:00
f216975939 Merge origin/main (f9f3ec4c6) into the carry of #1050
Current main after #2566; no new conflicts on top of the earlier carry merge.

Co-authored-by: Gavin Bloom <g4v1nbl00mt4mu29@tamu.edu>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:19:16 +01:00
8a2736fe6a Merge remote-tracking branch 'origin/main' into tools/chain-check
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 12:33:59 +01:00
e187014f7c Merge remote-tracking branch 'origin/main' into feat/picture-metrics
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 12:33:46 +01:00
4e72cc8664 docs: a switch with a value needs it beside LEONIDA_AB
merzleckeier measured on #2708 that LEONIDA_GUARD_HOT and LEONIDA_SKIP_TRY_A
stay off on both sides when only LEONIDA_AB names them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 11:47:51 +01:00
ab09fd1f86 Merge main: keep --no-ftz32 and --integer-dot-fallback next to --explicit-lod-bias
tools/rdna2spirv.py: main's float-only typed implicit sample (OpImageSampleImplicitLod)
is used only without --explicit-lod-bias; with the flag the Grad path still
scales the derivatives by the S# bias.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 11:46:44 +01:00
0568cd62ee Merge pull request #2708 from MoonEyes/docs/d3d12-measuring
docs: how to measure the D3D12 runtime's frame rates, and its LEONIDA_* variables (DOCS-D3D12-MEASURING)
2026-11-30 11:45:10 +01:00
012b79a678 Merge pull request #2566 from aslan2142/integration/perf-cpu-gpu-r6
[integration] PageMirror, GPU detile, async queue & RDNA2->SPIR-V performance stack (INTEGRATION-PERF-CPU-GPU-R6)
2026-11-30 11:24:25 +01:00
4c13169991 Merge remote-tracking branch 'origin/main' into docs/d3d12-measuring 2026-11-30 11:19:20 +01:00
1b0f657f3d Merge pull request #2655 from OreoFR/docs/gdk-public-pages
docs: which imported GDK names have a public page (DOCS-GDK-PUBLIC-PAGES)
2026-11-30 11:04:41 +01:00