D3D12.X: a split barrier's begin is not a completed transition #1736

Closed
b3IKK wants to merge 1 commit from upstream-pr/1746 into main
b3IKK commented 2026-11-24 20:10:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T20:10:33Z.


Addresses XCL-BT-032 from #1488.

resource_barrier_x passed every transition it forwarded to title_textures::note_transitions, which takes the StateAfter as the state the texture is in once the list has run. A split barrier's BEGIN_ONLY (D3D12_RESOURCE_BARRIER_FLAG_BEGIN_ONLY) only starts its transition: the resource is not in the new state — and must not be used — until the matching END_ONLY completes it. The state an upload into a kept-in-step texture started from could therefore belong to a transition that had not finished.

This records a transition for the barriers that complete one (flags NONE or END_ONLY), not for a BEGIN_ONLY. END_ONLY keeps its StateAfter (the console repeats it in the pair).

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: completed_transitions() filters the barriers handed to title_textures::note_transitions (type TRANSITION, flags ≠ BEGIN_ONLY); add test a_split_barriers_begin_is_not_a_completed_transition (NONE + BEGIN_ONLY + END_ONLY → 2 records; a UAV barrier is none). Fails with the filter removed: left: 3, right: 2.

Tested

  • hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1)
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4): 960 passed, 0 failed, 43 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses, no heap windows, and cannot disable the driver cache (Windows Developer Mode is required))
  • cargo test -p xcl --lib list_x: 29 passed, 0 failed

Regression run

main (c4d37be, clean tree, no local changes):

xcl-smoke v1
commit: c4d37bec1bb4286eb373aea963404a23f13401fa
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1639 (PresentX 1640)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14618 MB

PR (76cdd13, clean tree, no local changes):

xcl-smoke v1
commit: 76cdd130d02d5f16f0a6cde2100dbd071767288f
gpu: NVIDIA GeForce RTX 5080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1640 (PresentX 1640)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 14605 MB

Not tested

  • a title that uses split barriers around a texture XCL keeps in step (the filter is covered by the unit test; no game here presented such a pair in the smoke run)
  • AMD GPUs and native wave64 hardware
  • other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine

AI use

  • OpenCode, Gemini 4 Neon: checked XCL-BT-032 against note_transitions and the D3D12 split-barrier rules, wrote the fix and test (and confirmed it fails without the filter), rebased onto c4d37be, ran the test suite and scripts/smoke.ps1 regression runs with #677's title hashing, and drafted this PR description.
