D3D12.X: canonicalize inactive two-pass stream descriptors #2448

Manually merged
github merged 1 commit from github-bot/gh-2448 into gh-pr/2448/base 2026-11-26 15:01:15 +00:00 AGit
Owner

@⁠ZekkJJ on GitHub · 2026-11-25 19:19 UTC · original
ZekkJJ:codex/two-pass-empty-descriptors → main · +64 −2 · 1 files · 1 commits · merged 2026-11-26 14:56 UTC

Canonicalize inactive two-pass stream descriptors when building the mesh pipeline cache identity. Empty optional shader bytecode contributes the same key as an omitted stage. Active unsupported state, duplicates, and malformed streams still fail closed.

What is in it

  • crates/xcl/src/hle/d3d12x/real/two_pass_identity.rs ignores inert pointers and padding on inactive stream-output, input-layout and view-instancing descriptors.
  • The regression covers empty VS, PS, DS, HS, GS, CS and AS entries. An empty required mesh shader still refuses to produce a key.

Tested

  • Exact head d61ffdc435d5b7c71f4635e4fb06b28eed1328a3 on Windows 11 build 26200.9974, Ryzen 7 8845HS, NVIDIA GeForce RTX 4060 Laptop GPU (616.56), Rust 1.98.1 MSVC, debug. cargo test --offline --locked -p xcl --lib two_pass_identity -- --nocapture --test-threads=1 passed 5 tests with zero failures, ignores or runtime skips.
  • Earlier independent comments report 24 stream tests passed. One tester identified four failures on that lane's existing baseline. The RTX 3060 Ti report reproduced a parallel flake tracked in #1978 and passed on a serial rerun. Those reports predate this head.
  • The exact-head debug workspace built and passed 1,436 tests with 0 failures and 47 ignores using cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output. There were 26 explicit GPU skip markers (21 no native wave64, 3 refused wave32 per-lane operation, 1 Windows Developer Mode unavailable, 1 no heap windows). Clean main at b49be183 passed 1,435 with 0 failures, 47 ignores, and 26 runtime skip markers.
  • The first four-thread attempt hit the asynchronous dispatch segment-count assertion (295 versus 421). The isolated check and full suite passed on both clean main and the PR rerun.

Regression run

Clean release builds on the same RTX 4060 Laptop GPU and retail workload. XCL used a separate title state and DXIL cache for each run.

Main

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 4060 Laptop GPU
title: Retail workload A
seconds: 60
exit: 0x0
frames shown: 560 (PresentX 560)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14812 MB

PR head

xcl-smoke v1
commit: d61ffdc435d5b7c71f4635e4fb06b28eed1328a3
gpu: NVIDIA GeForce RTX 4060 Laptop GPU
title: Retail workload A
seconds: 60
exit: 0x0
frames shown: 620 (PresentX 620)
presents per 2 s (last 3): 36 39 37
device removals: 0
crashes: 0
peak commit: 15263 MB

Not tested

  • Independent AMD hardware on this head. Retail coverage of the inactive-descriptor path remains unverified.

AI use

OpenAI Codex (gpt-6.2-sol) rebased, expanded coverage, ran tests, and prepared this description.

**@⁠ZekkJJ** on GitHub · 2026-11-25 19:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/2448) `ZekkJJ:codex/two-pass-empty-descriptors` → `main` · +64 −2 · 1 files · 1 commits · merged 2026-11-26 14:56 UTC Canonicalize inactive two-pass stream descriptors when building the mesh pipeline cache identity. Empty optional shader bytecode contributes the same key as an omitted stage. Active unsupported state, duplicates, and malformed streams still fail closed. **What is in it** - `crates/xcl/src/hle/d3d12x/real/two_pass_identity.rs` ignores inert pointers and padding on inactive stream-output, input-layout and view-instancing descriptors. - The regression covers empty VS, PS, DS, HS, GS, CS and AS entries. An empty required mesh shader still refuses to produce a key. **Tested** - Exact head `d61ffdc435d5b7c71f4635e4fb06b28eed1328a3` on Windows 11 build 26200.9974, Ryzen 7 8845HS, NVIDIA GeForce RTX 4060 Laptop GPU (616.56), Rust 1.98.1 MSVC, debug. `cargo test --offline --locked -p xcl --lib two_pass_identity -- --nocapture --test-threads=1` passed 5 tests with zero failures, ignores or runtime skips. - Earlier independent comments report 24 stream tests passed. One tester identified four failures on that lane's existing baseline. The RTX 3060 Ti report reproduced a parallel flake tracked in #1978 and passed on a serial rerun. Those reports predate this head. - The exact-head debug workspace built and passed 1,436 tests with 0 failures and 47 ignores using `cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output`. There were 26 explicit GPU skip markers (21 no native wave64, 3 refused wave32 per-lane operation, 1 Windows Developer Mode unavailable, 1 no heap windows). Clean main at `b49be183` passed 1,435 with 0 failures, 47 ignores, and 26 runtime skip markers. - The first four-thread attempt hit the asynchronous dispatch segment-count assertion (295 versus 421). The isolated check and full suite passed on both clean main and the PR rerun. **Regression run** Clean release builds on the same RTX 4060 Laptop GPU and retail workload. XCL used a separate title state and DXIL cache for each run. Main ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: NVIDIA GeForce RTX 4060 Laptop GPU title: Retail workload A seconds: 60 exit: 0x0 frames shown: 560 (PresentX 560) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14812 MB ``` PR head ``` xcl-smoke v1 commit: d61ffdc435d5b7c71f4635e4fb06b28eed1328a3 gpu: NVIDIA GeForce RTX 4060 Laptop GPU title: Retail workload A seconds: 60 exit: 0x0 frames shown: 620 (PresentX 620) presents per 2 s (last 3): 36 39 37 device removals: 0 crashes: 0 peak commit: 15263 MB ``` **Not tested** - Independent AMD hardware on this head. Retail coverage of the inactive-descriptor path remains unverified. **AI use** OpenAI Codex (gpt-6.2-sol) rebased, expanded coverage, ran tests, and prepared this description.
Zero-count stream output, input layouts, and view instancing can carry inert pointer values and padding. Treat them and empty optional shader bytecode as omitted so the stream remains eligible for a stable two-pass cache key. Preserve rejection of unsupported active state.

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

@⁠SlopTart on GitHub · 2026-11-25 20:02 UTC · original

gpu_ suite (cold cache): 160 passed / 4 failed, no crashes. The four are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, depth-buffer state refusal, and gpu_promoted_uav_clear_values_pass_create_committed_resource (report); none caused by this PR.
Targeted run of the stream-related tests: 24 passed.

**@⁠SlopTart** on GitHub · 2026-11-25 20:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/2448#issuecomment-7173110727) `gpu_` suite (cold cache): 160 passed / 4 failed, no crashes. The four are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, depth-buffer state refusal, and `gpu_promoted_uav_clear_values_pass_create_committed_resource` ([report](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2280)); none caused by this PR. Targeted run of the stream-related tests: 24 passed.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 20:29 UTC · original

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

  • cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 20:29 UTC · [original](https://github.com/xcl-dev/xcl/pull/2448#issuecomment-7173743073) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun. Thanks!
github-bot force-pushed github-bot/gh-2448 from 01cb4892f4 to d61ffdc435 2026-11-26 08:41:28 +00:00 Compare
Author
Owner

@⁠bmjask on GitHub · 2026-11-25 21:03 UTC · original · reviewed

No concrete correctness defect found. Inactive descriptor canonicalization keys semantic count/flags rather than pointers/padding while retaining active/duplicate/unknown rejection; current Windows CI is green. This runtime change is not merge-ready because paired retail smoke runs are explicitly pending and description checks fail. Nonblocking coverage gap: regression uses only zero-length VS; broader optional-stage cases would strengthen it.

**@⁠bmjask** on GitHub · 2026-11-25 21:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/2448#pullrequestreview-6064948252) · **reviewed** No concrete correctness defect found. Inactive descriptor canonicalization keys semantic count/flags rather than pointers/padding while retaining active/duplicate/unknown rejection; current Windows CI is green. This runtime change is not merge-ready because paired retail smoke runs are explicitly pending and description checks fail. Nonblocking coverage gap: regression uses only zero-length VS; broader optional-stage cases would strengthen it.
Author
Owner

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

Tested on \d61ffdc435\ (\d61ffdc4, clean PR head):

  • Hardware / OS / Toolchain: NVIDIA GeForce RTX 3060 12 GB (driver \32.0.15.8142\ / 581.42, wave32), Intel Core i5-10400, Windows 11 (NT \10.0.22631.0),
    ustc 1.100.0\ (\x86_64-pc-windows-msvc), DXC \1.8.2502.11\ (Windows SDK \10.0.26100.0), debug profile, \XCL_ADAPTER=nvidia.
  • Focused run (\cargo test -p xcl --lib two_pass_identity -- --nocapture): 5 passed, 0 failed, 0 ignored (\1332 filtered out, 0 \SKIPPED).
  • Workspace suite (\cargo test --workspace --no-fail-fast -- --test-threads=4): 1421 passed, 5 failed, 47 ignored (1308 lib + 113 integration; +1 passed over \origin/main\ \49be183's 1420 passed / 5 failed / 47 ignored).
    • The 5 failures are the same 5 pre-existing \ID3D12PipelineState::GetCachedBlob()\ failures observed on \origin/main\ \49be183\ on this driver/setup (\passthrough_mesh_stream_accepts_a_triangle_driver_blob, \split_compute_program_prebuilds_and_caches_chain_pieces, \split_compute_prefers_the_offline_whole_pipeline, \offline_compute_pipeline_is_reused_by_a_second_process, \offline_split_compute_pipeline_is_reused_by_a_second_process).
    • \SKIPPED\ checks: 20
      o wave64, 3 per-lane #1426\ refusals, 2 no D3D12 debug layer, 1 \cannot disable the driver cache (0x887A002D), 1
      o heap windows.

Not tested

  • AMD / Intel GPUs, Linux / Wine, \XCL_SAMPLE_*\ tests (unset), and \scripts/smoke.ps1\ (no retail title folder here).

AI use

  • Antigravity (\Gemini 4 Hydrogen (Low)) checked out \d61ffdc4, ran \ wo_pass_identity\ and the workspace suite on this machine, and drafted this report.
**@⁠Lum7nt** on GitHub · 2026-11-26 09:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/2448#issuecomment-7187349868) **Tested** on \d61ffdc435d5b7c71f4635e4fb06b28eed1328a3\ (\d61ffdc4\, clean PR head): - **Hardware / OS / Toolchain:** NVIDIA GeForce RTX 3060 12 GB (driver \32.0.15.8142\ / 581.42, wave32), Intel Core i5-10400, Windows 11 (NT \10.0.22631.0\), \ ustc 1.100.0\ (\x86_64-pc-windows-msvc\), DXC \1.8.2502.11\ (Windows SDK \10.0.26100.0\), debug profile, \XCL_ADAPTER=nvidia\. - **Focused run (\cargo test -p xcl --lib two_pass_identity -- --nocapture\):** **5 passed, 0 failed, 0 ignored** (\1332 filtered out\, 0 \SKIPPED\). - **Workspace suite (\cargo test --workspace --no-fail-fast -- --test-threads=4\):** **1421 passed, 5 failed, 47 ignored** (1308 lib + 113 integration; +1 passed over \origin/main\ \49be183\'s 1420 passed / 5 failed / 47 ignored). - The 5 failures are the same 5 pre-existing \ID3D12PipelineState::GetCachedBlob()\ failures observed on \origin/main\ \49be183\ on this driver/setup (\passthrough_mesh_stream_accepts_a_triangle_driver_blob\, \split_compute_program_prebuilds_and_caches_chain_pieces\, \split_compute_prefers_the_offline_whole_pipeline\, \offline_compute_pipeline_is_reused_by_a_second_process\, \offline_split_compute_pipeline_is_reused_by_a_second_process\). - \SKIPPED\ checks: 20 \ o wave64\, 3 per-lane \#1426\ refusals, 2 no D3D12 debug layer, 1 \cannot disable the driver cache (0x887A002D)\, 1 \ o heap windows\. **Not tested** - AMD / Intel GPUs, Linux / Wine, \XCL_SAMPLE_*\ tests (unset), and \scripts/smoke.ps1\ (no retail title folder here). **AI use** - Antigravity (\Gemini 4 Hydrogen (Low)\) checked out \d61ffdc4\, ran \ wo_pass_identity\ and the workspace suite on this machine, and drafted this report.
Author
Owner

@⁠ZekkJJ on GitHub · 2026-11-26 09:07 UTC · original

@⁠bmjask The rebased head is d61ffdc4. The regression now covers zero-length VS, PS, DS, HS, GS, CS and AS, and still rejects an empty required MS. All 5 identity tests passed.

The RTX 4060 Laptop full-suite rerun passed 1,436 with 0 failures, 47 ignores, and 26 runtime skip markers. The initial asynchronous dispatch assertion passed in isolation on clean main and this head, and passed in both full suites on rerun. The paired retail smoke recorded 620 frames against main's 560, peak commit 15,263 MB against 14,812 MB, and zero crashes or device removals. Both unedited blocks are in the description.

**@⁠ZekkJJ** on GitHub · 2026-11-26 09:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/2448#issuecomment-7187468747) @⁠bmjask The rebased head is [`d61ffdc4`](https://github.com/xcl-dev/xcl/commit/d61ffdc435d5b7c71f4635e4fb06b28eed1328a3). The regression now covers zero-length VS, PS, DS, HS, GS, CS and AS, and still rejects an empty required MS. All 5 identity tests passed. The RTX 4060 Laptop full-suite rerun passed 1,436 with 0 failures, 47 ignores, and 26 runtime skip markers. The initial asynchronous dispatch assertion passed in isolation on clean main and this head, and passed in both full suites on rerun. The paired retail smoke recorded 620 frames against main's 560, peak commit 15,263 MB against 14,812 MB, and zero crashes or device removals. Both unedited blocks are in the description.
Author
Owner

@⁠Prime1997 on GitHub · 2026-11-26 11:49 UTC · original · reviewed

Read-through and test run of d61ffdc4. An AI tool (Claude Code) helped with the reading and ran the tests; each point below was checked against the code at this head.

Test results (RTX 3060 Ti 8 GB, NVIDIA 617.14 / 32.0.16.1714, i5-10400, Windows 11 26200.9974, rustc 1.100.0, DXC 1.9.2609.5, debug): the focused test command from the description gives 5 passed, 0 failed. To be clear about what that shows: those five tests are CPU-only. They never create a device, so this is not a GPU validation of the change, only confirmation that the key logic behaves as the tests describe on this toolchain. The stream tests that do create a device also pass at this head: --lib mesh_stream 3 passed, 0 failed, and --test d3d12_mesh_stream 3 passed, 0 failed.

Points for the author

  1. A shader entry with BytecodeLength == 0 (and type other than 25) is skipped with continue, so it is keyed the same as an omitted entry whatever its pointer is. The description says so, and empty_stream_descriptors_do_not_change_the_key pins it for seven stages with a non-null pointer and for the refused empty MS. I think that is the right call.
  2. The new fail-closed conditions (NumEntries, NumStrides, RasterizedStream, ViewInstanceCount, Flags) have no negative tests. One test per condition showing the key is refused would protect them from a later refactor.
  3. I found no change to the key of any descriptor that was already accepted, which matches the description.
  4. Nothing on main calls two_pass_stream_key yet. The change only takes effect together with #1942 (or on the nvidia-dev line), so it would help reviewers if the description said which order the two are meant to land in.

Low risk as it stands. Point 2 is a test gap rather than a defect.


Generated by Claude Code

**@⁠Prime1997** on GitHub · 2026-11-26 11:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/2448#pullrequestreview-6073633059) · **reviewed** Read-through and test run of d61ffdc4. An AI tool (Claude Code) helped with the reading and ran the tests; each point below was checked against the code at this head. **Test results** (RTX 3060 Ti 8 GB, NVIDIA 617.14 / 32.0.16.1714, i5-10400, Windows 11 26200.9974, rustc 1.100.0, DXC 1.9.2609.5, debug): the focused test command from the description gives 5 passed, 0 failed. To be clear about what that shows: those five tests are CPU-only. They never create a device, so this is not a GPU validation of the change, only confirmation that the key logic behaves as the tests describe on this toolchain. The stream tests that do create a device also pass at this head: `--lib mesh_stream` 3 passed, 0 failed, and `--test d3d12_mesh_stream` 3 passed, 0 failed. **Points for the author** 1. A shader entry with `BytecodeLength == 0` (and type other than 25) is skipped with `continue`, so it is keyed the same as an omitted entry whatever its pointer is. The description says so, and `empty_stream_descriptors_do_not_change_the_key` pins it for seven stages with a non-null pointer and for the refused empty MS. I think that is the right call. 2. The new fail-closed conditions (NumEntries, NumStrides, RasterizedStream, ViewInstanceCount, Flags) have no negative tests. One test per condition showing the key is refused would protect them from a later refactor. 3. I found no change to the key of any descriptor that was already accepted, which matches the description. 4. Nothing on main calls `two_pass_stream_key` yet. The change only takes effect together with #1942 (or on the nvidia-dev line), so it would help reviewers if the description said which order the two are meant to land in. Low risk as it stands. Point 2 is a test gap rather than a defect. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠gsucristo on GitHub · 2026-11-26 14:23 UTC · original · approved these changes

Reviewed d61ffdc4 (crates/xcl/src/hle/d3d12x/real/two_pass_identity.rs). Looks clean and sound:

  • Inactive descriptor canonicalization: Checking NumEntries/NumStrides/RasterizedStream for D3D12_STREAM_OUTPUT_DESC (7), NumElements for D3D12_INPUT_LAYOUT_DESC (12), and ViewInstanceCount/Flags for D3D12_VIEW_INSTANCING_DESC (22) covers every semantic non-pointer field of those structs while ignoring inert pointers and struct padding. Active counts/flags still fail closed even when the accompanying pointer is null.
  • Empty optional shader stages: Skipping BytecodeLength == 0 when ty != 25 makes empty optional stages canonicalize identically to omitted stages regardless of pShaderBytecode, while an empty required MS (25) or any non-zero BytecodeLength with a null/unreadable pointer still fails closed via payload_shader.
  • Invariants & cache compatibility: Duplicate-subobject and stream-length checks still run before the match loop, and previously accepted streams produce the exact same key, so no TWO_PASS_CACHE_SCHEMA bump is needed.
  • Test coverage: empty_stream_descriptors_do_not_change_the_key covers all three inactive descriptors (including dirty INPUT_LAYOUT trailing padding), all seven optional shader stages with non-null pointers, and the rejected empty MS. Non-blocking: adding negative cases for the newly split STREAM_OUTPUT and VIEW_INSTANCING non-zero count/flag conditions (especially with null pointers) would further lock down the fail-closed paths, as also noted above.

LGTM.

**@⁠gsucristo** on GitHub · 2026-11-26 14:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/2448#pullrequestreview-6075758369) · **approved these changes** Reviewed `d61ffdc4` (`crates/xcl/src/hle/d3d12x/real/two_pass_identity.rs`). Looks clean and sound: - **Inactive descriptor canonicalization**: Checking `NumEntries`/`NumStrides`/`RasterizedStream` for `D3D12_STREAM_OUTPUT_DESC` (7), `NumElements` for `D3D12_INPUT_LAYOUT_DESC` (12), and `ViewInstanceCount`/`Flags` for `D3D12_VIEW_INSTANCING_DESC` (22) covers every semantic non-pointer field of those structs while ignoring inert pointers and struct padding. Active counts/flags still fail closed even when the accompanying pointer is null. - **Empty optional shader stages**: Skipping `BytecodeLength == 0` when `ty != 25` makes empty optional stages canonicalize identically to omitted stages regardless of `pShaderBytecode`, while an empty required `MS` (25) or any non-zero `BytecodeLength` with a null/unreadable pointer still fails closed via `payload_shader`. - **Invariants & cache compatibility**: Duplicate-subobject and stream-length checks still run before the match loop, and previously accepted streams produce the exact same key, so no `TWO_PASS_CACHE_SCHEMA` bump is needed. - **Test coverage**: `empty_stream_descriptors_do_not_change_the_key` covers all three inactive descriptors (including dirty `INPUT_LAYOUT` trailing padding), all seven optional shader stages with non-null pointers, and the rejected empty `MS`. Non-blocking: adding negative cases for the newly split `STREAM_OUTPUT` and `VIEW_INSTANCING` non-zero count/flag conditions (especially with null pointers) would further lock down the fail-closed paths, as also noted above. LGTM.
Author
Owner

@⁠ZekkJJ on GitHub · 2026-11-26 14:31 UTC · original

@⁠gsucristo @⁠Prime1997 Thanks for the reviews. #2448 can land before #1942. Additional negative tests for active descriptor fields would strengthen coverage without changing the existing cache schema.

**@⁠ZekkJJ** on GitHub · 2026-11-26 14:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/2448#issuecomment-7194933668) @⁠gsucristo @⁠Prime1997 Thanks for the reviews. #2448 can land before #1942. Additional negative tests for active descriptor fields would strengthen coverage without changing the existing cache schema.
github-bot changed target branch from main to gh-pr/2448/base 2026-11-26 15:01:13 +00:00
github manually merged commit d61ffdc435 into gh-pr/2448/base 2026-11-26 15:01:15 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.