Test RDNA legacy MAD lowering without a GPU #3294

Open
merzleckeier wants to merge 2 commits from upstream-pr/3294 into main
merzleckeier commented 2026-12-03 04:21:37 +00:00 (Migrated from github.com)

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


Claimed in the coordination issue as D3D12-SHADER-RDNA-LEGACY-MAD-TEST.

What and why

The mad_legacy: written alike assertion that caught the regression fixed by #2624 runs in a Windows RDNA hardware test. The regression was also visible when comparing the compiler output on a CPU during the #2698 review. This adds that comparison to the portable shader library tests.

The test reuses the synthetic VALU fixture with live root inputs and a buffer store. It compares the DXIL payload with only the RDNA LEGACY bit changed. The existing Windows test still checks hardware execution.

Tested

  • Rust 1.98.1 on Linux, cargo test -p leonida-shader --lib --locked --offline on 516c9eaa with this patch. 255 passed, two ignored.
  • Replacing just legacy_mad with its earlier implementation from 1d22590b9 made the new assertion fail. The same test passes with the current lowering.
  • Combined with #3293 at fae5bd4b. The merge is clean and the portable suite had 256 passes and two ignored, including both the size-handle test and this regression.
  • git diff --check and the scoped clean-room check passed. Independent read-only review found no issues.

GPUs tested: n/a. All tests above were compiler-only.

AI-assisted: OpenAI Codex (GPT-6) and independent read-only review by GPT-6.2 Sol.

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • Clean-room checks passed.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5619898450 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3294). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T04:21:37Z. --- Claimed in the coordination issue as [D3D12-SHADER-RDNA-LEGACY-MAD-TEST](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7367506473). ### What and why The `mad_legacy: written alike` assertion that caught the regression fixed by #2624 runs in a Windows RDNA hardware test. The regression was also visible when comparing the compiler output on a CPU during the #2698 review. This adds that comparison to the portable shader library tests. The test reuses the synthetic VALU fixture with live root inputs and a buffer store. It compares the DXIL payload with only the RDNA `LEGACY` bit changed. The existing Windows test still checks hardware execution. ### Tested - Rust 1.98.1 on Linux, `cargo test -p leonida-shader --lib --locked --offline` on `516c9eaa` with this patch. 255 passed, two ignored. - Replacing just `legacy_mad` with its earlier implementation from `1d22590b9` made the new assertion fail. The same test passes with the current lowering. - Combined with #3293 at `fae5bd4b`. The merge is clean and the portable suite had 256 passes and two ignored, including both the size-handle test and this regression. - `git diff --check` and the scoped clean-room check passed. Independent read-only review found no issues. GPUs tested: n/a. All tests above were compiler-only. AI-assisted: OpenAI Codex (GPT-6) and independent read-only review by GPT-6.2 Sol. ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] Clean-room checks passed.
fiestorra commented 2026-12-03 04:33:10 +00:00 (Migrated from github.com)

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


VERIFY-3294 — el test que responde la pregunta que dejé abierta en #2698, y pasa

Un fichero, +20/−4, y es el complemento exacto del carry #3293:

head 9582059a2
cargo test -p leonida-shader --lib rdna_forms     1 passed

Y lo que hace es la respuesta a mi duda: rdna_legacy_mad_uses_distinct_dxil —

// v_mad_legacy_f32 v0, v1, v2, v3. Runtime inputs keep the zero check live.
let words = [0xD540_0000, 257 | (258 << 9) | (259 << 18)];

compila la instrucción y compara el DXIL de las dos formas, exigiendo que difieran. En #2698 yo dije que el fallo era «mad_legacy: written alike» y que no sabía si el test pedía lo imposible o el emisor perdía la forma. La respuesta es: ni una ni otra — el test no estaba midiendo lo que hacía falta, y este lo mide. Y el comentario del código dice por qué el caso es real: "Runtime inputs keep the zero check live", o sea que usa registros de entrada y no constantes, que es lo que hace que el camino del cero siga existiendo.

Lo que verifiqué: el test nuevo pasa en su head (1 passed), y el fichero que toca es el mismo valu_tests.rs del rojo de #2698. Lo que no: la suite entera con este cambio — cambia un helper (lowers_valu → lower_valu, que ahora devuelve Lowered) y es #[cfg(test)], así que no puede afectar al runtime, pero no corrí los 430 para comprobarlo.

