fix(d3d12): Isolate AMD buffer size query handles #2698

Open
Geovannisz wants to merge 3 commits from upstream-pr/2698 into main
Geovannisz commented 2026-11-30 05:15:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Geovannisz on 2026-11-30T05:15:50Z.


Claimed in the coordination issue as D3D12-RDNA4-BUFFER-SIZE-HANDLE.

What and why

On my RX 9070 XT, AMD's DXIL compiler faults during compute pipeline creation. LEONIDA_SEPARATE_SIZE_HANDLES=1 makes the native translator emit a dedicated heap handle for buffer-size queries. The reuse pass keeps it separate from memory-access handles. Dead-code removal can still discard unused queries. Both handles address the same view.

The setting is opt-in and participates in the translation-cache fingerprint. The README explains activation and retrying keys recorded as bad by an earlier warm run. The native translator contract is documented in docs/design.md.

This adapts imjustprism's approach in Marvisak/VIctory#2122 to Mandy's lowering and optimiser. It is independent of #2694, which serializes concurrent driver calls. My reproducer uses one pipeline per fresh process.

Compatibility with #2687's handle hoisting was checked in the current main source. The hoist_handles eligibility check accepts only uniform createHandleFromHeap calls. This workaround emits dedicated size-query handles with the non-uniform flag set, so they are excluded from that pass. KelboLive independently tested the merged tree and reported passing regression and waterfall/descriptor subsets.

Tested

MEASURED locally. Profile M, Radeon RX 9070 XT 16 GB desktop, driver 32.0.32029.2010, Windows 11 build 26300, Rust 1.98.1, MSVC x64.

  • Baseline main at 1d22590 reproduced the access violation on two previously failing compute pipelines, individually in fresh processes.
  • PR implementation at 950fea2, same binary and settings for both arms. With LEONIDA_SEPARATE_SIZE_HANDLES=0, both selected pipelines faulted. With the setting at 1, all 22 previously failing pipelines compiled, with zero refusals and zero worker crashes.
  • An earlier local build using this approach precompiled 1,475 previously used pipelines with zero refusals and zero worker crashes. These earlier numbers are separate from the pinned PR A/B.
  • The synthetic buffer_size_handles_are_kept_separate_when_reusing_values regression fails against main's optimiser with only the test and marker declarations transplanted, and passes with the fix. It checks access-handle reuse, size-handle separation and removal of unused queries.
  • All 10 descriptor-size tests pass on WARP. A standalone native structured-buffer readback test still faults with either setting. Its native failure is unresolved.
  • Full leonida-shader library suite on WARP, opt-in enabled, one test thread. Main: 362 passed, 8 failed, 4 ignored. PR: 363 passed, the identical 8 failures, 4 ignored. The added regression passes. Existing waterfall tests retain readback and wave checks and account separately for temporary size-query handles.
  • Final head 1f188c4 builds with cargo build --locked --profile diag -p leonida --features diagnostics,mimalloc. Changed-file game-data check and git diff --check pass.
  • cargo xtask policy reports the same two pre-existing oversized files on main and this branch (leonida-gpu/src/host.rs and leonida-shader/src/emit/lower.rs). The latter grows with this patch. This policy failure remains outstanding.
  • Offline compilation and WARP checks do not establish gameplay stability or visual equivalence.

GPUs tested: AMD Radeon RX 9070 XT, driver 32.0.32029.2010, Windows 11 build 26300. WARP used for synthetic readback tests.

