Bmjask/ultra performance redesign #2768

Closed
bmjask wants to merge 404 commits from upstream-pr/2778 into main
bmjask commented 2026-11-26 12:00:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-26T12:00:05Z.


What is in it

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release:
  • cargo test --workspace -- --test-threads=4: N passed, N failed, N ignored (SKIPPED GPU tests: …)

Regression run

main:

PR:

Not tested

AI use

  • none / tool and model, and what it did
<!-- greyfinch-sync:ivall/xcl:issue:6626184971 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2778). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-26T12:00:05Z. --- <!-- What changes and why, in a few sentences. "Fixes #N" / "Part of #N". Stacked: "Stacked on #N". --> **What is in it** - **Tested** - hardware (GPU + driver, CPU), Rust version, debug / release: - `cargo test --workspace -- --test-threads=4`: N passed, N failed, N ignored (SKIPPED GPU tests: …) **Regression run** <!-- Required when the PR changes crates/xcl/src outside tests: `scripts/smoke.ps1` on a real title, built from main and from this PR's head commit (no uncommitted changes); paste both blocks. Rerun the PR's after every push. Not needed for docs / tests / scripts only. --> main: PR: **Not tested** - **AI use** - none / tool and model, and what it did
KOLESNiii commented 2026-11-26 13:05:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-26T12:15:58Z.


Can these improvements be broken down into smaller scoped changes, and then individually merged into main, instead of this mega-PR?

<!-- greyfinch-sync:ivall/xcl:comment:7191780156 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2778#issuecomment-7191780156). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-26T12:15:58Z. --- Can these improvements be broken down into smaller scoped changes, and then individually merged into main, instead of this mega-PR?
inf1425 commented 2026-11-26 13:05:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by inf1425 on 2026-11-26T12:20:25Z.


Please complete your PR template too...

<!-- greyfinch-sync:ivall/xcl:comment:7191875637 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2778#issuecomment-7191875637). Originally posted by [inf1425](https://github.com/inf1425) on 2026-11-26T12:20:25Z. --- Please complete your PR template too...
KOLESNiii commented 2026-11-26 13:05:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-26T12:46:28Z.


I put together a proposed split in #2787. @bmjask, are you planning to open PRs for the slices below? If any are unclaimed, I’d like to take them and open focused PRs against main, keeping the original commit attribution.

  • Sparse upload recovery. Start with publishing sent hashes only after a successful queue signal (41a369ee), then preserve and retry dirty work when upload preparation fails (3cd053e4). I’d coordinate the timeout prerequisite with #1277.
  • Deferred CPU write ordering. Extract 311fc618 with the minimum producer tracking it needs, so a list wait can see the deferred CPU write that satisfies it. I’d keep this to its own regression and PR.
  • Contiguous 2D tiling runs. If the synchronization fixes are spoken for, I can take b81ac2eb as a standalone PR with byte-parity coverage and a detile benchmark.

I’d start with sparse upload recovery if that’s free. If there’s a prerequisite I’ve missed or a narrower cut you’d prefer, please point me to it.

<!-- greyfinch-sync:ivall/xcl:comment:7192442264 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2778#issuecomment-7192442264). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-26T12:46:28Z. --- I put together a proposed split in #2787. @bmjask, are you planning to open PRs for the slices below? If any are unclaimed, I’d like to take them and open focused PRs against main, keeping the original commit attribution. - **Sparse upload recovery.** Start with publishing sent hashes only after a successful queue signal (`41a369ee`), then preserve and retry dirty work when upload preparation fails (`3cd053e4`). I’d coordinate the timeout prerequisite with #1277. - **Deferred CPU write ordering.** Extract `311fc618` with the minimum producer tracking it needs, so a list wait can see the deferred CPU write that satisfies it. I’d keep this to its own regression and PR. - **Contiguous 2D tiling runs.** If the synchronization fixes are spoken for, I can take `b81ac2eb` as a standalone PR with byte-parity coverage and a detile benchmark. I’d start with sparse upload recovery if that’s free. If there’s a prerequisite I’ve missed or a narrower cut you’d prefer, please point me to it.
SlopTart commented 2026-11-26 13:05:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-26T13:01:31Z.


