D3D12.X: allocate an oversized chunk for console list records larger than CHUNK #806

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

@⁠mastrr9 on GitHub · 2026-11-24 05:41 UTC · original
mastrr9:fix/console-list-large-record → main · +37 −9 · 1 files · 1 commits · open

In console_list.rs, push() starts a new record chunk when a record does not fit, but new_chunk() always allocates a fixed CHUNK (1 MiB) buffer. Any record larger than CHUNK — such as cl_resource_barrier with 32,768 or more barriers (8 + 32 bytes each) — then writes past the end of the allocation via copy_nonoverlapping. Only reachable with XCL_CONSOLE_LISTS=1.

What is in it

  • crates/xcl/src/hle/d3d12x/console_list.rs: new_chunk(obj, st, need) allocates CHUNK.max(need.saturating_add(SLACK)) bytes and sets F_END / F_DISPATCH_END from the real chunk size; push() passes 4 * words.len() (with saturating_add in its bounds check) and other callers (cl_reset, create_with_allocator) pass 0.
  • Regression test a_record_larger_than_a_chunk_gets_a_chunk_of_its_own (records CHUNK / 32 + 10 barriers followed by a marker, verifies every word, and cleans up the test object from LISTS).
  • Note: PR #510 also touches new_chunk (reusing a spare chunk across Reset); if #510 merges first, st.spare should only be reused when spare.len() >= need + SLACK.

Tested

  • Environment: NVIDIA GeForce RTX 5080 (16 GB, wave32, driver 617.42 / 32.0.16.1742), Windows 11 Pro 25H2 (26200.9974), D3D12 debug layer installed (d3d12SDKLayers.dll), rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC from Windows SDK 10.0.26100.0, debug build.
  • Negative control (unmodified main d208e14): running a_record_larger_than_a_chunk_gets_a_chunk_of_its_own standalone crashed with 0xc0000005 (STATUS_ACCESS_VIOLATION), confirming the heap out-of-bounds write.
  • Command (identical tree at 2e961c0 / pushed head 932fdf5): cargo build --workspace && cargo test --workspace -- --test-threads=4
  • Result: 705 passed, 0 failed, 41 ignored (0 new warnings; new test passed in 0.00 s).
  • SKIPPED (2): gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware (no wave64).

Regression run
Smoke run by @⁠Toons29 in comment below: #806
Contributed by a community tester; the PR author did not run it. Both blocks are pasted as posted.

main:

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB

PR:

xcl-smoke v1
commit: a7e8ed75d1345b36c0f1a231c9f0029bfbc89803
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1617 (PresentX 1617)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14809 MB

Tester's setup and limits: AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

Tester's AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; the tester checked the blocks before posting.

Not tested

  • By the author: AMD/wave64 hardware, and release build.
  • Whether the community regression run above reaches the code this PR changes.

AI use

  • Claude Opus 5.5 (via Claude Duet / Claude Code) identified the bug from source review and drafted the initial patch.
  • Antigravity (Gemini 4 Neon) audited all new_chunk / push callers, hardened overflow math and test cleanup, verified the negative-control crash and full Windows RTX 5080 MSVC workspace suite, and drafted this PR description.
  • Claude Code (Claude Sonnet 5.5) added the community regression run to this description and updated the lines that it made out of date or that the PR check requires.
**@⁠mastrr9** on GitHub · 2026-11-24 05:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/806) `mastrr9:fix/console-list-large-record` → `main` · +37 −9 · 1 files · 1 commits · open In `console_list.rs`, `push()` starts a new record chunk when a record does not fit, but `new_chunk()` always allocates a fixed `CHUNK` (1 MiB) buffer. Any record larger than `CHUNK` — such as `cl_resource_barrier` with 32,768 or more barriers (8 + 32 bytes each) — then writes past the end of the allocation via `copy_nonoverlapping`. Only reachable with `XCL_CONSOLE_LISTS=1`. **What is in it** - `crates/xcl/src/hle/d3d12x/console_list.rs`: `new_chunk(obj, st, need)` allocates `CHUNK.max(need.saturating_add(SLACK))` bytes and sets `F_END` / `F_DISPATCH_END` from the real chunk size; `push()` passes `4 * words.len()` (with `saturating_add` in its bounds check) and other callers (`cl_reset`, `create_with_allocator`) pass `0`. - Regression test `a_record_larger_than_a_chunk_gets_a_chunk_of_its_own` (records `CHUNK / 32 + 10` barriers followed by a marker, verifies every word, and cleans up the test object from `LISTS`). - Note: PR #510 also touches `new_chunk` (reusing a spare chunk across `Reset`); if #510 merges first, `st.spare` should only be reused when `spare.len() >= need + SLACK`. **Tested** - **Environment:** NVIDIA GeForce RTX 5080 (16 GB, wave32, driver `617.42` / `32.0.16.1742`), Windows 11 Pro 25H2 (`26200.9974`), D3D12 debug layer installed (`d3d12SDKLayers.dll`), `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC, DXC from Windows SDK `10.0.26100.0`, debug build. - **Negative control (unmodified `main` `d208e14`):** running `a_record_larger_than_a_chunk_gets_a_chunk_of_its_own` standalone **crashed** with `0xc0000005` (`STATUS_ACCESS_VIOLATION`), confirming the heap out-of-bounds write. - **Command (identical tree at `2e961c0` / pushed head `932fdf5`):** `cargo build --workspace && cargo test --workspace -- --test-threads=4` - **Result:** **705 passed, 0 failed, 41 ignored** (0 new warnings; new test passed in 0.00 s). - **SKIPPED (2):** `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask` (`no wave64`), `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware` (`no wave64`). **Regression run** Smoke run by @⁠Toons29 in comment below: https://git.gtahub.st/github/xcl-dev--xcl/pulls/806 Contributed by a community tester; the PR author did not run it. Both blocks are pasted as posted. main: ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` PR: ``` xcl-smoke v1 commit: a7e8ed75d1345b36c0f1a231c9f0029bfbc89803 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1617 (PresentX 1617) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14809 MB ``` Tester's setup and limits: AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. Tester's AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; the tester checked the blocks before posting. **Not tested** - By the author: AMD/wave64 hardware, and release build. - Whether the community regression run above reaches the code this PR changes. **AI use** - Claude Opus 5.5 (via Claude Duet / Claude Code) identified the bug from source review and drafted the initial patch. - Antigravity (Gemini 4 Neon) audited all `new_chunk` / `push` callers, hardened overflow math and test cleanup, verified the negative-control crash and full Windows RTX 5080 MSVC workspace suite, and drafted this PR description. - Claude Code (Claude Sonnet 5.5) added the community regression run to this description and updated the lines that it made out of date or that the PR check requires.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:33:17 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 07:06 UTC · original

Full-suite run, since this PR has no test report yet. Tested exact head 932fdf5 (on its base d208e14).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 705 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: a_record_larger_than_a_chunk_gets_a_chunk_of_its_own.

Not tested

  • AMD, a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-24 07:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/806#issuecomment-7124618466) Full-suite run, since this PR has no test report yet. Tested exact head `932fdf5` (on its base `d208e14`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **705 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `a_record_larger_than_a_chunk_gets_a_chunk_of_its_own`. **Not tested** - AMD, a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

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

Linux / AMD RDNA3 datapoint.

Merged state: head 932fdf5 onto main 1ec4c98, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 705 passed, 11 failed, 41 ignored. Failures = the known Wine-lane set from my #42 rows plus #718 trio members and a hit of gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes (new flake, see #718 addendum). oversized list-record chunk tests green.

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 08:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/806#issuecomment-7125799323) Linux / AMD RDNA3 datapoint. **Merged state:** head `932fdf5` onto main `1ec4c98`, clean merge. **Full suite, `cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4`:** **705 passed, 11 failed, 41 ignored**. Failures = the known Wine-lane set from my #42 rows plus #718 trio members and a hit of `gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes` (new flake, see #718 addendum). oversized list-record chunk tests green. **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

@⁠Toons29 on GitHub · 2026-11-25 03:00 UTC · original

Regression run of a7e8ed75 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: a7e8ed75d1345b36c0f1a231c9f0029bfbc89803
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1617 (PresentX 1617)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14809 MB

Against the limits in CONTRIBUTING.md: 100 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; I checked the blocks before posting.

**@⁠Toons29** on GitHub · 2026-11-25 03:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/806#issuecomment-7151493701) Regression run of `a7e8ed75` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: a7e8ed75d1345b36c0f1a231c9f0029bfbc89803 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1617 (PresentX 1617) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14809 MB ``` Against the limits in CONTRIBUTING.md: 100 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; I checked the blocks before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 10:58 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 10:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/806#issuecomment-7160419197) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠throny on GitHub · 2026-11-25 18:10 UTC · original

Two contributors checked independently and found that #1477 solves the same problem in a different way: #1607, group D101. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.

This is a hint from the community triage in #1607, not a maintainer decision.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

**@⁠throny** on GitHub · 2026-11-25 18:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/806#issuecomment-7170549738) <!-- xcl-1607-hint:D101 --> Two contributors checked independently and found that #1477 solves the same problem in a different way: #1607, group D101. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/hle/d3d12x/console_list.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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