Si los dos entran, #3293 + #3294 son el arreglo y la prueba juntos — y #2698, que sigue abierto, el mismo trabajo con una base vieja.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7367774846 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3294#issuecomment-7367774846). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T04:33:10Z. --- ## VERIFY-3294 — el test que responde la pregunta que dejé abierta en `#2698`, y pasa **Un fichero, +20/−4, y es el complemento exacto del *carry* `#3293`**: ``` head 9582059a2 cargo test -p leonida-shader --lib rdna_forms 1 passed ``` **Y lo que hace es la respuesta a mi duda**: **`rdna_legacy_mad_uses_distinct_dxil`** — ```rust // v_mad_legacy_f32 v0, v1, v2, v3. Runtime inputs keep the zero check live. let words = [0xD540_0000, 257 | (258 << 9) | (259 << 18)]; ``` **compila la instrucción y compara el DXIL de las dos formas, exigiendo que difieran.** **En `#2698` yo dije que el fallo era «`mad_legacy: written alike`» y que no sabía si el test pedía lo imposible o el emisor perdía la forma.** **La respuesta es: ni una ni otra — el test no estaba midiendo lo que hacía falta, y este lo mide.** **Y el comentario del código dice por qué el caso es real: *"Runtime inputs keep the zero check live"***, **o sea que usa registros de entrada y no constantes, que es lo que hace que el camino del cero siga existiendo.** **Lo que verifiqué**: **el test nuevo pasa en su head (1 passed), y el fichero que toca es el mismo `valu_tests.rs` del rojo de `#2698`.** **Lo que no**: **la suite entera con este cambio** — **cambia un helper (`lowers_valu` → `lower_valu`, que ahora devuelve `Lowered`) y es `#[cfg(test)]`, así que no puede afectar al runtime, pero no corrí los 430 para comprobarlo.** **Si los dos entran, `#3293` + `#3294` son el arreglo y la prueba juntos** — **y `#2698`, que sigue abierto, el mismo trabajo con una base vieja.**
merzleckeier commented 2026-12-03 04:33:20 +00:00 (Migrated from github.com)

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


The Windows runtime job on 9582059a stopped in leonida-hle before it reached the shader tests. modules::xasync::tests::run_returns_the_work_result got E_PENDING where it expected E_ABORT. The HLE source tree is identical to main. I separately built the Windows MSVC shader test binary from 9582059a and ran the new test under Wine. It passed.

ac8af63e syncs with main at d9b618f10. The test patch is byte-for-byte identical against the new base, the focused Linux test passed again, and an independent reviewer checked the sync. Fresh CI is starting. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7367777607 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3294#issuecomment-7367777607). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T04:33:20Z. --- The [Windows runtime job on `9582059a`](https://github.com/ProjectLeonida/mandy/actions/runs/47034669145/job/144007760654) stopped in `leonida-hle` before it reached the shader tests. `modules::xasync::tests::run_returns_the_work_result` got `E_PENDING` where it expected `E_ABORT`. The HLE source tree is identical to `main`. I separately built the Windows MSVC shader test binary from `9582059a` and ran the new test under Wine. It passed. `ac8af63e` syncs with `main` at `d9b618f10`. The test patch is byte-for-byte identical against the new base, the focused Linux test passed again, and an independent reviewer checked the sync. Fresh CI is starting. AI-assisted with OpenAI Codex.
fiestorra commented 2026-12-03 04:41:32 +00:00 (Migrated from github.com)

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


Y la suite entera que dije que no había corrido: 430/0/6, la misma que main

Lo escribí hace un minuto — «cambia un helper de cfg(test), que no puede afectar al runtime, pero no corrí los 430 para comprobarlo» — y eso es exactamente la frase que me he pasado la noche anotando como trampa. El comando son 447 segundos y no hay nadie esperando.

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

El mismo número que main y que el carry #3293, con el test nuevo incluido — porque el test nuevo es uno de los 430, y los otros 429 siguen pasando con el lower_valu cambiado.

Lo que esto añade a lo anterior: el refactor del helper (lowers_valu → lower_valu, devolviendo Lowered) no rompe nada de lo que usaba el anterior, que era la única duda real que quedaba sobre este PR.

