Skip to content

Preserve flat and scratch store address live-ins in translator analysis - #6307

Merged
shayderrr merged 1 commit into
ItsNotRexed:mainfrom
kacper-serewis:fix/flat-store-livein-main
Nov 23, 2026
Merged

shayderrr merged 1 commit into
ItsNotRexed:mainfrom
kacper-serewis:fix/flat-store-livein-main

Conversation

@kacper-serewis

@kacper-serewis kacper-serewis commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Claimed SHADER-FLAT-STORE-LIVEIN on #6214. Built directly on main at 561b65a. No PR dependencies. #6130 covers the census. #2914 separately owns reachable scratch lowering and overlaps the scratch classification.

A synthetic PS takes a branch over s_endpgm and an eight-byte store to an export of v0/v1. Block emission stops at the terminator, but the PS prologue scans the listing for live-ins first. On the base, a flat address pair suppresses both barycentric weights (export 0,0), a scratch address suppresses the first (0,0.625), and a global-store control exports 0.25,0.625. With the change both regressions export 0.25,0.625. Register-set tests independently check both address and payload ranges. All three analyses share the read-only prefix list.

Production translation on base rejected all eight reachable flat-store and eight scratch-store opcodes tested and accepted the eight corresponding global stores. The full private listing cache contained 26,503 listings and zero flat/scratch store instruction lines. Thus zero cached listings exercise the change. No full retranslation or corpus validation count claimed.

AI-assisted. CPU-only on Windows, AMD Ryzen 5 9600X. Two focused semantic tests pass, both modules pass spirv-as and spirv-val for Vulkan 1.2, and compileall passes. Checked fixture encodings with LLVM gfx1013. No GPU or driver used.

Full local semantic suite passed. It ran 6,152 tests in 947 seconds, with 4 skips and 1 expected failure.

@theswiss24

Copy link
Copy Markdown

Tested 446531935 on four GPUs, Linux. Full scripts/run_gpu_tests.py with LEONIDA_W64_EMULATE=1, PR merged onto main 561b65a83, compared with main at the same commit and test programs built from it.

Result: pass, with no change against main. The pass/skip/fail list is identical test by test on all four GPUs.

GPU main PR
GTX 1650 (595.99.02, Ubuntu 24.04) 214/232 passed, 17 skipped 214/232 passed, 17 skipped
UHD 630 (Mesa ANV 25.2.8, Ubuntu 24.04) 197/232 passed, 33 skipped 197/232 passed, 33 skipped
MX150 (580.178.04, Linux Mint 22.3) 204/232 passed, 28 skipped 204/232 passed, 28 skipped
UHD 630 (Mesa ANV 25.2.8, Linux Mint 22.3) 197/232 passed, 33 skipped 197/232 passed, 33 skipped

This PR adds no fixture of its own; on these drivers, keeping the flat and scratch store address live-ins changes no fixture's result.

Tested and written by Claude (Claude Code).

@shayderrr shayderrr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Reviewed change in PR #6307: Preserve flat and scratch store address live-ins in translator analysis.

Scope: docs/design.md, tests/semantic/fixtures/ps_flat_store_livein.asm, tests/semantic/test_store_liveins.py, +1 more
Diff: +45 / -6 across 4 file(s).

The change stays inside the stated scope and the touched files line up with the description. No unrelated production paths are pulled in, and the stated behavior is directly exercised by the diff. I'm approving this one.

Reviewed by shayderrr via automated batch review.

@shayderrr

Copy link
Copy Markdown
Collaborator

Thanks @kacper-serewis - I went through Preserve flat and scratch store address live-ins in translator analysis and the diff around docs/design.md. The change is tight, the rationale matches the code, and there's nothing here that needs another pass from my side. Approved and squash-merging it into main now. Nice work.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Head 446531935, main 561b65a83 (0 behind); git diff --check clean.

python tests/semantic/test_store_liveins.py has no __main__ block and exits 0 silently, so I used:
python -m pytest tests/semantic/test_store_liveins.py -q -> 2 passed, 4 subtests.

flat_store* and scratch_store* join the shared read-only prefix list, so the PS prologue, interp-IJ and reg_reads_writes analyses all treat address and payload as sources (the v_cmp prefix still covers v_cmpx). The fixture's branch exports 0.25/0.625 for both store forms. First-frame: none; the PR's corpus count is 0 flat/scratch stores in 26,503 listings. LGTM.

@shayderrr
shayderrr merged commit 0d9972f into ItsNotRexed:main Nov 23, 2026
0 of 5 checks passed
@byPreaZy

Copy link
Copy Markdown

Corpus check on a second copy of the same package (26,503 disasm listings, counts only): no scratch_load/scratch_store or flat_load/flat_store instruction appears anywhere in the corpus (the only scratch/flat tokens are src_flat_scratch_base_lo/hi literal operands inside v_madmk_f32 address arithmetic, 48 occurrences in about 10 listings). The flat/scratch store VGPR live-in path is latent on game shaders. Counted with grep -o on Windows, AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants