Recompiler: in compute programs an S# set before a branch samples through sampler-heap entry 0 #2835
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#2835
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@pvfreis on GitHub · 2026-11-26 16:57 UTC · original
A plan before a PR, for the part
82e4a9bb(onnvidia-dev, in #2572) leaves out: compute programs. Onmain(b49be183; the code isthe same at
8b957bec)constant_samplersforgets S# constants at every block start, so a sample after a branch falls back toSamplerDescriptorHeap[S#.word3 & 0x7FF]. For an S# built in code those are the low bits of the border-colour pointer, usually 0(RDNA2 ISA §8.2.7; a branch writes only the PC, §4.2, §12.5).
82e4a9bbfollows the constants in vertex and pixel programs only. In 60compute programs of one retail title (a set picked for another measurement) that is 162 of 5,629 samples, in 15 of the 49 programs that
sample; in a 1-in-10 sample of its shader pack, 308 of 11,481 in 47 of 178. All of them have index 0.
at a block's start only when every block that leads there leaves the same one; a program with a branch whose target is not known is
read block by block as today;
s_movreldforgets everything.mainand pass with it, including the cases that must keep the heap lookup (other words on one path,s_load,s_movreld, an S# from memory).main, about 100 changed lines outside tests. If #2572 lands first it becomes: 82e4a9bb'sfollowalso on for kernel and compute,the
s_movreldcase, the tests, and 82e4a9bb's assertion that other programs stay block by block changed (its test fails with this, asit should). I can send that form to
nvidia-devinstead.82e4a9bbnames for compute (2,055 ExecuteIndirect counts out of range in 75 s, then a device hang): not reproduced, causestill unknown.
nvidia-devaf2cecc4+ the second form, one title run on an RTX 3060 (empty DXIL cache,XCL_PREPARE=0, theExecuteIndirect guard at its default): 0 counts out of range (the log does not show how many the guard checked), no device removal; no
present after 282 s, stopped by our memory guard at 450 s (37 GiB private). The same tree without it, one run, 465 s: none either.
On that title this makes the same samples static as
fbfac4d0did (the two functions on the same instructions: no difference in the 60programs or in the 269 of the pack sample), so it does not avoid the symptom by finding fewer.
Overlaps #1573 (rewrites the same loop on
main) and #2572 (carries82e4a9bb).AI use: Claude Code (Claude Opus 5.5) wrote the change and the tests, ran the counts and the title runs, and wrote this; Claude Fable 5.2 rechecked it.