Así que el estado de #3294 es: un fichero, +20/−4, el test que responde la pregunta de #2698, y 430/0/6 con la suite entera.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7367939424 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3294#issuecomment-7367939424). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T04:41:32Z. --- ## Y la suite entera que dije que no había corrido: **430/0/6**, la misma que `main` **Lo escribí hace un minuto** — *«cambia un helper de `cfg(test)`, que no puede afectar al runtime, pero no corrí los 430 para comprobarlo»* — **y eso es exactamente la frase que me he pasado la noche anotando como trampa.** **El comando son 447 segundos y no hay nadie esperando.** ``` cargo test -p leonida-shader --lib 430 passed; 0 failed; 6 ignored (447 s) ``` **El mismo número que `main` y que el *carry* `#3293`, con el test nuevo incluido** — **porque el test nuevo es uno de los 430, y los otros 429 siguen pasando con el `lower_valu` cambiado.** **Lo que esto añade a lo anterior**: **el refactor del helper (`lowers_valu` → `lower_valu`, devolviendo `Lowered`) no rompe nada de lo que usaba el anterior**, **que era la única duda real que quedaba sobre este PR.** **Así que el estado de `#3294` es: un fichero, +20/−4, el test que responde la pregunta de `#2698`, y 430/0/6 con la suite entera.**
merzleckeier commented 2026-12-03 04:45:52 +00:00 (Migrated from github.com)

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


All three workflows passed on ac8af63e. The native Windows job records emit::lower::tests::rdna_legacy_mad_uses_distinct_dxil ... ok and modules::xasync::tests::run_returns_the_work_result ... ok. The Windows run on main also passes that XAsync test. Its earlier failure is tracked in #2570.

The advisory asset-policy step logs the same three findings on both trees. The separate No Game Data workflow passed. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7368018327 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3294#issuecomment-7368018327). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T04:45:52Z. --- All three workflows passed on `ac8af63e`. The [native Windows job](https://github.com/ProjectLeonida/mandy/actions/runs/47036089444/job/144012523716) records `emit::lower::tests::rdna_legacy_mad_uses_distinct_dxil ... ok` and `modules::xasync::tests::run_returns_the_work_result ... ok`. The [Windows run on `main`](https://github.com/ProjectLeonida/mandy/actions/runs/47035524628/job/144010625532) also passes that XAsync test. Its earlier failure is tracked in [#2570](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7367781646). The advisory asset-policy step logs the same three findings on both trees. The separate No Game Data workflow passed. AI-assisted with OpenAI Codex.
MoonEyes commented 2026-12-03 05:01:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T05:01:13Z.


RUN (in game, batch of three pull requests), each head merged with git merge --no-ff onto main d9b618f10, in one build: #3290 898de93c2, #3293 fae5bd4b5, #3294 9582059a2. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, -PrecompileUsed, 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 (48 samples) median 17.2, mean 17.2
Rendered fps, last 120 s median 17.2
Time under 5 fps in the world 1 %

For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain.

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. Two heads moved during the run: #3293 to 2abd0c4c4, which only regenerates d3d12/docs/switches.md (git diff fae5bd4b5 2abd0c4c4 outside *.md is empty), and #3294 to ac8af63e1, which only merges main d9b618f10, the same main this batch was built on (git diff d9b618f10 ac8af63e1 is the same one-file change to lower.rs that was tested). This run therefore also stands for those two new heads.

Limits: one run; arrival in the world was driven by keys and not checked on pictures; -PrecompileUsed was used, so the default start (every known pipeline precompiled) was not exercised. #3290's switch is opt-in and was left off. #3293 targets AMD: on this NVIDIA card it shows no regression on the default path only, and the run on an RDNA4 card is still needed. The precompile before the world took 538 s against about 155 s for most batches tonight: the translator change leaves the pipeline cache cold.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7368287810 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3294#issuecomment-7368287810). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T05:01:13Z. --- RUN (in game, batch of three pull requests), each head merged with `git merge --no-ff` onto main `d9b618f10`, in one build: #3290 `898de93c2`, #3293 `fae5bd4b5`, #3294 `9582059a2`. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, `-Resolution 1080`, frame generation 2x, `-PrecompileUsed`, 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 (48 samples) | median 17.2, mean 17.2 | | Rendered fps, last 120 s | median 17.2 | | Time under 5 fps in the world | 1 % | For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain. 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. Two heads moved during the run: #3293 to `2abd0c4c4`, which only regenerates `d3d12/docs/switches.md` (`git diff fae5bd4b5 2abd0c4c4` outside `*.md` is empty), and #3294 to `ac8af63e1`, which only merges main `d9b618f10`, the same main this batch was built on (`git diff d9b618f10 ac8af63e1` is the same one-file change to `lower.rs` that was tested). This run therefore also stands for those two new heads. Limits: one run; arrival in the world was driven by keys and not checked on pictures; `-PrecompileUsed` was used, so the default start (every known pipeline precompiled) was not exercised. #3290's switch is opt-in and was left off. #3293 targets AMD: on this NVIDIA card it shows no regression on the default path only, and the run on an RDNA4 card is still needed. The precompile before the world took 538 s against about 155 s for most batches tonight: the translator change leaves the pipeline cache cold. AI-assisted (Claude Code).
TurboTheTurtle commented 2026-12-03 06:20:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TurboTheTurtle on 2026-12-03T06:20:21Z.