Suite run on this PR from two Linux/Wine machines. Headline: the xcl lib test binary hard-crashes its test host on this branch, and it is reproducible with one single test.

The killer, one command (usual CPU-lane env: wine runner, WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11,d3d10core=n,b", VKD3D_CONFIG=ignore_shared_fence, network off):

cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --exact 'hle::d3d12x::alloc_pool::tests::released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing'

Results:

commit machine result
main b49be183 rig A, release ok, 0.00s
PR head 7d0487c4 rig A, release test host dies, wine exit status 9
PR head 7d0487c4 rig A, debug profile same abort, same spot
PR head 7d0487c4 rig B, release lib binary dies, same spot
later head today d98343d2 rig A, release still dies, exit status 9

With --nocapture the last xcl line before the host dies is its own log line D3D12.X: 2 allocator resets so far with recordings still held or on the GPU – another PC allocator took its place, then wine reports Unhandled exception code c0000409 flags 1 addr 0x1400e6e25 (xcl.exe image base 0x140000000, so offset +0xE6E25). A single-threaded full lib pass (--test-threads=1) dies on exactly this test (test 51 of the run), and the two threaded workspace runs die in the same alloc_pool neighborhood on both machines, so the whole-suite abort and this one test look like the same fault.

Consequence for the template checklist: a full cargo test --workspace run on these lanes cannot produce lib totals on this branch, roughly 1330 lib tests get no verdict. The integration binaries are fine: same 5 known Wine-red names on PR and on main (disk_free_space_ex_reports_pls_quota, offline_split_compute_pipeline_is_reused_by_a_second_process, split_compute_prefers_the_offline_whole_pipeline, set_predication_buffer_state_and_kickoff, test_title_runs_and_game_folder_is_untouched), no new integration reds on this PR.

Tested:

  • rig A: AMD Ryzen 9 9900X, 96 GB DDR5, RX 7900 XT 20 GB (Navi 31), Arch Linux, kernel 7.2.15, Mesa 26.2.5 RADV, wine-11.0 (Proton), rustc 1.94.0
  • rig B: Intel i5-10600K, 16 GB DDR4, GTX 1070 8 GB, driver 550.163.01, Debian 13, wine-10.0
  • both CPU-only lanes, --skip gpu::; workspace runs used --test-threads=2 --skip gpu::
  • note: the author is pushing fast, heads moved again since these runs (f910a402 is current), the single-test crash still reproduced on d98343d2

Not tested:

  • Windows native. One-command check: if the solo repro above also hard-fails on Windows, this is a real regression rather than a Wine interaction. The Windows lib-binary aborts in #2632 (aborts at test 1024/1564) may be this same fault, worth a cross-check of the crash signature.
  • game/perf behavior, this only covers the CPU-lane suite.

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

<!-- greyfinch-sync:ivall/xcl:comment:7192771774 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2778#issuecomment-7192771774). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-26T13:01:31Z. --- Suite run on this PR from two Linux/Wine machines. Headline: the xcl lib test binary hard-crashes its test host on this branch, and it is reproducible with one single test. The killer, one command (usual CPU-lane env: wine runner, `WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11,d3d10core=n,b"`, `VKD3D_CONFIG=ignore_shared_fence`, network off): ``` cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --exact 'hle::d3d12x::alloc_pool::tests::released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing' ``` Results: | commit | machine | result | | --- | --- | --- | | main `b49be183` | rig A, release | ok, 0.00s | | PR head `7d0487c4` | rig A, release | test host dies, wine exit status 9 | | PR head `7d0487c4` | rig A, debug profile | same abort, same spot | | PR head `7d0487c4` | rig B, release | lib binary dies, same spot | | later head today `d98343d2` | rig A, release | still dies, exit status 9 | With `--nocapture` the last xcl line before the host dies is its own log line `D3D12.X: 2 allocator resets so far with recordings still held or on the GPU – another PC allocator took its place`, then wine reports `Unhandled exception code c0000409 flags 1 addr 0x1400e6e25` (xcl.exe image base `0x140000000`, so offset +0xE6E25). A single-threaded full lib pass (`--test-threads=1`) dies on exactly this test (test 51 of the run), and the two threaded workspace runs die in the same alloc_pool neighborhood on both machines, so the whole-suite abort and this one test look like the same fault. Consequence for the template checklist: a full `cargo test --workspace` run on these lanes cannot produce lib totals on this branch, roughly 1330 lib tests get no verdict. The integration binaries are fine: same 5 known Wine-red names on PR and on main (`disk_free_space_ex_reports_pls_quota`, `offline_split_compute_pipeline_is_reused_by_a_second_process`, `split_compute_prefers_the_offline_whole_pipeline`, `set_predication_buffer_state_and_kickoff`, `test_title_runs_and_game_folder_is_untouched`), no new integration reds on this PR. Tested: - rig A: AMD Ryzen 9 9900X, 96 GB DDR5, RX 7900 XT 20 GB (Navi 31), Arch Linux, kernel 7.2.15, Mesa 26.2.5 RADV, wine-11.0 (Proton), rustc 1.94.0 - rig B: Intel i5-10600K, 16 GB DDR4, GTX 1070 8 GB, driver 550.163.01, Debian 13, wine-10.0 - both CPU-only lanes, `--skip gpu::`; workspace runs used `--test-threads=2 --skip gpu::` - note: the author is pushing fast, heads moved again since these runs (`f910a402` is current), the single-test crash still reproduced on `d98343d2` Not tested: - Windows native. One-command check: if the solo repro above also hard-fails on Windows, this is a real regression rather than a Wine interaction. The Windows lib-binary aborts in #2632 (aborts at test 1024/1564) may be this same fault, worth a cross-check of the crash signature. - game/perf behavior, this only covers the CPU-lane suite. Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.
SlopTart commented 2026-11-26 14:03:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-26T13:27:43Z.


Wine-lane follow-up to my crash row above and ettehn's Windows control, at PR head 2c5c33d4 (heads keep moving, re-checked 2026-11-26):

  1. The fixture abort is still live upstream, unmerged-fix: --exact hle::d3d12x::alloc_pool::tests::released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing still hard-kills the Wine test host (exit status 9) on this head, matching ettehn's 0xc0000409 on Windows. Their BackingProbe::new AddRef diagnosis also fits our side exactly: the mock fence vtable in alloc_pool.rs is built from unexpected_call (line 1433) which is std::process::abort(), and abort() surfaces as c0000409/fast-fail. One fault, two platforms, confirmed.

  2. ettehn's remaining red reproduces on Wine too, same fixture as shipped, fresh process, no local changes:

cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --exact 'hle::d3d12x::alloc_pool::tests::submit_reservation_keeps_pre_reset_attribution_across_queues'
panicked at crates/xcl/src/hle/d3d12x/alloc_pool.rs:2025:9:
assertion `left == right` failed
  left: 4
 right: 0

That is the same fence-ref count (4 vs expected 0) ettehn reported on native Windows. A plain assertion failure with identical numbers on Wine/Linux and Windows/MSVC points at the allocator changes in this PR, not at mocks or Wine.

  1. Control: on main b49be183 the full lib suite completes green apart from the known baseline reds, and released_lists... was verified solo at 0.00s; submit_reservation... is among the passing on main in the full run.

Setup same as the row above (rig A: Ryzen 9 9900X, RX 7900 XT, Mesa 26.2.5 RADV, wine-11.0 Proton, rustc 1.94.0; CPU lane, gpu:: skipped). Not tested: the 0xc0000005 group abort ettehn saw, group runs on our lane die earlier on the fixture abort.

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

<!-- greyfinch-sync:ivall/xcl:comment:7193383521 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2778#issuecomment-7193383521). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-26T13:27:43Z. --- Wine-lane follow-up to my crash row above and ettehn's Windows control, at PR head `2c5c33d4` (heads keep moving, re-checked 2026-11-26): 1. The fixture abort is still live upstream, unmerged-fix: `--exact hle::d3d12x::alloc_pool::tests::released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing` still hard-kills the Wine test host (exit status 9) on this head, matching ettehn's `0xc0000409` on Windows. Their `BackingProbe::new` AddRef diagnosis also fits our side exactly: the mock fence vtable in `alloc_pool.rs` is built from `unexpected_call` (line 1433) which is `std::process::abort()`, and `abort()` surfaces as `c0000409`/fast-fail. One fault, two platforms, confirmed. 2. ettehn's remaining red reproduces on Wine too, same fixture as shipped, fresh process, no local changes: ``` cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --exact 'hle::d3d12x::alloc_pool::tests::submit_reservation_keeps_pre_reset_attribution_across_queues' ``` ``` panicked at crates/xcl/src/hle/d3d12x/alloc_pool.rs:2025:9: assertion `left == right` failed left: 4 right: 0 ``` That is the same fence-ref count (4 vs expected 0) ettehn reported on native Windows. A plain assertion failure with identical numbers on Wine/Linux and Windows/MSVC points at the allocator changes in this PR, not at mocks or Wine. 3. Control: on main `b49be183` the full lib suite completes green apart from the known baseline reds, and `released_lists...` was verified solo at 0.00s; `submit_reservation...` is among the passing on main in the full run. Setup same as the row above (rig A: Ryzen 9 9900X, RX 7900 XT, Mesa 26.2.5 RADV, wine-11.0 Proton, rustc 1.94.0; CPU lane, `gpu::` skipped). Not tested: the `0xc0000005` group abort ettehn saw, group runs on our lane die earlier on the fixture abort. Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.
ettehn commented 2026-11-26 14:03:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ettehn on 2026-11-26T13:20:19Z.


Native Windows follow-up to the Wine allocator abort, Windows 11 with Rust 1.97.1 MSVC debug, one test per process.

  • Clean main b49be183: released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing passes.
  • Clean PR head f6577375b9460228627fb284fc65a8577777da8d: that exact test terminates the test process with 0xc0000409.
  • Same PR head with a test-only fixture fix: that test passes in isolation and in the allocator group. BackingProbe::new clones the retained fence, so the mock needs a real IUnknown::AddRef slot. The slot had pointed to unexpected_call, which calls abort(). I initialized the fake fence refcount to 1 for the map-owned reference, implemented increment/decrement in its AddRef/Release slots, and asserted the count was 0 after forget(alloc). No production changes were needed for this test.

The allocator group is still red after the fixture fix. submit_reservation_keeps_pre_reset_attribution_across_queues independently fails with fence refs 4 vs expected 0, even in a fresh process. The next test, transferred_owner_is_released_once_outside_state_after_logical_forget, encounters 0xc0000005 in the group but passes on its own. I have not attributed that second failure or group abort to the missing AddRef above.

AI-assisted diagnosis and Windows verification (OpenAI Codex).

Originally posted by @ettehn in https://github.com/xcl-dev/xcl/issues/2778#issuecomment-7193206270

Retest on 2c5c33d4c85acf64a489204e40b8efb990bfa6e2

  • Clean head still terminates the same isolated test with 0xc0000409, matching the Wine retest.
  • With three test fixture corrections in alloc_pool.rs, the allocator group completes with 23 passed, 0 failed, 0 ignored, no reported GPU skips. In addition to the AddRef fix above, the cross-queue test advances its mock fence through value 6 before cleanup and gives the replacement allocator a valid Release slot. The resubmit test now registers its initial submission through begin_submit / finish_with_mark so it creates the list lifetime that note_resubmits checks. The group also runs through transferred_owner_is_released_once_outside_state_after_logical_forget successfully.

cargo test --locked --offline -p xcl --lib -j 2 hle::d3d12x::alloc_pool::tests:: -- --test-threads=1 --nocapture on Windows 11 build 26200, Ryzen 9 8945HX, RTX 5070 Ti Laptop (621.24), Rust 1.97.1 MSVC debug. The full suite and a retail title were not tested.

OpenAI Codex assisted with diagnosis and verification (model unavailable in this session).

<!-- greyfinch-sync:ivall/xcl:comment:7193206270 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2778#issuecomment-7193206270). Originally posted by [ettehn](https://github.com/ettehn) on 2026-11-26T13:20:19Z. --- Native Windows follow-up to the [Wine allocator abort](https://github.com/xcl-dev/xcl/pull/2778#issuecomment-7192771774), Windows 11 with Rust 1.97.1 MSVC debug, one test per process. - Clean `main` `b49be183`: `released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing` passes. - Clean PR head `f6577375b9460228627fb284fc65a8577777da8d`: that exact test terminates the test process with `0xc0000409`. - Same PR head with a test-only fixture fix: that test passes in isolation and in the allocator group. `BackingProbe::new` clones the retained fence, so the mock needs a real `IUnknown::AddRef` slot. The slot had pointed to `unexpected_call`, which calls `abort()`. I initialized the fake fence refcount to 1 for the map-owned reference, implemented increment/decrement in its AddRef/Release slots, and asserted the count was 0 after `forget(alloc)`. No production changes were needed for this test. The allocator group is still red after the fixture fix. `submit_reservation_keeps_pre_reset_attribution_across_queues` independently fails with fence refs 4 vs expected 0, even in a fresh process. The next test, `transferred_owner_is_released_once_outside_state_after_logical_forget`, encounters `0xc0000005` in the group but passes on its own. I have not attributed that second failure or group abort to the missing AddRef above. AI-assisted diagnosis and Windows verification (OpenAI Codex). _Originally posted by @ettehn in https://github.com/xcl-dev/xcl/issues/2778#issuecomment-7193206270_ **Retest on `2c5c33d4c85acf64a489204e40b8efb990bfa6e2`** - Clean head still terminates the same isolated test with `0xc0000409`, matching the Wine retest. - With three test fixture corrections in `alloc_pool.rs`, the allocator group completes with **23 passed, 0 failed, 0 ignored, no reported GPU skips**. In addition to the AddRef fix above, the cross-queue test advances its mock fence through value 6 before cleanup and gives the replacement allocator a valid `Release` slot. The resubmit test now registers its initial submission through `begin_submit` / `finish_with_mark` so it creates the list lifetime that `note_resubmits` checks. The group also runs through `transferred_owner_is_released_once_outside_state_after_logical_forget` successfully. `cargo test --locked --offline -p xcl --lib -j 2 hle::d3d12x::alloc_pool::tests:: -- --test-threads=1 --nocapture` on Windows 11 build 26200, Ryzen 9 8945HX, RTX 5070 Ti Laptop (621.24), Rust 1.97.1 MSVC debug. The full suite and a retail title were not tested. OpenAI Codex assisted with diagnosis and verification (model unavailable in this session).
upstream-sync closed this pull request 2026-11-26 16:05:54 +00:00
Prime1997 commented 2026-11-26 16:05:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-26T15:13:09Z.

Review: COMMENTED


Closing this combined draft in its current form. At e9211ff4 it spans 404 commits across 80 files and conflicts with main 8b957bec in hle/d3d12x/real.rs, hle/d3d12x/real/two_pass_identity.rs, and shaders.rs. The PR description check failed with required testing and regression sections still blank.

Please continue the independently reviewable changes through #2787, preserving contributor attribution. The first focused drafts are #2820 for contiguous 2D tiling and #2821 for sparse upload staging timeouts. Each slice can then establish its own CI and, where required, matched title results.

AI use: Codex (GPT-6) reviewed the pinned changes and verified the reported evidence. Optional temporary Discord for coordinating contributor work, testing, and comparing results.

<!-- greyfinch-sync:ivall/xcl:review:6076550914 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2778#pullrequestreview-6076550914). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-11-26T15:13:09Z. **Review:** COMMENTED --- **Closing this combined draft in its current form.** At `e9211ff4` it spans 404 commits across 80 files and conflicts with main `8b957bec` in `hle/d3d12x/real.rs`, `hle/d3d12x/real/two_pass_identity.rs`, and `shaders.rs`. The [PR description check](https://github.com/xcl-dev/xcl/actions/runs/45845904106/job/139999377724) failed with required testing and regression sections still blank. Please continue the independently reviewable changes through #2787, preserving contributor attribution. The first focused drafts are #2820 for contiguous 2D tiling and #2821 for sparse upload staging timeouts. Each slice can then establish its own CI and, where required, matched title results. AI use: Codex (GPT-6) reviewed the pinned changes and verified the reported evidence. Optional temporary [Discord](https://discord.gg/gK3y7WRRY) for coordinating contributor work, testing, and comparing results.

Pull request closed

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
xcl-dev/xcl!2768
No description provided.