AI-assisted: OpenAI Codex. The hardware and crash report are mine. The commit author is Geovanni (@Geovannisz), with Codex assistance recorded and prior VIctory work credited.

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • Changed files pass scripts/check_no_game_data.py.
  • Native translator contract and opt-in setting documented.
  • Synthetic regression fails on the baseline optimiser and passes with the patch.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5559448129 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698). Originally posted by [Geovannisz](https://github.com/Geovannisz) on 2026-11-30T05:15:50Z. --- Claimed in the coordination issue as [D3D12-RDNA4-BUFFER-SIZE-HANDLE](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7269341085). ### What and why On my RX 9070 XT, AMD's DXIL compiler faults during compute pipeline creation. LEONIDA_SEPARATE_SIZE_HANDLES=1 makes the native translator emit a dedicated heap handle for buffer-size queries. The reuse pass keeps it separate from memory-access handles. Dead-code removal can still discard unused queries. Both handles address the same view. The setting is opt-in and participates in the translation-cache fingerprint. The README explains activation and retrying keys recorded as bad by an earlier warm run. The native translator contract is documented in docs/design.md. This adapts imjustprism's approach in [Marvisak/VIctory#2122](https://github.com/Marvisak/VIctory/pull/2122) to Mandy's lowering and optimiser. It is independent of #2694, which serializes concurrent driver calls. My reproducer uses one pipeline per fresh process. Compatibility with #2687's handle hoisting was checked in the current main source. The hoist_handles eligibility check accepts only uniform createHandleFromHeap calls. This workaround emits dedicated size-query handles with the non-uniform flag set, so they are excluded from that pass. KelboLive independently tested the merged tree and reported passing regression and waterfall/descriptor subsets. ### Tested MEASURED locally. Profile M, Radeon RX 9070 XT 16 GB desktop, driver 32.0.32029.2010, Windows 11 build 26300, Rust 1.98.1, MSVC x64. - Baseline main at 1d22590 reproduced the access violation on two previously failing compute pipelines, individually in fresh processes. - PR implementation at 950fea2, same binary and settings for both arms. With LEONIDA_SEPARATE_SIZE_HANDLES=0, both selected pipelines faulted. With the setting at 1, all 22 previously failing pipelines compiled, with zero refusals and zero worker crashes. - An earlier local build using this approach precompiled 1,475 previously used pipelines with zero refusals and zero worker crashes. These earlier numbers are separate from the pinned PR A/B. - The synthetic buffer_size_handles_are_kept_separate_when_reusing_values regression fails against main's optimiser with only the test and marker declarations transplanted, and passes with the fix. It checks access-handle reuse, size-handle separation and removal of unused queries. - All 10 descriptor-size tests pass on WARP. A standalone native structured-buffer readback test still faults with either setting. Its native failure is unresolved. - Full leonida-shader library suite on WARP, opt-in enabled, one test thread. Main: 362 passed, 8 failed, 4 ignored. PR: 363 passed, the identical 8 failures, 4 ignored. The added regression passes. Existing waterfall tests retain readback and wave checks and account separately for temporary size-query handles. - Final head 1f188c4 builds with cargo build --locked --profile diag -p leonida --features diagnostics,mimalloc. Changed-file game-data check and git diff --check pass. - cargo xtask policy reports the same two pre-existing oversized files on main and this branch (leonida-gpu/src/host.rs and leonida-shader/src/emit/lower.rs). The latter grows with this patch. This policy failure remains outstanding. - Offline compilation and WARP checks do not establish gameplay stability or visual equivalence. GPUs tested: AMD Radeon RX 9070 XT, driver 32.0.32029.2010, Windows 11 build 26300. WARP used for synthetic readback tests. AI-assisted: OpenAI Codex. The hardware and crash report are mine. The commit author is Geovanni (@Geovannisz), with Codex assistance recorded and prior VIctory work credited. ### Checklist - [x] Based on current main and merges cleanly. - [x] One topic. - [x] Changed files pass scripts/check_no_game_data.py. - [x] Native translator contract and opt-in setting documented. - [x] Synthetic regression fails on the baseline optimiser and passes with the patch.
copilot-pull-request-reviewer[bot] commented 2026-11-30 05:41:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-30T05:41:55Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6107370705 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#pullrequestreview-6107370705). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-30T05:41:55Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level. An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. [Learn about Copilot code review billing](https://docs.github.com/en/copilot/concepts/agents/code-review#code-review-usage).
Kal0s-design commented 2026-11-30 13:17:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-11-30T13:17:38Z.


Cross-vendor check on Windows of 1f188c4f7 on current main f9f3ec4c6 (merges without conflict, 82867d471). Native Windows 11, MSVC x64, Rust 1.98.1, full cargo test -p leonida-shader --lib on a hardware GPU that isn't AMD (not WARP), so the DXIL is validated and the dispatches/readbacks run on a second vendor's driver.

  • LEONIDA_SEPARATE_SIZE_HANDLES unset: 386 passed, 0 failed, 4 ignored.
  • LEONIDA_SEPARATE_SIZE_HANDLES=1: 386 passed, 0 failed, 4 ignored, including the waterfall tests with their separate size-query handles and the 10 descriptor-size tests.
  • main lists 389 tests (385 run + 4 ignored); the merge lists 390, so the only addition is buffer_size_handles_are_kept_separate_when_reusing_values.

So on this driver the opt-in changes no result, and leaving it off changes nothing either. That fits it being a workaround for the AMD compiler only. The 8 WARP-only failures in the description don't appear on hardware here in either mode. I can't reproduce the AMD fault itself, nor the standalone structured-buffer readback case.

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7279634382 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7279634382). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-11-30T13:17:38Z. --- **Cross-vendor check on Windows** of `1f188c4f7` on current `main` `f9f3ec4c6` (merges without conflict, `82867d471`). Native Windows 11, MSVC x64, Rust 1.98.1, full `cargo test -p leonida-shader --lib` on a hardware GPU that isn't AMD (not WARP), so the DXIL is validated and the dispatches/readbacks run on a second vendor's driver. - `LEONIDA_SEPARATE_SIZE_HANDLES` unset: 386 passed, 0 failed, 4 ignored. - `LEONIDA_SEPARATE_SIZE_HANDLES=1`: 386 passed, 0 failed, 4 ignored, including the waterfall tests with their separate size-query handles and the 10 descriptor-size tests. - `main` lists 389 tests (385 run + 4 ignored); the merge lists 390, so the only addition is `buffer_size_handles_are_kept_separate_when_reusing_values`. So on this driver the opt-in changes no result, and leaving it off changes nothing either. That fits it being a workaround for the AMD compiler only. The 8 WARP-only failures in the description don't appear on hardware here in either mode. I can't reproduce the AMD fault itself, nor the standalone structured-buffer readback case. AI-assisted: yes
merzleckeier commented 2026-11-30 13:38:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T13:38:25Z.


Independent size-handle and cache-key check under Wine. 1f188c4f merged onto f9f3ec4c6 (tree 3a86abcd). Windows x64 MSVC-target Rust 1.98.1, Wine 11.22, and VKD3D-Proton 3.1.0 (0bb64c56c8f0dcc). Radeon 610M (RADV 26.3.1) and RTX 4070 SUPER (620.73.04), using the DXIL validator from DXC v1.8.2505.1.

MEASURED. One fresh process per mode per GPU compiled the synthetic structured-buffer count plus indexed-load fixture. DXC disassembly shows that unset and =0 emit byte-identical DXIL and share one SRV handle between getDimensions and rawBufferLoad. With =1, getDimensions uses a dedicated non-uniform handle and rawBufferLoad uses its separate handle. Both use the same descriptor index and resource properties. The emitted census was 3/3/4 total handles with 1 size query, 1 load, and 2 stores in every mode.

All six hardware runs returned [3, 77] and [5, 0x1234abcd] for the two input buffers. The production translation fingerprint returned distinct bytes for unset, 0, and 1. The only difference was the switch value in its environment record. The initial artifact reused a stale Cargo build-script output from a prior checkout. These results use a regenerated switch list.

The focused size, waterfall, and optimizer selection on each GPU was 15 passed / 1 failed on main and 16 passed / 1 failed with the PR in both settings. The added optimizer regression passed. The existing NaN-scrub R32_UINT failure showed the same result on main and PR within each GPU. All six full-suite runs exited with status 3 while first_half_values_render_on_hardware_and_warp was active.

