dxil: emit InnerCoverage, ShadingRate, MeshDerivatives, and 64UAVs flags in graphics shaders #2441
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2451"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-25T19:24:25Z.
Emit four DXIL shader-flag and
SFI0feature bits inShader::try_finish_graphicsthatdxil.dllrequires when the corresponding graphics features are used:InnerCoverage,ShadingRate,DerivativesInMeshAndAmpShaders, and64UAVs. Part of #1401. Part of #1833.What is in it
crates/xcl/src/gpu/dxil/graphics.rs(Shader::try_finish_graphics):self.bindingswithResClass::Uav) and emit64UAVs(flags |= 1 << 15,sfi0 |= 0x8) across vertex, pixel, and mesh shaders whenever more than 8 static UAVs are bound (while preservingUavsAtEveryStage1 << 16/0x4for vertex shaders with any static UAV).ShadingRate(flags |= 1 << 24,sfi0 |= 0x8_0000) whenStage::Vertexoutputs orStage::Pixelinputs containSemKind::ShadingRate(excludingStage::Meshprimitive outputs, matching DXC).optimize()instructions onStage::PixelandStage::Meshto emitInnerCoverage(flags |= 1 << 10,sfi0 |= 0x400) whendx.op.innerCoverage.(op 92) survives, andDerivativesInMeshAndAmpShaders(flags |= 1 << 29,sfi0 |= 0x100_0000) when mesh derivative or implicit-LOD ops (dx.op.unary.ops83..=86,dx.op.sample.op60,dx.op.sampleBias.op61,dx.op.sampleCmp.op64,dx.op.calculateLOD.op81) survive; eliminated calls in unreachable blocks and dead-code-eliminated derivatives do not emit spurious flags.crates/xcl/src/gpu/dxil/graphics_tests.rs:ps_inner_coverage_sets_flag_only_when_live,shading_rate_sets_flag_for_vs_and_ps_but_not_ms,ms_derivatives_and_implicit_lod_set_flag_but_explicit_lod_does_not,graphics_64_uavs_flag_tracks_static_uav_count) assertingvalidate::validate, exactSFI0values, disassembly metadata flags, and negative guards (unreachable inner coverage, mesh primitive shading rate, explicitsample_leveland DCE'd mesh derivative, 8 static UAVs, and a single UAV at registeru8).Tested
dxil.dll1.9.2609.5, release build.graphics.rsfix (onorigin/main943043e): all 4 new tests failed (0 passed, 4 failedon missingSFI0bits).cargo test --release -p xcl --lib -- gpu::dxil::graphics::tests:: --nocapture:29 passed, 0 failed, 0 ignored(0.28 s,0skipped).XCL_ADAPTER=warp:29 passed, 0 failed, 0 ignored(0.03 s;0skipped on the 4 new tests,2pre-existing draw tests skipped:no wave64).cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture(RTX 4060):1367 passed, 0 failed, 46 ignoredacross24test binaries (184/184gpu::dxil::*passed;29pre-existingSKIPPEDGPU/environment checks:21no wave64,3per-lane wave32 refused,3no D3D12 debug layer,1no heap windows,1cannot disable driver cache;0skipped ingpu::dxil::graphics::tests).Regression run
main:
PR:
Not tested
d3d12SDKLayers.dll.AI use
graphics.rs, wrote the DXC-validated tests ingraphics_tests.rs, ran the test/smoke suites, and drafted this PR description.Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T19:41:12Z.
Independent AMD RDNA4 (native wave64) test report on exact head
2e6e6ab8d6d8e453947020d777ca335630d85940(clean detached checkout, no local changes).Tested
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: 1365 passed, 2 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record). Allgpu::dxil::graphics_testsand native wave64 GPU tests ran and passed.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599) are pre-existing on unmodifiedmainon this GPU.Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T20:02:46Z.
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, andgpu_promoted_uav_clear_values_pass_create_committed_resource(report); none caused by this PR.Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T20:34:27Z.
Review: COMMENTED
No concrete source-level defect found. Post-opt scans, stage gates, and 64-UAV detection look correct; focused SFI0/metadata/container tests and current Windows CI are green, with AMD/NVIDIA evidence. Residual gap is only the disclosed absence of a live title exercising VRS, inner coverage, or mesh implicit-LOD rendering; I found no blocker.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T20:21:57Z.
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!
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-27T18:00:48Z.
Tested on AMD / Linux:
2e6e6ab8(RX 9070 16 GB, RDNA4, Mesa 26.3.1 RADV; Ryzen 5 9600X, 32 GB; CachyOS; Proton Experimentalexperimental-11.0-20261112with vkd3d-proton masterec207194plus a local patch dropping thelpVtblchecks of command allocators and lists; DXC 1.9.2609.5; Rust 1.96.0,x86_64-pc-windows-gnudebug build, tests run under Wine)The head as it is (not merged onto current
main), with its base2898511athe same session as the baseline.Tests (
XCL_REQUIRE_GPU=wave64)cargo test -p xcl --lib -- ps_inner_coverage_sets_flag_only_when_live shading_rate_sets_flag_for_vs_and_ps_but_not_ms ms_derivatives_and_implicit_lod_set_flag_but_explicit_lod_does_not graphics_64_uavs_flag_tracks_static_uav_count --test-threads=1: 4 passed, 0 failed, 0 ignored.cargo test -p xcl --lib -- gpu::dxil::graphics --test-threads=1: 29 passed, 0 failed, 0 ignored.cargo test --workspace --no-fail-fast -- --test-threads=4with--skip compositor_blends_ui_plane_over_scene_plane --skip failed_restore_stops_before_importing_an_unbacked_window --skip grooming_leaves_a_window_under_1_gib_only_its_hole(the first loses the RADV device here, the other two run out of memory under Wine): lib 1277 passed, 10 failed, 26 ignored; base2898511alib (same flags): 1261 passed, 22 failed, 26 ignored. All of this head's failures are among the base's; the base fails 12 more (texture, sparse, vram and a few other tests). The other binaries fail the same 3 tests as onmainhere (e2e,pls_quota,predication_e2e).Not tested
AI use
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T23:26:18Z.
merge-check claim
head:
2e6e6ab8d6Imported from ivall/xcl. Originally posted by throny on 2026-11-29T00:11:35Z.
merge-check
base:
851bf7f9head:
2e6e6ab8d6merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2600 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at
851bf7f9: 2596 passed, 0 failed, 49 ignored.review: no blocking finding; all hunks read. The four flag bits match the compiler's numbering (64 UAVs, inner coverage, shading rate, derivatives in mesh shaders) and the opcodes that set them are the right ones. On current main only the 64-UAV flag can actually be set, because the direct translator builds no shader that emits the other three features; every GPU that runs this path has 64 UAVs, so no shader that worked before can be refused. To know for later: once the translator emits shading rate, inner coverage or mesh derivatives, a GPU without the matching feature will refuse such a shader, which is then the correct outcome. Not confirmed by me: that the validator checks declared flags against use (the tests compare our own output).
performance: a cheap instruction scan for pixel and mesh shaders. It changes a direct-DXIL source only: that path's cache entries are translated again once; the HLSL path is untouched.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by iggyvilla on 2026-11-29T06:16:47Z.
merge-check
base:
fa204595a4head:
2e6e6ab8d6merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2609 passed, 3 failed, 49 ignored; failing: the same three as on the base (fuzz_validate_and_gpu_1, test_title_runs_and_game_folder_is_untouched (e2e), two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs), each re-run on the base with the same failure. The first full run's lib test binary aborted before its summary (uma_driver coherent-window restore tests, Windows error 487); the totals are the
-p xcl --libre-run (2472 passed, 1 failed) plus the other targets of the full run (137 passed, 2 failed, 20 ignored).review: no blocking finding. All hunks read. The four flag/SFI0 bit pairs (64UAVs 1<<15/0x8, InnerCoverage 1<<10/0x400, ShadingRate 1<<24/0x8_0000, DerivativesInMeshAndAmpShaders 1<<29/0x100_0000) match the opcodes/conditions checked; scan runs after optimize() so dead/unreachable uses do not set flags (covered by negative test guards). Heap handles never enter self.bindings (handle_from_heap path), so the UAV count is static-only as the comment claims. "dx.op.sample." prefix cannot collide with sampleBias/sampleCmp (trailing-dot mismatch) and those are checked separately. Mesh primitive ShadingRate outputs deliberately excluded, vertex/pixel covered. Minor only: the scan computes both inner_cov and mesh_deriv for both stages while each stage consumes one; first-arg opcode convention (args.first()) matches how these dx.op calls are built elsewhere. I did not independently re-derive the DXC flag numbers beyond the tests' exact-SFI0 + disassembly-metadata + validate assertions.
performance: a single linear scan over surviving call instructions at graphics-shader build time; negligible and not per-frame. Direct-DXIL cache entries retranslate once; HLSL path untouched.
verdict: safe to merge
hardware / tool and model: AMD Radeon RX 6650 XT, Windows 10.0.26300; Muse Spark 1.3 (via pi) ran the build and tests in a prepared trial-merge worktree and drafted the review/performance lines; Claude Sonnet 5.5 (Claude Code) prepared the merge worktrees, read every hunk of the diff, checked the test counts and that the PR's own tests ran and passed in the logs, edited this text and posted it.
AI use: the two models above did all of this; the account owner did not read the diff or write this text. Claude Sonnet 5.5 read the whole diff; Muse Spark 1.3 only ran the commands and drafted lines. What was not done: no game run, NVIDIA or Intel GPU, or Linux.