leonida-gpu: read the pipeline stream of the title unaligned (D3D12-GPU-PIPELINE-BYTECODE-ALIGNMENT) #2632

Merged
imShangLi merged 4 commits from upstream-pr/2632 into main 2026-11-30 15:59:39 +00:00
imShangLi commented 2026-11-29 20:04:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-11-29T20:04:00Z.


Claimed in the coordination issue as: D3D12-GPU-PIPELINE-BYTECODE-ALIGNMENT

Depends on: #2569 (same file and test module; the current diff applies cleanly, but the branches may overlap if #2569 lands first)

Fixes: none

What and why

create_stream reads the title-owned StreamDesc and each shader Bytecode through aligned Rust references. The title chooses these buffer addresses and need not align them. Read both with read_unaligned() and add an odd-address stream regression test.

Tested

Prior measured branch result on Windows 11 / Rust 1.98.1, base cc0f662a70b6e6e561692f56342b5a7df3831bd7:

  • New test a_stream_at_an_odd_address_yields_its_shaders aborts on pristine main at pipeline.rs:1185 with a misaligned pointer dereference and passes with the change.
  • cargo test --package leonida-gpu --lib --locked --offline: pristine 536 passed; 1 failed; 47 ignored; patched 537 passed; 1 failed; 47 ignored.
  • The remaining descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in failure is also red on pristine main on the AMD Radeon 780M host.
  • Clippy findings were identical before and after, with none in pipeline.rs.
  • Current branch has latest main merged and still changes only d3d12/crates/leonida-gpu/src/pipeline.rs (+77/-5).

GPUs tested: AMD Radeon 780M for the prior host test run; no game files or GPU workload used by the new regression.

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly
  • One topic
  • No game data, keys or decryption
  • No new translator rule

Independent verification

  • Native Windows 11 Pro + AMD Radeon RX 7900 XTX (driver 32.0.32029.2010), Rust 1.98.
  • Fast-forward cleanly onto current main; zero conflicts.
  • cargo test -p leonida-gpu --lib -- --test-threads=4: 550 passed; 0 failed; 47 ignored.
  • python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/pipeline.rs: PASS.
  • Current CI: translator/viewer/no-game-data/change-scope pass; the remaining semantic failure is the upstream baseline test_interp_computed_ij_fallback.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5554578298 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2632). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-11-29T20:04:00Z. --- Claimed in the coordination issue as: `D3D12-GPU-PIPELINE-BYTECODE-ALIGNMENT` Depends on: #2569 (same file and test module; the current diff applies cleanly, but the branches may overlap if #2569 lands first) Fixes: none ### What and why `create_stream` reads the title-owned `StreamDesc` and each shader `Bytecode` through aligned Rust references. The title chooses these buffer addresses and need not align them. Read both with `read_unaligned()` and add an odd-address stream regression test. ### Tested Prior measured branch result on Windows 11 / Rust 1.98.1, base `cc0f662a70b6e6e561692f56342b5a7df3831bd7`: - New test `a_stream_at_an_odd_address_yields_its_shaders` aborts on pristine `main` at `pipeline.rs:1185` with a misaligned pointer dereference and passes with the change. - `cargo test --package leonida-gpu --lib --locked --offline`: pristine `536 passed; 1 failed; 47 ignored`; patched `537 passed; 1 failed; 47 ignored`. - The remaining `descriptor::host::tests::views_are_made_beside_the_heap_and_copied_in` failure is also red on pristine `main` on the AMD Radeon 780M host. - Clippy findings were identical before and after, with none in `pipeline.rs`. - Current branch has latest `main` merged and still changes only `d3d12/crates/leonida-gpu/src/pipeline.rs` (`+77/-5`). GPUs tested: AMD Radeon 780M for the prior host test run; no game files or GPU workload used by the new regression. AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly - [x] One topic - [x] No game data, keys or decryption - [x] No new translator rule ### Independent verification - Native Windows 11 Pro + AMD Radeon RX 7900 XTX (driver 32.0.32029.2010), Rust 1.98. - Fast-forward cleanly onto current `main`; zero conflicts. - `cargo test -p leonida-gpu --lib -- --test-threads=4`: **550 passed; 0 failed; 47 ignored**. - `python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/pipeline.rs`: **PASS**. - Current CI: translator/viewer/no-game-data/change-scope pass; the remaining semantic failure is the upstream baseline `test_interp_computed_ij_fallback`.
bobcatchris commented 2026-11-29 20:08:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-29T20:08:29Z.


Independent verification on native Windows 11 Pro (10.0.26200) + AMD Radeon RX 7900 XTX (gfx1100, driver 32.0.32029.2010, Rust 1.98):

  • Fast-forward cleanly onto main (720bd3b4e..eddf401a2) — zero conflicts.
  • cargo test -p leonida-gpu --lib -- --test-threads=4 — 550 passed; 0 failed; 47 ignored (13.06s), including the new unaligned pipeline stream unit tests.
  • python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/pipeline.rs — PASS.

AI-assisted: Antigravity (Gemini 4 Neon)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261840232 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2632#issuecomment-7261840232). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-11-29T20:08:29Z. --- Independent verification on native Windows 11 Pro (`10.0.26200`) + **AMD Radeon RX 7900 XTX** (`gfx1100`, driver `32.0.32029.2010`, Rust `1.98`): - Fast-forward cleanly onto `main` (`720bd3b4e..eddf401a2`) — zero conflicts. - `cargo test -p leonida-gpu --lib -- --test-threads=4` — **`550 passed; 0 failed; 47 ignored`** (`13.06s`), including the new unaligned pipeline stream unit tests. - `python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/pipeline.rs` — **PASS**. AI-assisted: Antigravity (Gemini 4 Neon)
imShangLi commented 2026-11-29 20:14:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-11-29T20:14:08Z.


CI note: the remaining semantic-tests (ubuntu-latest) failure is test_interp_computed_ij_fallback, the same upstream baseline failure observed on the previous PR/base. This PR changes only d3d12/crates/leonida-gpu/src/pipeline.rs; translator-tests, viewer-tests, no-game-data, and change-scope pass.

Independent native Windows verification is already recorded above: 550 passed / 0 failed on RX 7900 XTX.

AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261915621 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2632#issuecomment-7261915621). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-11-29T20:14:08Z. --- CI note: the remaining `semantic-tests (ubuntu-latest)` failure is `test_interp_computed_ij_fallback`, the same upstream baseline failure observed on the previous PR/base. This PR changes only `d3d12/crates/leonida-gpu/src/pipeline.rs`; `translator-tests`, `viewer-tests`, `no-game-data`, and `change-scope` pass. Independent native Windows verification is already recorded above: 550 passed / 0 failed on RX 7900 XTX. AI-assisted: yes.
imShangLi commented 2026-11-29 20:23:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-11-29T20:23:40Z.


@MoonEyes ready for maintainer review when convenient. Independent RX 7900 XTX verification is 550 passed / 0 failed; the only red CI is the known upstream semantic baseline. AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262044087 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2632#issuecomment-7262044087). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-11-29T20:23:40Z. --- @MoonEyes ready for maintainer review when convenient. Independent RX 7900 XTX verification is 550 passed / 0 failed; the only red CI is the known upstream semantic baseline. AI-assisted: yes.
OreoFR commented 2026-11-29 21:38:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T21:38:22Z.