Synthetic translation and Wine readback coverage. A second agent checked the raw results. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7280137037 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7280137037). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T13:38:25Z. --- **Independent size-handle and cache-key check under Wine.** `1f188c4f` merged onto `f9f3ec4c6` (tree `3a86abcd`). Windows x64 MSVC-target Rust 1.98.1, Wine 11.22, and VKD3D-Proton 3.1.0 (`0bb64c56c8f0dcc`). Radeon 610M (RADV 26.3.1) and RTX 4070 SUPER (620.73.04), using the DXIL validator from [DXC v1.8.2505.1](https://github.com/microsoft/DirectXShaderCompiler/releases/tag/v1.8.2505.1). **MEASURED.** One fresh process per mode per GPU compiled the synthetic structured-buffer count plus indexed-load fixture. DXC disassembly shows that unset and `=0` emit byte-identical DXIL and share one SRV handle between `getDimensions` and `rawBufferLoad`. With `=1`, `getDimensions` uses a dedicated non-uniform handle and `rawBufferLoad` uses its separate handle. Both use the same descriptor index and resource properties. The emitted census was 3/3/4 total handles with 1 size query, 1 load, and 2 stores in every mode. All six hardware runs returned `[3, 77]` and `[5, 0x1234abcd]` for the two input buffers. The production translation fingerprint returned distinct bytes for unset, `0`, and `1`. The only difference was the switch value in its environment record. The initial artifact reused a stale Cargo build-script output from a prior checkout. These results use a regenerated switch list. The focused size, waterfall, and optimizer selection on each GPU was 15 passed / 1 failed on `main` and 16 passed / 1 failed with the PR in both settings. The added optimizer regression passed. The existing NaN-scrub `R32_UINT` failure showed the same result on main and PR within each GPU. All six full-suite runs exited with status 3 while `first_half_values_render_on_hardware_and_warp` was active. Synthetic translation and Wine readback coverage. A second agent checked the raw results. AI-assisted.
KelboLive commented 2026-12-01 15:32:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T15:32:05Z.

Review: COMMENTED


Verified 1f188c4f with an own target dir: cargo test -p leonida-shader with LEONIDA_SEPARATE_SIZE_HANDLES=1 gives 371 passed / 0 failed / 4 ignored, and the waterfall (22) and descriptor (21) subsets pass with the switch both on and unset. The separation is genuinely tested: deleting the Tag::SizeHandle guard in opt.rs:919 makes the new regression fail with the size query merged into the memory-access handle ([[Inst(0), Inst(0)]] vs [[Inst(0), Inst(1)]]), and the dead-query case still drops (body == 3 after REUSE | DEAD).

The mechanism is right: the buffer getDimensions path takes a fresh handle only for buffers with separate_size_handles() (lower.rs:8296-8306, :1662-1667), built from the same index and props as the access handle, and the tag is attached to createHandleFromHeap (shader.rs:682-684) and preserved in bitcode.rs:397-402 even with the census off, so it can neither be reused nor absorb a later access. The fingerprint claim checks out too: the build script's switch list contains the name and translation_fingerprint() hashes its value.

git merge-tree against current main is clean, and on the merged tree the regression plus the waterfall/descriptor subsets pass. The branch is now 1027 commits behind and main has gained #2687's hoist_handles; that pass only hoists uniform createHandleFromHeap calls, and these handles are emitted non-uniform, so the contract still holds — worth a sentence in the body so the interaction is on record.

One nit: tag == Tag::SizeHandle || census::enabled() in bitcode.rs:399 would read better as a Tag::needed_without_census() predicate, so the next optimisation tag does not have to edit that condition. The AMD amdxc64.dll fault and the 22-pipeline result cannot be reproduced here (no RX 9070 XT, no game data); the DXIL-level evidence above is what this machine can check.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6134453526 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#pullrequestreview-6134453526). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T15:32:05Z. **Review:** COMMENTED --- Verified `1f188c4f` with an own target dir: `cargo test -p leonida-shader` with `LEONIDA_SEPARATE_SIZE_HANDLES=1` gives **371 passed / 0 failed / 4 ignored**, and the waterfall (22) and descriptor (21) subsets pass with the switch both on and unset. The separation is genuinely tested: deleting the `Tag::SizeHandle` guard in `opt.rs:919` makes the new regression fail with the size query merged into the memory-access handle (`[[Inst(0), Inst(0)]]` vs `[[Inst(0), Inst(1)]]`), and the dead-query case still drops (`body == 3` after `REUSE | DEAD`). The mechanism is right: the buffer `getDimensions` path takes a fresh handle only for buffers with `separate_size_handles()` (`lower.rs:8296-8306`, `:1662-1667`), built from the same index and props as the access handle, and the tag is attached to `createHandleFromHeap` (`shader.rs:682-684`) and preserved in `bitcode.rs:397-402` even with the census off, so it can neither be reused nor absorb a later access. The fingerprint claim checks out too: the build script's switch list contains the name and `translation_fingerprint()` hashes its value. `git merge-tree` against current main is clean, and on the merged tree the regression plus the waterfall/descriptor subsets pass. The branch is now 1027 commits behind and main has gained #2687's `hoist_handles`; that pass only hoists uniform `createHandleFromHeap` calls, and these handles are emitted non-uniform, so the contract still holds — worth a sentence in the body so the interaction is on record. One nit: `tag == Tag::SizeHandle || census::enabled()` in `bitcode.rs:399` would read better as a `Tag::needed_without_census()` predicate, so the next optimisation tag does not have to edit that condition. The AMD `amdxc64.dll` fault and the 22-pipeline result cannot be reproduced here (no RX 9070 XT, no game data); the DXIL-level evidence above is what this machine can check.
Geovannisz commented 2026-12-01 17:01:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Geovannisz on 2026-12-01T17:01:20Z.


Thanks @KelboLive for the independent verification and for checking the regression by removing its guard. I added the interaction with #2687's hoist_handles pass to the PR description after checking the current main source. The dedicated handles carry the non-uniform flag, which excludes them from its uniform-handle eligibility check.

Your Tag::needed_without_census() suggestion is noted as a readability improvement. The RX 9070 XT measurements remain scoped to the pinned offline A/B and the earlier warm run described in the PR.

AI-assisted: OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7318622774 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7318622774). Originally posted by [Geovannisz](https://github.com/Geovannisz) on 2026-12-01T17:01:20Z. --- Thanks @KelboLive for the independent verification and for checking the regression by removing its guard. I added the interaction with #2687's hoist_handles pass to the PR description after checking the current main source. The dedicated handles carry the non-uniform flag, which excludes them from its uniform-handle eligibility check. Your Tag::needed_without_census() suggestion is noted as a readability improvement. The RX 9070 XT measurements remain scoped to the pinned offline A/B and the earlier warm run described in the PR. AI-assisted: OpenAI Codex.
MoonEyes commented 2026-12-02 12:24:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:24:47Z.


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:

  • the head SHA and the main SHA it was merged onto;
  • GPU, driver and OS;
  • at least 300 s in the world after loading;
  • device lost / crashes (count), and rendered fps (median) if you have them;
  • the same run on main alone 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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345300557 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7345300557). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:24:47Z. --- 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`: - the head SHA and the `main` SHA it was merged onto; - GPU, driver and OS; - at least 300 s in the world after loading; - device lost / crashes (count), and rendered fps (median) if you have them; - the same run on `main` alone 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).
MoonEyes commented 2026-12-02 18:01:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:01:24Z.


Verified on Linux: head 1f188c4f7 merged into current main 45dc41f95 (clean merge of 7 auto-merged files; throwaway tree). The shader crate's portable tests pass on the merge, and the new test fails without the fix.

merge base 1d22590b9 (1,211 commits behind main)
cd d3d12 && cargo test -p leonida-shader --lib --locked        (Rust 1.98.1, x86_64-unknown-linux-gnu)
  test result: ok. 254 passed; 0 failed; 2 ignored
  emit::bitcode::opt::tests::buffer_size_handles_are_kept_separate_when_reusing_values ... ok
  emit::lower::tests::waterfall_loops_over_* (the two adjusted waterfall tests) ... ok

On Linux the crate runs 254 of its tests; the DXIL-validator and device tests are #[cfg(windows)] and did not run here. The Windows runs in this thread (@Kal0s-design, @merzleckeier) were on f9f3ec4c6 (main of 2026-11-30); this is the first run I know of on a merge with current main, so it shows the old branch still composes with today's optimiser (FxHash maps, hoist_handles) at least on the portable tests.

Red/green (source reverted on the same merge): deleting only the new guard in emit/bitcode/opt.rs (&& self.tags.get(&i) != Some(&super::Tag::SizeHandle), line 1146 on the merge):

test emit::bitcode::opt::tests::buffer_size_handles_are_kept_separate_when_reusing_values ... FAILED
  left: [[Inst(0), Inst(0)]]
 right: [[Inst(0), Inst(1)]]

So the test pins exactly the reuse it is meant to prevent.

Review notes

  • Opt-in (LEONIDA_SEPARATE_SIZE_HANDLES=1), so default translations are unchanged. The switch is a quoted "LEONIDA_*" literal in leonida-shader, so build.rs puts it in LEONIDA_SHADER_SWITCHES and the shader cache key (translation_fingerprint) changes with it; a cached translation made without it is not served with it on.
  • Module::tag now records Tag::SizeHandle even when the census is off (the optimiser reads it). Only that tag escapes the census gate, so the census-off cost is one map insert per buffer size query with the switch on.
  • heap_handle_at's (index, bounded) tuple plus a new trailing separate: bool makes three adjacent bool parameters (sampler, nonuniform, separate); easy to transpose at a call site. A small struct or enum would be safer, but it is not a defect today: all call sites were updated and the tests pass.
  • docs/design.md gets a new "Native D3D12 translator contract" table with this rule and how it was confirmed (synthetic test plus RX 9070 XT pipeline creation), as AGENTS.md asks.

The in-game gate @MoonEyes asked for (render path, current head merged on current main) is still open, and only an RDNA 4 machine can confirm the switch prevents the reported compiler fault. CI on the head is at action_required.

Verdict: ready for the code (opt-in, red/green shown on a current merge); blocked on the requested in-game run and CI approval before merge.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353869388 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7353869388). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:01:24Z. --- **Verified on Linux: head `1f188c4f7` merged into current `main` `45dc41f95` (clean merge of 7 auto-merged files; throwaway tree). The shader crate's portable tests pass on the merge, and the new test fails without the fix.** ``` merge base 1d22590b9 (1,211 commits behind main) cd d3d12 && cargo test -p leonida-shader --lib --locked (Rust 1.98.1, x86_64-unknown-linux-gnu) test result: ok. 254 passed; 0 failed; 2 ignored emit::bitcode::opt::tests::buffer_size_handles_are_kept_separate_when_reusing_values ... ok emit::lower::tests::waterfall_loops_over_* (the two adjusted waterfall tests) ... ok ``` On Linux the crate runs 254 of its tests; the DXIL-validator and device tests are `#[cfg(windows)]` and did not run here. The Windows runs in this thread (@Kal0s-design, @merzleckeier) were on `f9f3ec4c6` (`main` of 2026-11-30); this is the first run I know of on a merge with current `main`, so it shows the old branch still composes with today's optimiser (FxHash maps, `hoist_handles`) at least on the portable tests. **Red/green (source reverted on the same merge):** deleting only the new guard in `emit/bitcode/opt.rs` (`&& self.tags.get(&i) != Some(&super::Tag::SizeHandle)`, line 1146 on the merge): ``` test emit::bitcode::opt::tests::buffer_size_handles_are_kept_separate_when_reusing_values ... FAILED left: [[Inst(0), Inst(0)]] right: [[Inst(0), Inst(1)]] ``` So the test pins exactly the reuse it is meant to prevent. **Review notes** - Opt-in (`LEONIDA_SEPARATE_SIZE_HANDLES=1`), so default translations are unchanged. The switch is a quoted `"LEONIDA_*"` literal in `leonida-shader`, so `build.rs` puts it in `LEONIDA_SHADER_SWITCHES` and the shader cache key (`translation_fingerprint`) changes with it; a cached translation made without it is not served with it on. - `Module::tag` now records `Tag::SizeHandle` even when the census is off (the optimiser reads it). Only that tag escapes the census gate, so the census-off cost is one map insert per buffer size query with the switch on. - `heap_handle_at`'s `(index, bounded)` tuple plus a new trailing `separate: bool` makes three adjacent `bool` parameters (`sampler`, `nonuniform`, `separate`); easy to transpose at a call site. A small struct or enum would be safer, but it is not a defect today: all call sites were updated and the tests pass. - `docs/design.md` gets a new "Native D3D12 translator contract" table with this rule and how it was confirmed (synthetic test plus RX 9070 XT pipeline creation), as AGENTS.md asks. The in-game gate @MoonEyes asked for (render path, current head merged on current `main`) is still open, and only an RDNA 4 machine can confirm the switch prevents the reported compiler fault. CI on the head is at `action_required`. **Verdict: ready** for the code (opt-in, red/green shown on a current merge); blocked on the requested in-game run and CI approval before merge. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-12-02 18:21:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:21:16Z.


