Skip to content

Shaders: support pixel shaders and direct DXIL in --measure-pso - #2438

Open
emusynths wants to merge 1 commit into
xcl-dev:mainfrom
emusynths:nvidia_pso_compilation_wall
Open

emusynths wants to merge 1 commit into
xcl-dev:mainfrom
emusynths:nvidia_pso_compilation_wall

Conversation

@emusynths

@emusynths emusynths commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Extend xcl shaders --measure-pso so it can time cache-off CreateGraphicsPipelineState for console pixel shaders (in addition to compute shaders) and follow XCL_DIRECT_DXIL (1 for CS, all for CS/PS) alongside XCL_HEAP_WINDOWS. This gives workstreams 5 and 6 a reproducible upstream tool for measuring the cold NVIDIA graphics/PS compilation wall without a private local harness.

Part of #2088.

What is in it

  • crates/xcl/src/shaders.rs: add pixel_interface, measure_passthrough_vs_hlsl, measure_graphics_rtv_dsv, and measure_graphics_pso_desc to synthesize a minimal matching passthrough VS and RTV/DSV formats from PsInterface, update measure_pso_result to handle both compute and pixel containers across HLSL and XCL_DIRECT_DXIL, and add unit/GPU tests (passthrough_vs_and_rtv_formats_match_ps_interface, pso_measurement_compiles_an_exact_synthetic_pixel_record, passthrough_vs_links_with_translated_pixel_shader).
  • Added depth-only and sparse mixed-format GPU cases, 4x MSAA coverage, and an end-to-end --pso-samples test that checks the descriptor used by the CLI.

Tested

  • Hardware: NVIDIA GeForce RTX 5090 32 GB (driver 621.01, wave32-only), AMD Ryzen 9 5950X, 64 GB RAM, Windows 11 26300, rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5, debug tests / release smoke runs.
  • Clean head c636e54. cargo build --workspace succeeded. cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output reported 1424 passed, 4 failed, 46 ignored and 26 SKIPPED notices (1 driver cache control, 1 heap windows unavailable, 21 no wave64, 3 unsupported per-lane translation). The four NVIDIA compute fuzz failures match DXIL GPU fuzz tests reproducibly fail with E_OUTOFMEMORY on RTX 5060 #1905.
  • cargo test -p xcl --test shaders_e2e measure_pixel_pso_uses_requested_samples -- --nocapture ran on the RTX 5090 (1 passed, 0 failed, 0 ignored, 0 skipped). Release retail CLI with XCL_DIRECT_DXIL=all and XCL_TRANSLATED_CACHE=0, record 34253cc8188405fd, --windows 4 --repeat 1 --pso-samples 4: 10.336 s for one cache-off compile.
  • Independent RTX 3080 Ti debug-layer testing on 6bd684d with a local test fixture reported successful sparse MRT, depth-only, and four-sample coverage PSO creation with zero error/corruption messages. That run used a test-only sample-count override. Report by thehollowedone.

Regression run
60 seconds per build, XCL_PRESS_AT=18:A,30:A,44:A,52:A and XCL_FRAME_DUMP=300.

main

xcl-smoke v1
commit: 6d12f58a229bc73889878a448c64dc3af25eeba0
gpu: NVIDIA GeForce RTX 5090
title: a155fb60
seconds: 60
exit: 0x0
frames shown: 1448 (PresentX 1449)
presents per 2 s (last 3): 53 17 12
device removals: 0
crashes: 0
peak commit: 20887 MB

PR head

xcl-smoke v1
commit: c636e54230da4b01a7aca80205d962734ac95757
gpu: NVIDIA GeForce RTX 5090
title: a155fb60
seconds: 60
exit: 0x0
frames shown: 1411 (PresentX 1411)
presents per 2 s (last 3): 31 9 3
device removals: 0
crashes: 0
peak commit: 23308 MB

Not tested
AMD, Intel, native wave64 and title-specific blend or vertex shader state on this revision.

AI use

  • Antigravity (Gemini 4 Neon): inspected the codebase, wrote the implementation and unit/GPU tests, ran the test suite and smoke runs, and drafted this PR description.
  • Codex (GPT-6) prepared the initial review follow-up. Codex (gpt-6.2-astra) completed the update and ran the reported workspace and post-push smoke checks.