Verified by OreoFR

  • PR head eddf401a2f1d578c676c612f176eaf288064476b, merged with --no-ff onto main 060c4716046d8c17f5a124d9ae9d56cc0070c225: clean, no conflict.
  • Windows 11 Pro / RTX 4070 Laptop / NVIDIA 621.40 (no GPU used), stable Rust, --locked.
  • Crate tested: leonida-gpu. cargo test -p leonida-gpu --locked on the merge: 550/550 passed, 0 failed, 47 ignored (doc-test targets 0/0). a_stream_at_an_odd_address_yields_its_shaders passes.
  • Red: same merge with the create_stream change restored to main and the new test kept: the test binary aborts, pipeline.rs:1185 "misaligned pointer dereference: address must be a multiple of 0x8" (exit 0xc0000409). Red to green seen; this is the first red recorded by someone other than the author.
  • Clippy: cargo clippy -p leonida-gpu --locked -- -D warnings stops on lints that are already on main in crates this PR does not touch (leonida-shader emit/lower.rs, emit/bitcode/opt.rs; leonida-lua input.rs, memory.rs). Without -D warnings, no lint points at pipeline.rs. Nothing new from this PR.
  • Rebase on #2566 needed: no (the merge result merges cleanly with the #2566 head eade9562c).
  • Diff read: StreamDesc and each shader Bytecode are now copied with read_unaligned(), which matches the subobject kind read and host::GraphicsState::read, which already read unaligned. On Windows the test also runs the graphics.read path at the odd address. The PR says it may overlap #2569 in the same file; one of them will need a rebase after the other lands.
  • Verdict: READY. Ready to merge per the maintainers' plan.

This verification was AI-assisted (Claude Code, oreofr-agent).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7263033962 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2632#issuecomment-7263033962). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T21:38:22Z. --- **Verified by OreoFR** - PR head `eddf401a2f1d578c676c612f176eaf288064476b`, merged with `--no-ff` onto `main` `060c4716046d8c17f5a124d9ae9d56cc0070c225`: clean, no conflict. - Windows 11 Pro / RTX 4070 Laptop / NVIDIA 621.40 (no GPU used), stable Rust, `--locked`. - Crate tested: `leonida-gpu`. `cargo test -p leonida-gpu --locked` on the merge: **550/550 passed**, 0 failed, **47 ignored** (doc-test targets 0/0). `a_stream_at_an_odd_address_yields_its_shaders` passes. - Red: same merge with the `create_stream` change restored to `main` and the new test kept: the test binary aborts, `pipeline.rs:1185` "misaligned pointer dereference: address must be a multiple of 0x8" (exit `0xc0000409`). Red to green seen; this is the first red recorded by someone other than the author. - Clippy: `cargo clippy -p leonida-gpu --locked -- -D warnings` stops on lints that are already on `main` in crates this PR does not touch (`leonida-shader` `emit/lower.rs`, `emit/bitcode/opt.rs`; `leonida-lua` `input.rs`, `memory.rs`). Without `-D warnings`, no lint points at `pipeline.rs`. Nothing new from this PR. - Rebase on #2566 needed: **no** (the merge result merges cleanly with the #2566 head `eade9562c`). - Diff read: `StreamDesc` and each shader `Bytecode` are now copied with `read_unaligned()`, which matches the subobject kind read and `host::GraphicsState::read`, which already read unaligned. On Windows the test also runs the `graphics.read` path at the odd address. The PR says it may overlap #2569 in the same file; one of them will need a rebase after the other lands. - Verdict: **READY**. Ready to merge per the maintainers' plan. This verification was AI-assisted (Claude Code, oreofr-agent).
imShangLi commented 2026-11-30 09:50:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-11-30T09:50:36Z.


Updated head c33baf89 with latest main (4014af7f), which includes the merged semantic baseline fix #2633. This should clear the previous test_interp_computed_ij_fallback CI failure without changing this PR's one-file diff.

AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7274760823 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2632#issuecomment-7274760823). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-11-30T09:50:36Z. --- Updated head `c33baf89` with latest `main` (`4014af7f`), which includes the merged semantic baseline fix #2633. This should clear the previous `test_interp_computed_ij_fallback` CI failure without changing this PR's one-file diff. AI-assisted: yes.
MoonEyes commented 2026-11-30 15:59:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T15:59:34Z.


Verified: independent Windows checks pass, including 550 leonida-gpu tests; a red-on-main / green-on-PR misaligned-pointer regression was confirmed, and CI/no-game-data are green. Ready for merge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7283941836 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2632#issuecomment-7283941836). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T15:59:34Z. --- Verified: independent Windows checks pass, including 550 leonida-gpu tests; a red-on-main / green-on-PR misaligned-pointer regression was confirmed, and CI/no-game-data are green. Ready for merge.
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!2632
No description provided.