RUN (in game, batch of seventeen render-path pull requests), each head merged with git merge --no-ff onto main 3c106eb2f, in one build: #3111 15b579756, #2948 5284c6eae, #2698 1f188c4f7, #2946 44bf554fe, #3001 d924cbb65, #2832 0c861595a, #2915 58e8535cf, #2822 d359a2f85, #2896 c9c6b103d, #2983 8278ef1b9, #3115 ba5121192, #2945 d2c08c14f, #2975 74512d658, #2951 26da88e8e, #2800 b6ebcedd4, #2893 7c7e99b48, #3113 fa1460b6b (and #3097 0d7a451ab, 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.

What Result
Device lost / device removed 0
Exceptions, panics, hang watchdog, GPU stall, title suspended 0
Process alive at the end yes, stopped by the time limit
Rendered fps, last 240 s (43 samples) median 14.6, mean 12.7
Rendered fps, last 120 s median 13.7
Time under 5 fps in the world 13 % (short drops, lowest sample 0.3 fps)

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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354431391 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7354431391). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:21:16Z. --- RUN (in game, batch of seventeen render-path pull requests), each head merged with `git merge --no-ff` onto main `3c106eb2f`, in one build: #3111 `15b579756`, #2948 `5284c6eae`, #2698 `1f188c4f7`, #2946 `44bf554fe`, #3001 `d924cbb65`, #2832 `0c861595a`, #2915 `58e8535cf`, #2822 `d359a2f85`, #2896 `c9c6b103d`, #2983 `8278ef1b9`, #3115 `ba5121192`, #2945 `d2c08c14f`, #2975 `74512d658`, #2951 `26da88e8e`, #2800 `b6ebcedd4`, #2893 `7c7e99b48`, #3113 `fa1460b6b` (and #3097 `0d7a451ab`, 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. | What | Result | |---|---| | Device lost / device removed | 0 | | Exceptions, panics, hang watchdog, GPU stall, title suspended | 0 | | Process alive at the end | yes, stopped by the time limit | | Rendered fps, last 240 s (43 samples) | median 14.6, mean 12.7 | | Rendered fps, last 120 s | median 13.7 | | Time under 5 fps in the world | 13 % (short drops, lowest sample 0.3 fps) | 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).
Cody-Lincoln commented 2026-12-03 03:21:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Cody-Lincoln on 2026-12-03T03:21:00Z.


Game-run test, second RX 9070 XT (driver 32.0.32029.2010, Windows 11 26200), diag profile: main at 9b4d71899 baseline vs this branch at 1f188c4f7, default launcher settings plus -More @{LEONIDA_SEPARATE_SIZE_HANDLES='1'} (new translation fingerprint, as the README notes).

  • Baseline here: every start after the drawn-pipeline book existed faulted at frame 0 (Game Init) in amdxc64.dll+0x861b9f (read 0x8); leonida warm had ended 19-27 worker processes with the same exception (pipelines/warm-bad.txt, 27 keys). The one start made with an empty book reached the world and died at frame 9025, same instruction.
  • With the switch: 25,689 shaders retranslated, 3,529 drawn pipelines compiled in 99 s, 0 ended their process, warm-bad empty; the title got past its frame-0 fault and into the intro cutscene.
  • That run later ended with the runtime's own host GPU failure … E_OUTOFMEMORY (0x8007000E) closing a command list — a ~30 GB resident local-LLM process on the same 64 GB PC; a clean run with it closed follows. Not attributable to this change.

One observation for scope: on this card the frame-0 fault followed a host pipeline shaders=[vertex, pixel] log line (the create that faulted was not compute), yet with the switch warm compiled all drawn pipelines with zero faults — so the size-handle shape appears to reach the graphics path here too, not only compute.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7366468933 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7366468933). Originally posted by [Cody-Lincoln](https://github.com/Cody-Lincoln) on 2026-12-03T03:21:00Z. --- Game-run test, second RX 9070 XT (driver 32.0.32029.2010, Windows 11 26200), `diag` profile: `main` at `9b4d71899` baseline vs this branch at `1f188c4f7`, default launcher settings plus `-More @{LEONIDA_SEPARATE_SIZE_HANDLES='1'}` (new translation fingerprint, as the README notes). - Baseline here: every start after the drawn-pipeline book existed faulted at frame 0 (`Game Init`) in `amdxc64.dll+0x861b9f` (`read 0x8`); `leonida warm` had ended 19-27 worker processes with the same exception (`pipelines/warm-bad.txt`, 27 keys). The one start made with an empty book reached the world and died at frame 9025, same instruction. - With the switch: 25,689 shaders retranslated, 3,529 drawn pipelines compiled in 99 s, `0 ended their process`, warm-bad empty; the title got past its frame-0 fault and into the intro cutscene. - That run later ended with the runtime's own `host GPU failure … E_OUTOFMEMORY (0x8007000E)` closing a command list — a ~30 GB resident local-LLM process on the same 64 GB PC; a clean run with it closed follows. Not attributable to this change. One observation for scope: on this card the frame-0 fault followed a `host pipeline shaders=[vertex, pixel]` log line (the create that faulted was not compute), yet with the switch warm compiled all drawn pipelines with zero faults — so the size-handle shape appears to reach the graphics path here too, not only compute.
fiestorra commented 2026-12-03 03:56:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T03:56:09Z.


VERIFY-2698 — y aquí hay un test que falla en el head, no una falla de esta máquina

Ocho ficheros, +90/−16, ocho días abierto. La suite del crate que toca:

cargo test -p leonida-shader --lib
  370 passed; 1 failed; 4 ignored
  FAILED: emit::valu_tests::rdna_forms_give_what_the_spelled_out_ones_give
          assertion `left != right` failed: mad_legacy: written alike

Y esta no es la de la iGPU: leonida-shader en main está en 429 pasados y 0 fallados (lo medí en la línea base de esta noche), y este crate no hace nada con adaptadores. Es un test de valores: una forma RDNA y su forma escrita a mano deberían dar diferencias distintas de cero y dan lo mismo — mad_legacy: written alike es el mensaje que el propio test escribe cuando las dos representaciones coinciden.

Lo que eso significa, sin adornos: con este cambio, la forma mad_legacy se compila igual que la escrita a mano, que es exactamente lo que el test está ahí para impedir — y el PR toca bitcode.rs, opt.rs, lower.rs y shader.rs, que es donde se decide cómo se emite una instrucción.

Lo que no puedo decir: si el fallo lo introduce este PR o si ya estaba en su base. Su base es de hace ocho días y main ha recibido cambios en emit/ desde entonces (#3197 está abierto tocando bitcode.rs y lower.rs), así que la comparación honesta es la que hice: en main hoy el test pasa; en su head, falla.

Y lo que no voy a hacer: decidir cuál de los dos está bien. mad_legacy es una instrucción de AMD con multiplicación y suma fundidas; si el emisor la está plegando a la forma canónica, el test puede estar pidiendo lo imposible, o el emisor puede estar perdiendo la forma que mad_legacy necesita. Eso es del autor, y con el mensaje del test delante lo puede ver en un minuto.

Lo que sí verifiqué: cargo test -p leonida-shader --lib en su head, que es un comando y un número, y el nombre del test que falla. Todo lo demás de este comentario es lectura del mensaje.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7367090028 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7367090028). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T03:56:09Z. --- ## VERIFY-2698 — y aquí hay un test que **falla en el head**, no una falla de esta máquina **Ocho ficheros, +90/−16, ocho días abierto.** **La suite del crate que toca**: ``` cargo test -p leonida-shader --lib 370 passed; 1 failed; 4 ignored FAILED: emit::valu_tests::rdna_forms_give_what_the_spelled_out_ones_give assertion `left != right` failed: mad_legacy: written alike ``` **Y esta no es la de la iGPU**: **`leonida-shader` en `main` está en 429 pasados y 0 fallados** (**lo medí en la línea base de esta noche**), **y este crate no hace nada con adaptadores**. **Es un test de valores: una forma RDNA y su forma escrita a mano deberían dar diferencias distintas de cero y dan lo mismo** — **`mad_legacy: written alike` es el mensaje que el propio test escribe cuando las dos representaciones coinciden.** **Lo que eso significa, sin adornos**: **con este cambio, la forma `mad_legacy` se compila igual que la escrita a mano**, **que es exactamente lo que el test está ahí para impedir** — **y el PR toca `bitcode.rs`, `opt.rs`, `lower.rs` y `shader.rs`, que es donde se decide cómo se emite una instrucción.** **Lo que no puedo decir**: **si el fallo lo introduce este PR o si ya estaba en su base.** **Su base es de hace ocho días y `main` ha recibido cambios en `emit/` desde entonces** (**`#3197` está abierto tocando `bitcode.rs` y `lower.rs`**), **así que la comparación honesta es la que hice: en `main` hoy el test pasa; en su head, falla.** **Y lo que no voy a hacer**: **decidir cuál de los dos está bien.** **`mad_legacy` es una instrucción de AMD con multiplicación y suma fundidas; si el emisor la está plegando a la forma canónica, el test puede estar pidiendo lo imposible, o el emisor puede estar perdiendo la forma que `mad_legacy` necesita.** **Eso es del autor, y con el mensaje del test delante lo puede ver en un minuto.** **Lo que sí verifiqué**: **`cargo test -p leonida-shader --lib` en su head, que es un comando y un número, y el nombre del test que falla.** **Todo lo demás de este comentario es lectura del mensaje.**
fiestorra commented 2026-12-03 03:56:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T03:56:27Z.


Confirmado con el mismo comando en los dos árboles: en main pasa, en su head falla

Añadí esto porque mi comentario anterior comparaba contra una medición de la línea base, no contra el test suelto:

main      cargo test -p leonida-shader --lib rdna_forms_give_what_the_spelled_out_ones_give
          1 passed
#2698     cargo test -p leonida-shader --lib
          370 passed; 1 failed
          mad_legacy: written alike

Y una cosa que conviene decir sobre la diferencia de conteos: main filtra 434 y su head 370, porque su base es de hace ocho días y el crate tiene hoy más tests. Así que el fallo no es "un test que no existe en main" — es el mismo test, que allí pasa.

Lo que sigue sin decidir, y es del autor: si mad_legacy debe emitirse con su forma o plegarse a la canónica. El test dice «deberían diferir»; el cambio hace que coincidan. Una de las dos cosas es la que cambia.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7367095352 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7367095352). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T03:56:27Z. --- ## Confirmado con el mismo comando en los dos árboles: en `main` pasa, en su head falla **Añadí esto porque mi comentario anterior comparaba contra una medición de la línea base, no contra el test suelto**: ``` main cargo test -p leonida-shader --lib rdna_forms_give_what_the_spelled_out_ones_give 1 passed #2698 cargo test -p leonida-shader --lib 370 passed; 1 failed mad_legacy: written alike ``` **Y una cosa que conviene decir sobre la diferencia de conteos**: **`main` filtra 434 y su head 370**, **porque su base es de hace ocho días y el crate tiene hoy más tests.** **Así que el fallo no es "un test que no existe en `main`"** — **es el mismo test, que allí pasa.** **Lo que sigue sin decidir, y es del autor**: **si `mad_legacy` debe emitirse con su forma o plegarse a la canónica.** **El test dice «deberían diferir»; el cambio hace que coincidan.** **Una de las dos cosas es la que cambia.**
merzleckeier commented 2026-12-03 04:02:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T04:02:24Z.


I isolated the mad_legacy: written alike assertion from the Windows test using the same synthetic shader builder and RDNA masks on Linux. Each revision was built separately with Rust 1.98.1.

Tree mad_legacy DXIL with RDNA off/on
PR merge base 1d22590b9 identical (2224 / 2224 bytes)
PR head 1f188c4f7 identical (2224 / 2224 bytes)
Current main 516c9eaab distinct (2224 / 2304 bytes)
PR head merged into current main distinct (2224 / 2304 bytes)

The old base already has the reported failure. Current main contains the separate legacy_mad fix in 3c2bfd429, and merging #2698 preserves it. The mul_legacy control produced different DXIL at both masks on all four trees. On the combined tree, the portable shader library suite had 256 passes (including the extracted assertion and the PR’s size-handle test), two ignored, and zero failures.

This isolates the compiler-side assertion. The Windows GPU execution portion was outside this run. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7367198765 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7367198765). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T04:02:24Z. --- I isolated the `mad_legacy: written alike` assertion from the Windows test using the same synthetic shader builder and RDNA masks on Linux. Each revision was built separately with Rust 1.98.1. | Tree | `mad_legacy` DXIL with RDNA off/on | |---|---| | PR merge base `1d22590b9` | identical (2224 / 2224 bytes) | | PR head `1f188c4f7` | identical (2224 / 2224 bytes) | | Current `main` `516c9eaab` | distinct (2224 / 2304 bytes) | | PR head merged into current `main` | distinct (2224 / 2304 bytes) | The old base already has the reported failure. Current `main` contains the separate `legacy_mad` fix in `3c2bfd429`, and merging #2698 preserves it. The `mul_legacy` control produced different DXIL at both masks on all four trees. On the combined tree, the portable shader library suite had 256 passes (including the extracted assertion and the PR’s size-handle test), two ignored, and zero failures. This isolates the compiler-side assertion. The Windows GPU execution portion was outside this run. AI-assisted with OpenAI Codex.
fiestorra commented 2026-12-03 04:05:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T04:05:19Z.


Correction, and it is the good kind: main + this pull request is 430 passed, 0 failed — the red was its base, not the change

My last two comments said the head has a failing test and left the question open. I answered it the way this repository says to: cherry-pick the commit onto main and run:

git cherry-pick 950fea224  (on 516c9eaab)
  7 files changed, 67 insertions(+), 12 deletions(-)      ← applies cleanly, no conflict

cargo test -p leonida-shader --lib
  430 passed; 0 failed; 6 ignored                          (446 s)
  emit::valu_tests::mad_legacy_takes_a_subnormal_factor_as_a_zero ... ok

So the failure I reported is not caused by this pull request at all. Its branch is eight days old, and something in emit/ landed on main in between that fixed rdna_forms_give_what_the_spelled_out_ones_give — on the current base, with this change applied, it passes.

Which makes this pull request: clean to merge, and blocked only by being old.

And what it costs to say so: the previous comments were technically true — the head does fail, 370/1, and the test is real — but a reader takes «the head fails» as «the change fails», and it does not. The difference is a rebase, and I should have run the cherry-pick before writing the first sentence about it rather than after. The method is in this repository's own notes; I used it for #3209 an hour ago and did not use it here.

For whoever is merging: rebase it, and the 430 will be the number.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7367250243 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7367250243). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T04:05:19Z. --- ## Correction, and it is the good kind: **`main` + this pull request is 430 passed, 0 failed** — the red was its base, not the change **My last two comments said the head has a failing test and left the question open.** **I answered it the way this repository says to**: **cherry-pick the commit onto `main` and run**: ``` git cherry-pick 950fea224 (on 516c9eaab) 7 files changed, 67 insertions(+), 12 deletions(-) ← applies cleanly, no conflict cargo test -p leonida-shader --lib 430 passed; 0 failed; 6 ignored (446 s) emit::valu_tests::mad_legacy_takes_a_subnormal_factor_as_a_zero ... ok ``` **So the failure I reported is not caused by this pull request at all.** **Its branch is eight days old, and something in `emit/` landed on `main` in between that fixed `rdna_forms_give_what_the_spelled_out_ones_give`** — **on the current base, with this change applied, it passes.** **Which makes this pull request: clean to merge, and blocked only by being old.** **And what it costs to say so**: **the previous comments were technically true** — **the head *does* fail, 370/1, and the test is real** — **but a reader takes «the head fails» as «the change fails», and it does not.** **The difference is a rebase, and I should have run the cherry-pick before writing the first sentence about it rather than after.** **The method is in this repository's own notes; I used it for `#3209` an hour ago and did not use it here.** **For whoever is merging**: **rebase it, and the 430 will be the number.**
fiestorra commented 2026-12-03 04:14:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T04:14:08Z.


And the rebase is done and pushed, so nobody has to redo it: pr-2698-rebased, 2acb803ff, 430/0

Since the cherry-pick applied cleanly, I did the whole thing:

https://github.com/fiestorra/leonida-carry/pull/new/pr-2698-rebased
head 2acb803ff, on 516c9eaab, author unchanged (Geovanni)
git diff --stat origin/main..HEAD    8 files changed, 90 insertions(+), 16 deletions(-)

cargo test -p leonida-shader --lib   430 passed; 0 failed; 6 ignored   (446 s)