<!-- greyfinch-sync:ivall/xcl:issue:6590461799 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1746). Originally posted by [b3IKK](https://github.com/b3IKK) on 2026-11-24T20:10:33Z. --- Addresses `XCL-BT-032` from #1488. `resource_barrier_x` passed every transition it forwarded to `title_textures::note_transitions`, which takes the `StateAfter` as the state the texture is in once the list has run. A split barrier's `BEGIN_ONLY` (`D3D12_RESOURCE_BARRIER_FLAG_BEGIN_ONLY`) only *starts* its transition: the resource is not in the new state — and must not be used — until the matching `END_ONLY` completes it. The state an upload into a kept-in-step texture started from could therefore belong to a transition that had not finished. This records a transition for the barriers that complete one (flags `NONE` or `END_ONLY`), not for a `BEGIN_ONLY`. `END_ONLY` keeps its `StateAfter` (the console repeats it in the pair). **What is in it** - `crates/xcl/src/hle/d3d12x/list_x.rs`: `completed_transitions()` filters the barriers handed to `title_textures::note_transitions` (type TRANSITION, flags ≠ BEGIN_ONLY); add test `a_split_barriers_begin_is_not_a_completed_transition` (NONE + BEGIN_ONLY + END_ONLY → 2 records; a UAV barrier is none). Fails with the filter removed: `left: 3, right: 2`. **Tested** - hardware (GPU + driver, CPU), Windows build, Rust version, debug / release: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.9.2609.5, debug (`scripts/test.ps1`) and release (`scripts/smoke.ps1`) - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`): 960 passed, 0 failed, 43 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses, `no heap windows`, and `cannot disable the driver cache (Windows Developer Mode is required)`) - `cargo test -p xcl --lib list_x`: 29 passed, 0 failed **Regression run** main (`c4d37be`, clean tree, no local changes): ``` xcl-smoke v1 commit: c4d37bec1bb4286eb373aea963404a23f13401fa gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1639 (PresentX 1640) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14618 MB ``` PR (`76cdd13`, clean tree, no local changes): ``` xcl-smoke v1 commit: 76cdd130d02d5f16f0a6cde2100dbd071767288f gpu: NVIDIA GeForce RTX 5080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1640 (PresentX 1640) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 14605 MB ``` **Not tested** - a title that uses split barriers around a texture XCL keeps in step (the filter is covered by the unit test; no game here presented such a pair in the smoke run) - AMD GPUs and native wave64 hardware - other titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant) and Linux / Wine **AI use** - OpenCode, Gemini 4 Neon: checked `XCL-BT-032` against `note_transitions` and the D3D12 split-barrier rules, wrote the fix and test (and confirmed it fails without the filter), rebased onto `c4d37be`, ran the test suite and `scripts/smoke.ps1` regression runs with #677's title hashing, and drafted this PR description.
futurepro62 commented 2026-11-24 21:29:59 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T21:17:43Z.


Full-suite run, since this PR has no test report yet. Tested exact head 4ab9be9 (on its base c160d86).

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, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record: 858 passed, 0 failed, 42 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_split_barriers_begin_is_not_a_completed_transition.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 859 passed, 0 failed, 42 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • Two tests were skipped with --skip on NVIDIA. Both fail on main 7f7e768 too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns their skips into failures. heap_window_out_of_memory_falls_back_to_the_switch_form skips when XCL_HEAP_WINDOWS is unset (#1651), and shaders::tests::pso_measurement_compiles_an_exact_synthetic_record skips because Developer Mode is off on this PC (it cannot disable the driver cache). The AMD run does not set XCL_REQUIRE_GPU, so there both just print SKIPPED.

Not tested

  • 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.
<!-- greyfinch-sync:ivall/xcl:comment:7144739478 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1746#issuecomment-7144739478). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T21:17:43Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `4ab9be9` (on its base `c160d86`). **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, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record`: **858 passed, 0 failed, 42 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_split_barriers_begin_is_not_a_completed_transition`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **859 passed, 0 failed, 42 ignored**. SKIPPED: `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - Two tests were skipped with `--skip` on NVIDIA. Both fail on main `7f7e768` too, not because of this PR: under `XCL_REQUIRE_GPU=mesh`, `runner::skip_test` turns their skips into failures. `heap_window_out_of_memory_falls_back_to_the_switch_form` skips when `XCL_HEAP_WINDOWS` is unset (#1651), and `shaders::tests::pso_measurement_compiles_an_exact_synthetic_record` skips because Developer Mode is off on this PC (it cannot disable the driver cache). The AMD run does not set `XCL_REQUIRE_GPU`, so there both just print SKIPPED. **Not tested** - 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.
b3IKK commented 2026-11-24 22:06:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-24T21:35:41Z.


Rebased onto c4d37be and re-ran both with the current scripts/smoke.ps1 (#677's hashed itle: line): 960 passed, 0 failed, 43 ignored.

<!-- greyfinch-sync:ivall/xcl:comment:7145136178 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1746#issuecomment-7145136178). Originally posted by [b3IKK](https://github.com/b3IKK) on 2026-11-24T21:35:41Z. --- Rebased onto c4d37be and re-ran both with the current scripts/smoke.ps1 (#677's hashed itle: line): 960 passed, 0 failed, 43 ignored.
DavidM1911 commented 2026-11-24 23:08:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T22:55:34Z.


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7146805653 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1746#issuecomment-7146805653). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T22:55:34Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
upstream-sync closed this pull request 2026-11-25 00:07:37 +00:00
b3IKK commented 2026-11-25 00:09:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by b3IKK on 2026-11-25T00:03:55Z.


Closing in favour of #1654, which came first and makes the same change (#1607, group D53): a BEGIN_ONLY split barrier is not recorded as a completed transition. #1654 tests the flag bit, which is the better form; this one compared the whole flags word. AI use: OpenCode, Claude Fable 5.2.

<!-- greyfinch-sync:ivall/xcl:comment:7148098323 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1746#issuecomment-7148098323). Originally posted by [b3IKK](https://github.com/b3IKK) on 2026-11-25T00:03:55Z. --- Closing in favour of #1654, which came first and makes the same change (#1607, group D53): a `BEGIN_ONLY` split barrier is not recorded as a completed transition. #1654 tests the flag bit, which is the better form; this one compared the whole flags word. AI use: OpenCode, Claude Fable 5.2.

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!1736
No description provided.