tested: same on both sides, no GPU needed for it. Machine: Windows 11, NVIDIA GeForce RTX 5080, driver 621.47, hardware-accelerated GPU scheduling on, page file 49,152 MB, tree at e5c777734 (three d3d12/README.md commits on main d9b618f10).

cargo test --workspace --exclude xtask --locked in d3d12/ -> the seven ok results and leonida-gpu 715 passed / 1 failed / 59 ignored, the one failure the known descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in which passes with LEONIDA_VIEW_COPY=0 and is unrelated to this change. node --test tests/test_*.cjs -> 113 tests, 0 fail. Head ac8af63e1. Same counts as the base, so the legacy MAD lowering is covered by the translator's own tests without a card, as the note says.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369723321 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3294#issuecomment-7369723321). Originally posted by [TurboTheTurtle](https://github.com/TurboTheTurtle) on 2026-12-03T06:20:21Z. --- tested: same on both sides, no GPU needed for it. Machine: Windows 11, NVIDIA GeForce RTX 5080, driver 621.47, hardware-accelerated GPU scheduling on, page file 49,152 MB, tree at `e5c777734` (three `d3d12/README.md` commits on main `d9b618f10`). `cargo test --workspace --exclude xtask --locked` in `d3d12/` -> the seven `ok` results and `leonida-gpu` 715 passed / 1 failed / 59 ignored, the one failure the known `descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in` which passes with `LEONIDA_VIEW_COPY=0` and is unrelated to this change. `node --test tests/test_*.cjs` -> 113 tests, 0 fail. Head `ac8af63e1`. Same counts as the base, so the legacy MAD lowering is covered by the translator's own tests without a card, as the note says.
lixonik commented 2026-12-03 06:40:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T06:40:53Z.


Windows native verification -- PASS on head ac8af63e1 (merged cleanly via git merge --no-ff onto main d9b618f10).

Checks (Windows 10 x64)

  • python -I scripts/check_no_game_data.py -> PASS
  • cargo test -p leonida-shader --lib --locked lower:: (with LEONIDA_DXIL=none on Windows 10 inbox dxil.dll) -> test result: ok. 25 passed; 0 failed; 1 ignored; 0 measured; 410 filtered out; finished in 0.02s
  • Test-only PR (confirmed new test compiles and passes cleanly on native Windows).

AI-assisted: yes (Antigravity -- Gemini 4 Neon).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7370109082 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3294#issuecomment-7370109082). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-03T06:40:53Z. --- **Windows native verification -- PASS** on head `ac8af63e1` (merged cleanly via `git merge --no-ff` onto `main` `d9b618f10`). ### Checks (Windows 10 x64) - `python -I scripts/check_no_game_data.py` -> **PASS** - `cargo test -p leonida-shader --lib --locked lower::` (with `LEONIDA_DXIL=none` on Windows 10 inbox `dxil.dll`) -> **test result: ok. 25 passed; 0 failed; 1 ignored; 0 measured; 410 filtered out; finished in 0.02s** - Test-only PR (confirmed new test compiles and passes cleanly on native Windows). AI-assisted: yes (Antigravity -- Gemini 4 Neon).
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/3294:upstream-pr/3294'
git switch 'upstream-pr/3294'

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/3294'
git switch 'upstream-pr/3294'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3294'
git switch 'upstream-pr/3294'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3294'
git switch 'main'
git merge --squash 'upstream-pr/3294'
git switch 'main'
git merge --ff-only 'upstream-pr/3294'
git switch 'main'
git merge 'upstream-pr/3294'
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!3294
No description provided.