The rebase had no conflicts, and the 446 seconds are real — this is the crate with the big bitcode tests, and it is the reason I ran the suite twice rather than once.

What the change is, now that its base is current: it isolates the handle of AMD's buffer size query — eight files in emit/, plus a README and docs/design.md — and the test that was red in its own base (rdna_forms_give_what_the_spelled_out_ones_give) is green on main.

So the state of #2698 is: clean, rebased, 430/0, and the only thing between it and a merge is somebody pressing the button. The branch is on my fork because my account cannot open the pull request, and the link above opens it with the same title and the evidence in this thread.

One honest line about why it took three comments to get here: the first should have been the cherry-pick. I wrote «the head fails» because the head does fail, and a reader takes that as «the change fails». The difference was one command.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7367412677 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7367412677). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T04:14:08Z. --- ## And the rebase is done and pushed, so nobody has to redo it: `pr-2698-rebased`, `2acb803ff`, 430/0 **Since the cherry-pick applied cleanly, I did the whole thing**: ``` https://github.com/fiestorra/leonida-carry/pull/new/pr-2698-rebased head 2acb803ff, on 516c9eaab, author unchanged (Geovanni) git diff --stat origin/main..HEAD 8 files changed, 90 insertions(+), 16 deletions(-) cargo test -p leonida-shader --lib 430 passed; 0 failed; 6 ignored (446 s) ``` **The rebase had no conflicts**, **and the 446 seconds are real** — **this is the crate with the big bitcode tests, and it is the reason I ran the suite twice rather than once.** **What the change is, now that its base is current**: **it isolates the handle of AMD's buffer size query** — **eight files in `emit/`, plus a README and `docs/design.md`** — **and the test that was red in its own base (`rdna_forms_give_what_the_spelled_out_ones_give`) is green on `main`.** **So the state of `#2698` is: clean, rebased, 430/0, and the only thing between it and a merge is somebody pressing the button.** **The branch is on my fork because my account cannot open the pull request**, **and the link above opens it with the same title and the evidence in this thread.** **One honest line about why it took three comments to get here**: **the first should have been the cherry-pick.** **I wrote «the head fails» because the head does fail, and a reader takes that as «the change fails». The difference was one command.**
OreoFR commented 2026-12-03 04:19:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T04:19:09Z.


VERIFY-2698 (Verified by OreoFR) on current main

  • Base: main 516c9eaab, head 1f188c4f7. git merge --no-ff is clean (8 files, +90/−16). Main's separate legacy_mad fix (3c2bfd429) is kept.
  • Tests: cargo test -q -p leonida-shader gives 430 passed, 0 failed, 6 ignored, on an RTX 4070 Laptop with driver 621.40. That includes the host-GPU and WARP size_tests (DXIL validated), rdna_forms_give_what_the_spelled_out_ones_give (it passes merged into main, as @merzleckeier found), and buffer_size_handles_are_kept_separate_when_reusing_values.
  • With LEONIDA_SEPARATE_SIZE_HANDLES=1: the size, waterfall, size-handle and rdna_forms tests pass (34).
  • clippy -D warnings: only main's 6 known errors in valu_tests.rs, none in the touched files.
  • Compared with our Darner-derived prototype (Darner emit/lower/amd.rs, after DexNom/VIctory PR 62, GPL-3.0): same approach. It also uses its own handle and is off by default. Ours additionally leaves a waterfall loop's size query on its per-lane handle, but no failure was shown on that path here, so we drop our prototype in favour of this PR.

Verdict: compiler side OK merged into main; needs an RDNA4 in-game run before merge.

The author has been inactive since 11-30, so a carry follows at OreoFR's request: #3293.

(oreofr-agent, AI-assisted)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7367506345 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7367506345). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-03T04:19:09Z. --- ## VERIFY-2698 (Verified by OreoFR) on current main - **Base:** main `516c9eaab`, head `1f188c4f7`. `git merge --no-ff` is clean (8 files, +90/−16). Main's separate `legacy_mad` fix (3c2bfd429) is kept. - **Tests:** `cargo test -q -p leonida-shader` gives 430 passed, 0 failed, 6 ignored, on an RTX 4070 Laptop with driver 621.40. That includes the host-GPU and WARP `size_tests` (DXIL validated), `rdna_forms_give_what_the_spelled_out_ones_give` (it passes merged into main, as @merzleckeier found), and `buffer_size_handles_are_kept_separate_when_reusing_values`. - **With `LEONIDA_SEPARATE_SIZE_HANDLES=1`:** the size, waterfall, size-handle and `rdna_forms` tests pass (34). - **clippy `-D warnings`:** only main's 6 known errors in `valu_tests.rs`, none in the touched files. - **Compared with our Darner-derived prototype** (Darner `emit/lower/amd.rs`, after DexNom/VIctory PR 62, GPL-3.0): same approach. It also uses its own handle and is off by default. Ours additionally leaves a waterfall loop's size query on its per-lane handle, but no failure was shown on that path here, so we drop our prototype in favour of this PR. Verdict: compiler side OK merged into main; needs an RDNA4 in-game run before merge. The author has been inactive since 11-30, so a carry follows at OreoFR's request: #3293. (oreofr-agent, AI-assisted)
OreoFR commented 2026-12-03 04:19:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T04:19:11Z.


Carried into #3293 at OreoFR's request (author inactive since 11-30): commits cherry-picked with -x, authorship kept. (oreofr-agent, AI-assisted)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7367506765 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2698#issuecomment-7367506765). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-03T04:19:11Z. --- Carried into #3293 at OreoFR's request (author inactive since 11-30): commits cherry-picked with -x, authorship kept. (oreofr-agent, AI-assisted)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2698:upstream-pr/2698'
git switch 'upstream-pr/2698'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2698'
git switch 'upstream-pr/2698'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2698'
git switch 'upstream-pr/2698'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2698'
git switch 'main'
git merge --squash 'upstream-pr/2698'
git switch 'main'
git merge --ff-only 'upstream-pr/2698'
git switch 'main'
git merge 'upstream-pr/2698'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2698
No description provided.