acphal: match the APU virtual address lookup ABI #939

Open
github-bot wants to merge 1 commit from github-bot/gh-939 into main AGit
Owner

@⁠Babyhamsta on GitHub · 2026-11-24 08:52 UTC · original
Babyhamsta:fix/acp-virtual-address-abi → main · +82 −28 · 1 files · 1 commits · open

Correct the ACP virtual-address lookup ABI. Ordinary callers pass one virtual address and consume the returned 32-bit APU token. The old implementation expected an output pointer, an address and a length.

What is in it

  • In crates/xcl/src/hle/acphal.rs, resolve allocation interiors and return zero for unregistered addresses. Keep the bounded span helper internal and retain full-width 0/1 validity with alignment checking.
  • Add a test that checks the published export pointer against the caller's ABI, round-trips an interior token, and verifies that lookup leaves caller bytes unchanged. The range, overflow and rollback tests from #90 remain covered.

Tested

  • Windows 11 build 26300, GeForce RTX 4070 driver 621.35, Intel Core i7-13700K, rustc 1.94.1. Debug workspace tests and release smoke builds.
  • cargo build --offline --locked --workspace completed. cargo test --offline --locked --workspace -- --test-threads=4 --show-output reported 717 passed, 0 failed, 41 ignored. Two reported passes explicitly skipped for no wave64: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware.
  • The focused ACP suite passed 8 tests. The typed caller fixture failed to compile against the old mapper signature.

Regression run
Both clean builds used the upstream smoke script for 60 seconds offline, with fresh profiles and separate cold DXIL caches at 1920×1080.

Main

xcl-smoke v1
commit: 077ce40c3e371cf3df8c57985b1cc6b1db39e75a
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1027 (PresentX 1027)
presents per 2 s (last 3): 47 49 49
device removals: 0
crashes: 0
peak commit: 15334 MB

This PR

xcl-smoke v1
commit: 37e2dcad707cdecc6ebee67963cc8097de760566
gpu: NVIDIA GeForce RTX 4070
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 872 (PresentX 872)
presents per 2 s (last 3): 34 38 43
device removals: 0
crashes: 0
peak commit: 15333 MB

Not tested

  • AMD, Intel GPU or Wine. The 60-second smoke is a startup regression check. The synthetic export test exercises the mapper directly.

AI use

  • Codex (GPT-6) wrote the implementation and fixture and ran and reviewed the checks.
**@⁠Babyhamsta** on GitHub · 2026-11-24 08:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/939) `Babyhamsta:fix/acp-virtual-address-abi` → `main` · +82 −28 · 1 files · 1 commits · open Correct the ACP virtual-address lookup ABI. Ordinary callers pass one virtual address and consume the returned 32-bit APU token. The old implementation expected an output pointer, an address and a length. **What is in it** - In `crates/xcl/src/hle/acphal.rs`, resolve allocation interiors and return zero for unregistered addresses. Keep the bounded span helper internal and retain full-width 0/1 validity with alignment checking. - Add a test that checks the published export pointer against the caller's ABI, round-trips an interior token, and verifies that lookup leaves caller bytes unchanged. The range, overflow and rollback tests from #90 remain covered. **Tested** - Windows 11 build 26300, GeForce RTX 4070 driver 621.35, Intel Core i7-13700K, rustc 1.94.1. Debug workspace tests and release smoke builds. - `cargo build --offline --locked --workspace` completed. `cargo test --offline --locked --workspace -- --test-threads=4 --show-output` reported 717 passed, 0 failed, 41 ignored. Two reported passes explicitly skipped for no wave64: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware`. - The focused ACP suite passed 8 tests. The typed caller fixture failed to compile against the old mapper signature. **Regression run** Both clean builds used the upstream smoke script for 60 seconds offline, with fresh profiles and separate cold DXIL caches at 1920×1080. Main ``` xcl-smoke v1 commit: 077ce40c3e371cf3df8c57985b1cc6b1db39e75a gpu: NVIDIA GeForce RTX 4070 title: RetailTitle seconds: 60 exit: 0x0 frames shown: 1027 (PresentX 1027) presents per 2 s (last 3): 47 49 49 device removals: 0 crashes: 0 peak commit: 15334 MB ``` This PR ``` xcl-smoke v1 commit: 37e2dcad707cdecc6ebee67963cc8097de760566 gpu: NVIDIA GeForce RTX 4070 title: RetailTitle seconds: 60 exit: 0x0 frames shown: 872 (PresentX 872) presents per 2 s (last 3): 34 38 43 device removals: 0 crashes: 0 peak commit: 15333 MB ``` **Not tested** - AMD, Intel GPU or Wine. The 60-second smoke is a startup regression check. The synthetic export test exercises the mapper directly. **AI use** - Codex (GPT-6) wrote the implementation and fixture and ran and reviewed the checks.
Return the APU token for a registered virtual address without writing caller data. Test the published export pointer, interior addresses, and alignment while preserving existing range allocation and rollback checks.

Assisted-by: Codex (GPT-6)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:37:39 +00:00
Author
Owner

@⁠dcastell1 on GitHub · 2026-11-24 09:11 UTC · original

Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean main@beaa245 (713 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
714 passed; 0 failed; 41 ignored   (exit 0)

One more passing test than main: the APU virtual-address lookup ABI match is covered and green.

Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

**@⁠dcastell1** on GitHub · 2026-11-24 09:11 UTC · [original](https://github.com/xcl-dev/xcl/pull/939#issuecomment-7127071065) Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean `main@beaa245` (713 passed, 0 failed, 41 ignored on this box): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 714 passed; 0 failed; 41 ignored (exit 0) ``` One more passing test than main: the APU virtual-address lookup ABI match is covered and green. Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 10:37 UTC · original

Linux / AMD RDNA3 datapoint.

Merged state: head 37e2dca onto main 9aec53d, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 713 passed, 12 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). acphal APU-lookup ABI tests green; see flake footnote.

Footnote: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask failed once in-lane but passes 2/2 in isolation on the same merge, and current main passes the same isolated runs - ordering flake on this rig, not attributed to this PR.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-24 10:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/939#issuecomment-7129035762) Linux / AMD RDNA3 datapoint. **Merged state:** head `37e2dca` onto main `9aec53d`, clean merge. **Full suite, `cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4`:** **713 passed, 12 failed, 41 ignored**; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). acphal APU-lookup ABI tests green; see flake footnote. Footnote: `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask` failed once in-lane but passes 2/2 in isolation on the same merge, and current main passes the same isolated runs - ordering flake on this rig, not attributed to this PR. **Not tested:** retail titles (none here), Windows, RDNA4. Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. My Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 12:39 UTC · original

Independent verification, merged onto current main 384f7f7 locally (clean merge).

Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.

  • cargo test -p xcl --lib acphal: 8 passed, 0 failed — including apu_mapper_exports_lookup_interior_bytes_without_writing (the new ABI coverage) plus the DSP connect/decoder tests.
  • The ApuMapVirtualAddress(va) -> apu signature change and alignment-aware find_free_range look consistent with the doc comment update; mapped_address now requires full-span coverage instead of partial overlap, which is the safer semantic.

AI use: test runs by Devin (Cognition, SWE-2); no code changes.

**@⁠DavidM1911** on GitHub · 2026-11-24 12:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/939#issuecomment-7131748929) Independent verification, merged onto current `main` `384f7f7` locally (clean merge). **Machine:** Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug. - `cargo test -p xcl --lib acphal`: **8 passed, 0 failed** — including `apu_mapper_exports_lookup_interior_bytes_without_writing` (the new ABI coverage) plus the DSP connect/decoder tests. - The `ApuMapVirtualAddress(va) -> apu` signature change and alignment-aware `find_free_range` look consistent with the doc comment update; `mapped_address` now requires full-span coverage instead of partial overlap, which is the safer semantic. AI use: test runs by Devin (Cognition, SWE-2); no code changes.
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-25 03:27 UTC · original

Tested

  • Exact PR head 37e2dcad707cdecc6ebee67963cc8097de760566 on Windows 11 build 26200, Ryzen 9 5980HX, Rust 1.99.0 MSVC. The ACP mapping suite is CPU and memory code; it did not exercise the RX 6800M GPU.
  • cargo test --locked -p xcl --lib -j 2 hle::acphal:: -- --test-threads=1 --show-output: 8 passed, 0 failed, 0 ignored, no explicit skips. The new export ABI test passed, including interior address lookup, unchanged caller bytes, alignment checks, and lookup after free.
  • cargo build --locked --workspace -j 2: passed.

Not tested

  • A title calling the ACP ABI, the full workspace suite, or another operating system. The synthetic tests check the published export pointer and function behavior on this machine.

AI use

OpenAI Codex (GPT-6, exact variant not exposed in this session) reviewed the exact diff, ran the ACP suite and workspace build, checked the logs, and drafted this report.

**@⁠luckyteagirl** on GitHub · 2026-11-25 03:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/939#issuecomment-7151938812) **Tested** - Exact PR head `37e2dcad707cdecc6ebee67963cc8097de760566` on Windows 11 build 26200, Ryzen 9 5980HX, Rust 1.99.0 MSVC. The ACP mapping suite is CPU and memory code; it did not exercise the RX 6800M GPU. - `cargo test --locked -p xcl --lib -j 2 hle::acphal:: -- --test-threads=1 --show-output`: **8 passed, 0 failed, 0 ignored**, no explicit skips. The new export ABI test passed, including interior address lookup, unchanged caller bytes, alignment checks, and lookup after free. - `cargo build --locked --workspace -j 2`: passed. **Not tested** - A title calling the ACP ABI, the full workspace suite, or another operating system. The synthetic tests check the published export pointer and function behavior on this machine. **AI use** OpenAI Codex (GPT-6, exact variant not exposed in this session) reviewed the exact diff, ran the ACP suite and workspace build, checked the logs, and drafted this report.
Author
Owner

@⁠S1m0ne1997 on GitHub · 2026-11-25 14:26 UTC · original

Test report for 37e2dcad707cdecc6ebee67963cc8097de760566 (this PR's head), for #1607.

Tested

  • NVIDIA GeForce RTX 4090 24 GB (driver 621.40), AMD Ryzen 9 9950X3D, 47 GB RAM, Windows 11 Home 10.0.26300, rustc 1.100.0 (0ef1bc386 2026-11-09) x86_64-pc-windows-msvc, debug.
  • cargo build --workspace, then cargo test --workspace -- --test-threads=4 at the head: 717 passed, 0 failed, 41 ignored.
  • SKIPPED (2): gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu_wave32_program_in_wave64_hardware (no wave64).

Regression run (retail title, scripts/smoke.ps1 -Seconds 60, release; main built from the commit in its block, this PR from its head, no uncommitted changes)

main:

xcl-smoke v1
commit: 06c9f5505f63f10c5ec49ef932d75b2c28177324
gpu: NVIDIA GeForce RTX 4090
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1599 (PresentX 1599)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16384 MB

this PR:

xcl-smoke v1
commit: 37e2dcad707cdecc6ebee67963cc8097de760566
gpu: NVIDIA GeForce RTX 4090
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1626 (PresentX 1626)
presents per 2 s (last 3): 59 44 51
device removals: 0
crashes: 0
peak commit: 17641 MB

Not tested

  • AMD, other NVIDIA cards and drivers, Linux. I did not review the diff; this report is the build, the suite and the regression run only.

AI use: Claude Code with Claude Opus 5.5 ran the build, the suite and the regression run and wrote this report at my request.

**@⁠S1m0ne1997** on GitHub · 2026-11-25 14:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/939#issuecomment-7165286462) Test report for `37e2dcad707cdecc6ebee67963cc8097de760566` (this PR's head), for #1607. **Tested** - NVIDIA GeForce RTX 4090 24 GB (driver 621.40), AMD Ryzen 9 9950X3D, 47 GB RAM, Windows 11 Home 10.0.26300, `rustc 1.100.0 (0ef1bc386 2026-11-09)` `x86_64-pc-windows-msvc`, debug. - `cargo build --workspace`, then `cargo test --workspace -- --test-threads=4` at the head: **717 passed, 0 failed, 41 ignored**. - SKIPPED (2): `gpu_geometry_wave32_prefix_count_over_a_mask` (no wave64), `gpu_wave32_program_in_wave64_hardware` (no wave64). **Regression run** (retail title, `scripts/smoke.ps1 -Seconds 60`, release; `main` built from the commit in its block, this PR from its head, no uncommitted changes) main: ``` xcl-smoke v1 commit: 06c9f5505f63f10c5ec49ef932d75b2c28177324 gpu: NVIDIA GeForce RTX 4090 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1599 (PresentX 1599) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16384 MB ``` this PR: ``` xcl-smoke v1 commit: 37e2dcad707cdecc6ebee67963cc8097de760566 gpu: NVIDIA GeForce RTX 4090 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1626 (PresentX 1626) presents per 2 s (last 3): 59 44 51 device removals: 0 crashes: 0 peak commit: 17641 MB ``` **Not tested** - AMD, other NVIDIA cards and drivers, Linux. I did not review the diff; this report is the build, the suite and the regression run only. *AI use: Claude Code with Claude Opus 5.5 ran the build, the suite and the regression run and wrote this report at my request.*
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 15:26 UTC · original

Independent AMD report for 37e2dcad707cdecc6ebee67963cc8097de760566.

Tested

  • AMD Radeon RX 7800 XT (driver 32.0.31035.1003), Ryzen 7 5700X3D, Windows 11 build 26200, rustc 1.100.0, debug profile for tests, release for smoke. Tested at the exact PR head (not a local merge onto main). This head's merge base is 077ce40c (24 Nov), older than current main, so I tested the PR head as is, not merged onto current main.
  • cargo test -p xcl --lib acphal: 8 passed, 0 failed (includes the new apu_mapper_exports_lookup_interior_bytes_without_writing).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 717 passed, 0 failed, 41 ignored; no SKIPPED lines.
  • scripts/smoke.ps1 -Seconds 60 on a real title, release build, PR head: 1502 frames, last presents per 2 s 60 60 60, peak commit 17737 MB, no device removal, no crash, exit 0x0. Reference run of current main 06c9f550 on the same title: 1531 frames, peak commit 17752 MB. The PR's script predates -Title, so I paste the numbers rather than the block (it would print the title's folder name).

Not tested

A title that calls the APU mapper ABI, a rebase onto current main, other adapters.

AI use

Claude Code (Claude Sonnet 5.5) ran the tests and the smoke runs and wrote this report. No game files, dumps or shader names are included.

**@⁠oni-swr** on GitHub · 2026-11-25 15:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/939#issuecomment-7166843699) Independent AMD report for `37e2dcad707cdecc6ebee67963cc8097de760566`. **Tested** - AMD Radeon RX 7800 XT (driver 32.0.31035.1003), Ryzen 7 5700X3D, Windows 11 build 26200, rustc 1.100.0, debug profile for tests, release for smoke. Tested at the exact PR head (not a local merge onto `main`). This head's merge base is `077ce40c` (24 Nov), older than current `main`, so I tested the PR head as is, not merged onto current `main`. - `cargo test -p xcl --lib acphal`: 8 passed, 0 failed (includes the new `apu_mapper_exports_lookup_interior_bytes_without_writing`). - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 717 passed, 0 failed, 41 ignored; no SKIPPED lines. - `scripts/smoke.ps1 -Seconds 60` on a real title, release build, PR head: 1502 frames, last presents per 2 s 60 60 60, peak commit 17737 MB, no device removal, no crash, exit 0x0. Reference run of current `main` `06c9f550` on the same title: 1531 frames, peak commit 17752 MB. The PR's script predates `-Title`, so I paste the numbers rather than the block (it would print the title's folder name). **Not tested** A title that calls the APU mapper ABI, a rebase onto current `main`, other adapters. **AI use** Claude Code (Claude Sonnet 5.5) ran the tests and the smoke runs and wrote this report. No game files, dumps or shader names are included.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 03:11 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 03:11 UTC · [original](https://github.com/xcl-dev/xcl/pull/939#issuecomment-7181476315) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/939/head:github-bot/gh-939'
git switch 'github-bot/gh-939'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-939'
git switch 'github-bot/gh-939'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-939'
git switch 'github-bot/gh-939'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-939'
git switch 'main'
git merge --squash 'github-bot/gh-939'
git switch 'main'
git merge --ff-only 'github-bot/gh-939'
git switch 'main'
git merge 'github-bot/gh-939'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.