D3D12-SHADER-OPT-CHAINS-CANONICAL: a chain with its steps the other way round is in order (-8 % translate CPU, -0.34 % DXIL instructions) #2800
Code
Clone this repository
Checkout
From your project repository, check out a new branch and test the changes.
git fetch -u origin "github-pr/2800:github-pr/2800" git switch "github-pr/2800"
Open
leonida/mandy
bobcatchris wants to merge 3 commits from
github-pr/2800 into main
pull from: github-pr/2800
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!2800
Loading…
Reference in a new issue
No description provided.
Delete branch "github-pr/2800"
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?
This branch is out-of-date with the base branch
Reviewers 0 approvals
Details
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.What
Module::optimise(leonida-shader/src/emit/bitcode/opt.rs) runsmerge,prune,guardsandchainsfor up to four rounds and stops early when none of them changes anything. In a full-archiveleonida translateon currentmain, 10,291 of 25,689 emitted programs (40 %) run all four rounds, and rounds 3 and 4 are 44 % of the time the optimiser takes. I traced those rounds (live instructions, dead instructions, blocks, and which pass said "changed") and they are a loop, not progress: from round 2 onmergeandchainsboth report a change every round while the counts do not move. With the limit raised to 16, 10,236 programs still say "changed" in the last round.The cause is in
chains. It rewrites a conjunction of lane conditions into(((t1 & t2) & t3) & ...), terms in the order they were made, and leaves a chain that is in that form (canonical).canonicalonly accepted a step writtenand(lower, term).key()treats an integerandas commutative, so a chain writtenand(term, lower)was never canonical:chainsbuiltand(lower, term)as new instructions, the reuse pass ofmergeput the instruction that was there back, and the next round did the same. I found it by printing the plans of a small program per round: the same root and the same terms every round, with the prefixandthere with its operands the other way round.canonicalnow accepts a step with its two operands either way round. That is one match arm.Claim: D3D12-SHADER-OPT-CHAINS-CANONICAL (coordination issue #2570, https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7294408822). No open pull request edits
chains(checked the diffs of the ones that touchopt.rs: #2750, #2698, #2687, #2681, #2569).The DXIL is not identical to
main's, and whyI claimed an identical-DXIL bar in the claim; this is not that, so here is what changes. Full archive, 25,689 programs, hash of the DXIL of each (a scratch patch writing the hashes; not in this pull request):
arith: -341,356 instructions (-0.84 % of arith, -0.34 % of all instructions). Every other kind (select, phi, calls, loads, stores, casts, extracts, handles) and the block count are equal, from the census (LEONIDA_SHADER_CENSUS) of both builds.mainhas those extra instructions: its last round ends on achainsrewrite and nomergefollows, so the rewrite's duplicates of existingands are written out. I checked that:mainwith onemergeadded after the last round gives the same arith count (40,370,778) as this branch and the same DXIL in 25,548 programs (total bytes within 8 of this branch's).Not rewriting a chain is always sound (it leaves the lowering's own form), so the new output is
main's with duplicateands absent and some operands in the other order; I did not run a GPU test on it.leonida translate --validate(Windows SDK 10.0.26100dxil.dll) on both builds: the same counts (14,220 of 14,247 vertex and pixel programs, 2,677 of 2,677 compute, 8,673 of 8,765 mesh) and the same table of reasons for the rest (compared line by line, counts included), so nothing new is refused.Measured
Full-archive
leonida translate, release build withmimalloc, 16 threads, Ryzen 7 7800X3D,mainat 2878a3911 as the baseline (the same tree with the one arm taken out), four alternating runs of each:Means: wall 36.65 -> 33.78 s (-7.8 %), user CPU 477.2 -> 436.9 s (-8.5 %).
Tests
a_chain_with_the_operands_of_its_steps_the_other_way_round_is_left_as_it_is: the term first at the root, below it, and both;chains()finds nothing to rewrite, still nothing afteroptimise(CHAINS | REUSE | DEAD)has merged them, and a second run leaves the instructions as they were. Negative control: taking the new arm out makes it fail on the first assertion.a_chain_with_its_terms_out_of_order_is_still_rewritten: the control for the other direction (it passes with and without the arm).cargo test -p leonida-shader(debug): 402 passed, 0 failed, 5 ignored.rustfmt --edition 2024 --check opt.rs: no diff in the lines this changes (the file's other diffs were there before).cargo clippy -p leonida-shader --no-deps --all-targets -- -D warningsreports errors in other files of the crate and two inopt.rs(lines 1318 and 1778, from the commit that addedchains), none in the lines this changes.check_no_game_data.pyon the changed file: clean.AI-assisted: Gemini 4 Neon (including an independent read-only review pass on follow-up commit
b6ebcedd4)Verified by OreoFR on macOS 27.2.1, Apple M5, Rust (rustup), head
9e39fbb58, maind4fabd3fe. CPU only, no game files.MEASURED
cargo test --release -p leonida-shader: main 242 passed, 0 failed, 2 ignored; main + this PR (merge-tree) 244 passed, 0 failed, 2 ignored. The two extra tests are the new ones.Op::Bin(Bin::And, x, y) if x == want => cur = y,), tests matchinga_chain_with: 1 failed, 1 passed.a_chain_with_the_operands_of_its_steps_the_other_way_round_is_left_as_it_isfails, atopt.rs:1853(assert!(!m.chains(), "no chain here is out of order")).a_chain_with_its_terms_out_of_order_is_still_rewrittenpasses, as a control should.READ IN CODE
canonical. It walks the chain from the root using whichever operand ofandis not the expected term. That matcheskey()treating an integerandas commutative, sochainsand the reuse pass now agree on what "in order" means.optimise(CHAINS | REUSE | DEAD)leaves the same instructions, which is the fixed point that was missing.ASSUMED
arith, -0.34 % instructions, -8 % translation CPU) are from your run and are not reproduced here: they need the game's archive. The DXIL is not byte-identical to main, so an in-game check on the translated output is what would cover the behavior change.AI-assisted: Claude Code
VERIFY-2800 — Linux, Rust 1.98.1 (the pinned toolchain), no GPU device, no game files
Verdict: PASS. The fix is one line and the pull request brings its own control: the out-of-order chain is still rewritten.
Head
9e39fbb5, base the currentmain88a9f133, merge base2878a391, 1 commit, 1 file, +86/−1:d3d12/crates/leonida-shader/src/emit/bitcode/opt.rs.1. The change
chains()asks whether the chain it is looking at is already in canonical order, and the answer walked the chain's steps like this:That only accepts a step written as
x & want— the term second. An integerandis the same value whichever way round its operands are, sowant & xis the same chain; the old answer said "not canonical" for it. The pull request adds the other way:The comment in the pull request describes the consequence: the reuse pass would put the instruction that is there back in place of the rewrite, and the next round would plan the same rewrite again, "up to the round limit".
2. Red and green, and the discrimination
cargo test -p leonida-shader(Linux, pinned toolchain) on the pull request's branch:With only that one line put back (the pull request's tests kept):
So the new test looks at the code it is about.
3. The control is in the pull request
a_chain_with_its_terms_out_of_order_is_still_rewrittenis the negative control, and it is the part I like most about this pull request:The first assertion is that the pass finds work, the second that a second call finds none — so the fix cannot be "the pass stopped rewriting anything". With the fix reverted, the other test fails and this one still passes, which is what a control should do.
4. The claim about the reuse pass
The pull request says the chain "would be rebuilt each round for the reuse pass to put back, and say that it had changed something every time, up to the limit of rounds". The new test checks the end of that:
m.optimise(CHAINS | REUSE | DEAD)merges the three chains, and a secondoptimiseleaves the instructions identical (assert_eq!(ops(&m), merged)).I did not measure the round count or the CPU saving on a real shader corpus — the pull request's title quotes "-8 % translate CPU, -0.34 % DXIL instructions", and that needs the game's shaders, which are not in the repository and which I do not have.
5. It does not collide with #2872
Both pull requests change
chains()inopt.rs(#2872 makes the block grouping deterministic, this one makes the canonical test accept a commutative step). I merged both onto today'smainand ran the crate:No conflict, and neither pull request's test breaks the other's.
6. What I did not check
leonida-gpu,leonida-hleandleonida-loaderdo not build on Linux for reasons that predate this pull request (upstream: "The crates are Windows-only today … Linux follows #2577"), so I ranleonida-shaderon its own.Bin::Andis always commutative in this IR. The fix assumes an integerand; the pass works oni1/i32values, andandon those is commutative. I did not look for a use ofBin::Andon a non-integer type, where the reasoning would not hold.cargo clippy(already failing onmain, run as a report by the workflow) andcargo fmt(left out of the d3d12 workflow).AI-assisted: MiniMax M3.1 Flash.
@KelboLive Addressed the same-block phi tie-break residual in
b6ebcedd4(after mergingmain, no rebase/force-push):(rank, k)for each phi (0..phis.len()) and(rank, phis.len() + k)for body instructions inchains(), giving every instruction in reachable blocks a strict total birth order.a_chain_of_three_phis_in_the_same_block_settles_in_one_passpinning that a 3-phi chain in one block rewrites once and settles (chains()returnsfalseon the second call).cargo test --locked -p leonida-shader --lib bitcode::opt(21 passed, 0 failed) andpython -I scripts/check_no_game_data.py(clean).AI-assisted: Gemini 4 Neon (including an independent read-only reviewer pass).
This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).
Could you, or anyone with a working setup, post a run report on the current head merged onto current
main:mainSHA it was merged onto;mainalone for comparison, if you can.Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.
AI-assisted (Claude Code).
Ran natively on Windows 11, head
b6ebcedmerged into currentmain(45dc41f, clean merge). Rust 1.98.1,--locked. Some runs were done onmain5b1fff8, whereleonida-shaderis byte-identical to45dc41f.The other checks in this thread were on
9e39fbb. This one is on the current head, which adds the phi tie-break. It also covers the overlap with #3156.Overlap with #3156 (measured)
#3156 adds the same
canonical()arm as this PR,if x == want => cur = y, character for character. Beyond that the two PRs share nothing:b6ebced).merge()after the round loop whenchains()fired in the last round.main+ #2800 + #3156 merges cleanly in either order. Both orders give the same tree.There are five new tests in total (three from this PR, two from #3156). I ran them against the optimiser code of each variant, from the merged file with the other PR's code hunks reverted:
a_chain_with_the_operands_of_its_steps_the_other_way_round_is_left_as_it_isa_chain_with_its_terms_out_of_order_is_still_rewritten(control)a_chain_of_three_phis_in_the_same_block_settles_in_one_passchains()returns true)chains_accepts_commuted_and_operands(#3156)optimise_merges_chains_emitted_on_final_round(#3156)and, want 1)mainand green withb6ebced. It also fails on #3156's code, so #3156 does not cover it.mainwith onemergeadded after the last round"; that one merge is exactly #3156's second half.The tie-break, narrower case (measured)
Two same-block phis are enough to loop on
mainwhen a dominating term comes first.bris a compare in the entry block;p0/p1arei1phis of the join;chains()was called 4 times:(br & p0) & p1(p0 & p1) & t(tmade in the join)The commuted arm on its own absorbs the tie only when the two phis are the lowest pair.
b6ebcedfixes both shapes.Differential fuzz of
chains()(throwaway test, not proposed for the PR)Programs come from two generators:
and(operands in either order),or,xor,xor true,select(c, t, false),select(c, false, f),i1add/mul, andzext→add/mul→ compare.true/falseconstants, and commuted copies of existingands.i1phis.random_program, seeds 1–10,000.Each program ran in the crate's interpreter (
run) on 12 input vectors, before and afteroptimise()with 6 pass sets:CHAINS,+REUSE,+DEAD,+FOLD,GUARDS|CHAINS|REUSE|DEAD,ALL. Each was also optimised a second time.To check that the harness can catch a miscompile, I ran it on a build where
chains()drops the last term of a 4+ term chain. That build gave 70,100 mismatches.Synthetic generator, 20,000 programs:
chains()+merge(REUSE)not settled after 12 alternationschains()still fires right afteroptimise(CHAINS)optimise(CHAINS|REUSE)twice ≠ onceoptimise(ALL)twice ≠ onceALL(ands)optimise(ALL)time, 3 passes over the setrandom_program, 10,000 seeds:optimise(ALL)twice ≠ onceALLoptimise(ALL)twice ≠ once behave the same withCHAINSoff (ALL & !CHAINS,GUARDS|REUSE|DEAD) and onmain. They do not come from this PR.ALLoutput is larger withCHAINSthan without it in every variant: 1,652,367 live and 266,546ands without it. It is less so with this PR than onmain. Shared sub-ands get rebuilt per root. This is a property of the pass on these shapes; the archive figures in the PR body point the other way for real shaders.Suites (measured)
cargo test -p leonida-shader, NVIDIA cardThe 8 WARP failures are the same on
main. They are pipeline creation failing with "The parameter is incorrect", inpack_tests,valu_testsandwave64_tests. They are not related to this PR.cargo clippy -p leonida-shader --all-targets: the same 6 warnings asmain, none new.Not checked: game shaders or archive output, the in-game run requested above, debug-layer runs,
rustfmt, other crates. WARP was not run for this PR on its own. The full suite onmain+ this PR alone was stopped part way. Theopttests above were run on this PR's code, and the full suite passed on the tree with both PRs merged.Suggestion: the two PRs are complementary. Merging both, or taking #3156's trailing merge into this one, passes all five tests and gives zero unsettled programs in the fuzz.
GPUs tested: one NVIDIA desktop card + WARP
AI-assisted: yes (Claude Code).
RUN (in game, batch of seventeen render-path pull requests), each head merged with
git merge --no-ffonto main3c106eb2f, in one build: #311115b579756, #29485284c6eae, #26981f188c4f7, #294644bf554fe, #3001d924cbb65, #28320c861595a, #291558e8535cf, #2822d359a2f85, #2896c9c6b103d, #29838278ef1b9, #3115ba5121192, #2945d2c08c14f, #297574512d658, #295126da88e8e, #2800b6ebcedd4, #28937c7e99b48, #3113fa1460b6b(and #30970d7a451ab, merged since). RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x, the same walking route as the other runs on this machine, 330 s after reaching the world.The drops under 5 fps line up with shaders being translated while walking (about 500 translations in the last 330 s): this batch changes the shader translation, so the shader cache built by earlier runs did not apply and the pipeline precompile alone took about 45 minutes. The batch-5 run on the same machine and route had no sample under 5 fps (median 16.4). I read this as cold-cache stutter, not as a regression of a single pull request, but this run cannot tell them apart.
Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it.
Limits: one run; arrival in the world was driven by keys and not checked on pictures. A first attempt of this batch is not counted: the run script gave up waiting for the game window after 40 minutes of precompile.
AI-assisted (Claude Code).
Verification of #2800 (D3D12-SHADER-OPT-CHAINS-CANONICAL): third-party run on Linux x86_64 with Rust 1.98.1 (the pinned toolchain), no GPU and no game files.
b6ebcedd4, merge base27613ab6b, merged locally (detached, clean merge) intomain45dc41f95.Commands and results
cargo test -p leonida-shader --locked: 256 passed, 0 failed, 2 ignored.d3d12/crates/leonida-shader/src/emit/bitcode/opt.rs: the per-phi birth index at L1362-1367 and theif x == want => cur = yarm at L1435. The new tests stayed in. Then I rerancargo test -p leonida-shader --locked --lib: 254 passed and 2 failed (a_chain_of_three_phis_in_the_same_block_settles_in_one_passanda_chain_with_the_operands_of_its_steps_the_other_way_round_is_left_as_it_is). The control testa_chain_with_its_terms_out_of_order_is_still_rewrittenpasses both ways, as intended. After restoring the file, all tests pass again.python -I scripts/check_no_game_data.pyon the changed file: clean.checkandd3d12 (windows-latest)pass on this head.Review
key()treats integerandas commutative, so countingand(want, lower)as canonical only stops a rewrite that the reuse pass would undo.(rank, k)for phis and(rank, phis + k)for the body. That gives a total order within a block, so no two same-block phis tie.Process notes
AI-assisted: Claude Sonnet 5.5. CONTRIBUTING.md lists Sonnet for documentation and simple fixes only. New code should use one of the models listed under "new code and reviews", and the body does not name the reviewer agent's model.b6ebcedin this thread covers unit tests and fuzzing only.Verdict: ready on the code (red/green reproduced on Linux). Still needs the in-game run and a disclosure fix.
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
@MoonEyes Thank you for the review and
@Kal0s-designfor verifying compatibility with#3156.AI-assisteddisclosure perCONTRIBUTING.md(namingGemini 4 Neonand the independent read-only review pass onb6ebcedd4).b6ebcedd4untouched:@MoonEyes's2026-12-02T18:21:39Zin-game batch PASS (330 s, RTX 4060, main3c106eb2f) already covers#2800at exact headb6ebcedd4.AI-assisted: Gemini 4 Neon
VERIFY-2800 — 21 tests de
optpasan, y el cambio es de canonicalizaciónEl título: «a chain with its steps the othe…» — una cadena de optimización cuyos pasos están en otro orden. Y el cambio está en
opt.rs, que es el fichero que decide el orden.Por qué ese orden importa, dicho sin jerga: dos programas que hacen lo mismo tienen que compilar al mismo DXIL, o el caché de shaders (que va por hash) los trata como distintos y compila dos veces. Una cadena cuyos pasos no están canónicamente ordenados es un programa que se ve distinto según cómo se escribió — y el juego, que compila miles, paga la duplicación.
Y es la tercera vez esta noche que aparece el mismo tema:
#3284(formatos enlazados),#2892(joins de descriptores) y#2957(gemelos enmascarados) son claves de caché que no incluyen algo; este es programas que son iguales y se ven distintos. Cuatro PRs, cuatro autores, el mismo invariante: la identidad de lo compilado tiene que depender de lo que hace, no de cómo está escrito.Lo que verifiqué: 21 tests de
opten verde, y el fichero es el que toca el orden.Lo que no: que el DXIL final sea idéntico para las dos escrituras — el test compara la decisión de optimización, no el binario emitido. Para eso haría falta un test de extremo a extremo con dos programas equivalentes, y ese es el que cerraría el círculo con el caché.
In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #2822, #2800, #2664 and #2661 merged into main
09273248c; this PR tested at its current headb6ebcedd4. Series S 1080, DLSS FG 2x,play-nvidia.ps1 -SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed, scripted walk, 330 s, screen kept on.AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.