@emirduran707

Copy link
Copy Markdown
Contributor

Independent AMD RDNA4 (native wave64) test report on exact head 6bd684d5aac41b4ed07827e801fe5aadd9cd3cf6 (clean detached checkout, no local changes).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1350 passed, 3 failed, 46 ignored; 9 SKIPPED (6 in lower_dxil::tests::{f16,f32}_programs_on_the_gpu refused by per-lane form; heap_window_out_of_memory_falls_back_to_the_switch_form; shaders::tests::pso_measurement_compiles_an_exact_synthetic_record and shaders::tests::pso_measurement_compiles_an_exact_synthetic_pixel_record — both skipped because Windows Developer Mode is off so the driver cache cannot be disabled).

Regression run (60 s retail-title smoke, XCL_NETWORK=0, release)

xcl-smoke v1
commit: 6bd684d5aac41b4ed07827e801fe5aadd9cd3cf6
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1539 (PresentX 1539)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14012 MB

(Matched main 68a284a baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • pso_measurement_compiles_an_exact_synthetic_pixel_record (skipped: Developer Mode off); D3D12 debug layer; Intel GPUs.

AI use

  • Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.

@SlopTart

Copy link
Copy Markdown

gpu_ suite (cold cache): 160 passed / 4 failed, no crashes. Three are the known baseline trio on this lane; the fourth is gpu_promoted_uav_clear_values_pass_create_committed_resource, newly red on main since #2280 (report), unrelated to this PR.
Targeted run of passthrough_vs_and_rtv_formats_match_ps_interface, passthrough_vs_links_with_translated_pixel_shader, pso_measurement_compiles_an_exact_synthetic_pixel_record and friends: 4 passed.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

  • cargo test -p xcl --lib: 1 real failure, deterministic (also fails --test-threads=1, 1219/1):
gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier
  assertion failed: group barriers in the program (lower_dxil.rs:1155)

The lowered program is missing an expected group barrier (or emits one where none is expected). Needs a fix before merge.

— Devin

@bmjask bmjask left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No concrete source-level defect found. High-merit measurement functionality, but not merge-ready: the current head has no Windows Build/test check, and real GPU validation covers only one synthetic pixel shader. Please add representative CreateGraphicsPipelineState coverage for depth-only, coverage/MSAA, sparse/non-contiguous RT outputs, and varied formats—or explicitly narrow supported inputs—then provide current CI. The CLI is also not covered by the smoke run.

@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 25, 2026
@thehollowedone

Copy link
Copy Markdown

Independent synthetic NVIDIA check of #2438 head 6bd684d, aimed at the requested graphics-descriptor coverage. This was the PR head plus one uncommitted test-only fixture in a disposable checkout; the production code was unchanged.

On Windows 11 build 26300, RTX 3080 Ti / driver 621.35, Ryzen 7 9800X3D, DXC 1.8.2502.11, I compiled synthetic HLSL pixel shaders, paired them with the PR's measure_passthrough_vs_hlsl, built descriptors through measure_graphics_pso_desc, and called native CreateGraphicsPipelineState with the D3D12 debug layer enabled:

  • Sparse mixed-format outputs: float SV_Target0, unbound slot 1, uint SV_Target2; NumRenderTargets=3, slot 1 UNKNOWN, other slots R32G32B32A32_FLOAT / _UINT. Creation passed.
  • Depth-only output: SV_Depth, NumRenderTargets=0, DSVFormat=D32_FLOAT. Creation passed.
  • SV_Target0 plus SV_Coverage: confirmed support for four samples, then changed SampleDesc.Count from the CLI's 1 to 4 for this test only. Creation passed.

cargo test --offline --locked -p xcl --lib shaders::tests::synthetic_graphics_pso_descriptor_variants_create_on_gpu -- --exact --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored, 0 skipped (all three cases). D3D12 InfoQueue reported 0 error/corruption messages. This local fixture is not yet a committed regression test.

Not tested: cold ShaderCacheControl timing (it returns 0x887A002D on this setup), a real retail pixel shader pack, graphics execution/readback, or the title's actual graphics PSO descriptor. The four-sample override does not mean the current CLI measures MSAA PSOs.

AI-assisted: Codex (GPT-6, exact variant unavailable) wrote and ran the local fixture and drafted this report.

@emusynths
emusynths force-pushed the nvidia_pso_compilation_wall branch from 6bd684d to c636e54 Compare November 25, 2026 21:27
@emusynths

Copy link
Copy Markdown
Contributor Author

@bmjask, please take another look at c636e54. The RTX 5090 now creates depth-only, sparse mixed-format, and 4× MSAA coverage PSOs in the GPU tests. A new end-to-end test verifies that the CLI uses four samples, and a retail cache-off CLI run succeeded. The PR description has the full-suite results and post-push smoke pair. Thanks to @thehollowedone for the independent debug-layer check on the earlier head.

@thehollowedone

Copy link
Copy Markdown

Independent Windows/NVIDIA check of #2438 head c636e54 on an RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Windows 11 build 26300, rustc 1.99.1, DXC 1.8.2502.11. The checkout was clean for these stock results:

  • cargo test --offline --locked -p xcl --lib measure_graphics_pso_links_representative_pixel_signatures -- --test-threads=1 --nocapture: 1 passed, 0 failed, no skip. The stock test creates depth-only, sparse mixed-format render-target, and 4× MSAA coverage PSOs.
  • cargo test --offline --locked -p xcl --lib pso_measurement_compiles_an_exact_synthetic_pixel_record -- --test-threads=1 --nocapture: 1 passed, 0 failed, no skip, with XCL_D3D12_DEBUG unset.
  • cargo test --offline --locked -p xcl --test shaders_e2e measure_pixel_pso_uses_requested_samples -- --test-threads=1 --nocapture: 1 passed, 0 failed, no skip; its assertion checks graphics PSO samples: 4 and the cache-off result.
  • cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4: 1,428 passed, 0 failed, 46 ignored across 37 test binaries. 26 explicit SKIPPED notices: 21 no wave64, 3 unsupported f16 forms, 1 no heap windows, and 1 existing compute PSO cache-control check rejected by the driver with 0x80070057. All three focused tests above ran and passed in this suite.

I also reproduced a separate debug-layer initialization bug in the pixel PSO measurement path: setting XCL_D3D12_DEBUG=1 made the stock pso_measurement_compiles_an_exact_synthetic_pixel_record fail twice at CreateRootSignature with 0x887A0005 (device suspended). measure_pso_result creates a device through Pipelines::new, then calls runner::graphics_wave32(); runner initialization enables the debug layer after the first device exists. The Agility helper already warns that late enabling can remove an existing device.

This five-line local change in Pipelines::new enables the requested layer before it creates its device:

@@ impl Pipelines::new()
         unsafe {
+            if crate::state::config().d3d12_debug || std::env::var_os("XCL_D3D12_DEBUG").is_some() {
+                if let Err(e) = crate::gpu::agility::enable_debug_layer() {
+                    return Err(format!("D3D12 debug layer: {e}"));
+                }
+            }
             let factory: IDXGIFactory6 = CreateDXGIFactory2(...);

With that isolated, uncommitted change, the previously failing focused test passed 1/0 under XCL_D3D12_DEBUG=1; the representative graphics PSO and CLI 4× sample tests also passed 1/0 each, with no skips. The full-suite counts above are from the unmodified PR head. No retail title or AMD hardware was tested. AI use: Codex (GPT-6; exact variant unavailable) traced the code, wrote and ran the local fix, and drafted this report.

Extend xcl shaders --measure-pso to accept console pixel shader containers in addition to compute shaders, synthesizing a minimal matching passthrough VS and RTV/DSV formats from PsInterface and timing cache-off CreateGraphicsPipelineState. Also honor XCL_DIRECT_DXIL (1 for CS, all for CS/PS) alongside XCL_HEAP_WINDOWS.

Part of xcl-dev#2088

@thehollowedone reproduced the late debug-layer initialization failure on an RTX 3080 Ti and proposed and verified enabling the layer in Pipelines::new before device creation. xcl-dev#2438 (comment)

Assisted-by: Antigravity (Gemini 4 Neon)
Assisted-by: Codex (GPT-6)
Assisted-by: Codex (gpt-6.2-astra)
@emusynths
emusynths force-pushed the nvidia_pso_compilation_wall branch from c636e54 to 90bfbd4 Compare November 26, 2026 00:28
@DavidM1911

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants