DXIL: fix heap_structured_buffer, texture_load, and wave_all_equal feature flags #2466
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2476"
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:41:50Z.
What is in it
Align three
Shaderop builders incrates/xcl/src/gpu/dxil/ops.rs(+5/-5) with DXC 1.9's validator feature-flag rules and add DXC 1.9 validator +SFI0coverage incrates/xcl/src/gpu/dxil/ops_tests.rs(+59/-0,69lines total):heap_structured_buffer: remove spuriousself.require(Feature::RawAndStructuredBuffers)—ResourceDescriptorHeapstructured buffers require onlyResourceHeapIndexing(1 << 30,SFI0 = 0x200_0000), not the static raw/structured binding metadata flag (1 << 4), which causeddxil.dllto reject standalone heap structured-buffer shaders withFlags must match usage.Texture/srv_texture/heap_texture/texture_load: recordpub ncomp: u32onTextureand gateFeature::TypedUavLoadAdditionalFormats(1 << 13,SFI0 = 0x800) ontex.uav && tex.ncomp > 1instead oftex.comp != U32/I32/F32, fixing both 1-component false positives (UNormF32,SNormF32,F16) and multi-componentF32/I32/U32false negatives without removingtyped_uav_load_additional_formats().wave_all_equal: callself.wave_int64(v)matching the other typed wave helpers soFeature::Int64OpsandFeature::Doublesare recorded immediately oni64/f64inputs.Part of #1401
Part of #1833
Tested
origin/main(9ba6804f, DXC/dxil1.9.2609.5):cargo test -p xcl --lib gpu::dxil::ops_tests::ops_feature_flags -- --test-threads=1 --nocapturefailed3of3(ops_feature_flags_heap_structured_bufferrejecteddeclared=1073741840, actual=1073741824;ops_feature_flags_typed_uav_texture_loadrejecteddeclared=1073741824, actual=1073750016;ops_feature_flags_wave_all_equal_64bitmissedInt64Ops16384 != 49152).gpu::dxil::ops_tests(c20e5829, rebased ontoorigin/main06055a7a, DXC/dxil1.9.2609.5):cargo test --release -p xcl --lib gpu::dxil::ops_tests -- --test-threads=1 --nocapture):27 passed; 0 failed; 0 ignored(0.33 s,0skips).XCL_ADAPTER=warp cargo test --release -p xcl --lib gpu::dxil::ops_tests -- --test-threads=1 --nocapture):27 passed; 0 failed; 0 ignored(0.06 s;0skips on all 3 new pure-CPU/DXC 1.9 tests, pre-existing GPU dispatch tests skip cleanly withno wave32).cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture, RTX 4060):37test binaries,1416 passed; 0 failed; 46 ignored(183/183gpu::dxil::*).29pre-existingSKIPPEDlines on this RTX 4060 host (21no wave64,3per-lane wave32 refused,3no D3D12 debug layer /d3d12SDKLayers.dll,1no heap windows,1cannot disable driver cache;0skipped ingpu::dxil::ops_tests).Regression run
Paired 60 s RTX 4060 smoke (
scripts/smoke.ps1 -Seconds 60) on baseorigin/mainvs PR head (1539vs1466frames =105.0%,60 60 60steady pace,0device removals,0crashes):Base (
origin/main):PR head:
Not tested
21pre-existing wave64 tests skip on RTX 4060 wave32-only hardware; all feature-flag cases are validated directly by DXC/dxil1.9.2609.5andSFI0assertions).d3d12SDKLayers.dllnot installed on this host).AI use
Written and verified with Google Antigravity (Gemini 4 Neon). All changes were validated locally with failing-first DXC 1.9 tests, full release workspace tests, and paired 60 s RTX 4060 smoke runs.
Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T19:53:37Z.
The wave64 GPU paths listed as untested, on an AMD card with native wave64, plus an RTX 3060, paired against
mainwith the direct translator on for the whole GPU suite (so every directly translated program carries the changed flags).Head
c20e582applied onmain6d051da, debug, Windows 11 Pro 26200,XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu:: --test-threads=4, onmainand on this PR for each card:mainPer-test comparison: on both cards the only differences are the 3 new
ops_feature_flags_*tests (all ok). No existing test changes result or skip state; on the RX 9070 XT none of the wave64 tests skip, so the drivers accept the pipelines with the new flags there too. The 2 RX 9070 XT failures are the AMD fuzz seeds tracked in #2115, the same onmain.Not tested: the D3D12 debug layer (not installed here), a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T20:34:26Z.
Review: COMMENTED
P1: scalar additional typed-UAV formats no longer declare TypedUavLoadAdditionalFormats. ops.rs:816-818 sets the flag only when tex.ncomp > 1, so scalar R16_FLOAT/F16 and R8_UNORM/UNormF32 typed UAV loads omit the required SFI0 capability. Only R32_FLOAT/R32_UINT/R32_SINT are universally supported; these scalar formats are additional and require the flag. The new test at ops_tests.rs:3191-3204 explicitly asserts the incorrect F16x1 and UNorm/SNormF32x1 behavior. Please predicate on base format (the universal scalar formats), not component count, and add scalar additional-format positive cases.
Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T20:09:42Z.
Independent AMD RDNA4 (native wave64) test report on exact head
c20e5829a7b6bac8ff2acddcd58e697872b7bc00(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: 1414 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). All native wave64 GPU tests ran and passed.gpu::dxil::ops_tests::ops_feature_flags_heap_structured_buffer,ops_feature_flags_typed_uav_texture_load, andops_feature_flags_wave_all_equal_64bit.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 DavidM1911 on 2026-11-25T20:37:55Z.
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!
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-25T20:49:36Z.
Thanks for reviewing! We verified this directly against Microsoft
dxc.exe/dxil.dll 1.9.2609.5(and all 8 format/component-count cases inops_feature_flags_typed_uav_texture_loadpass livedxil.dllvalidation viacheck(&c)):Compiling
RWTexture2D<T> u; u[t.xy] = u[t.xy];withdxc -T cs_6_6emits:float,unorm float,snorm float(ncomp == 1):SFI0 = 0x00000000(TypedUAVLoadAdditionalFormats = false)float16_t(ncomp == 1,-enable-16bit-types):SFI0 = 0x00040000(NativeLowPrecisiononly,TypedUAVLoadAdditionalFormats = false)float4,uint4(ncomp == 4):SFI0 = 0x00000800(TypedUAVLoadAdditionalFormats = true)float16_t4(ncomp == 4,-enable-16bit-types):SFI0 = 0x00040800(TypedUAVLoadAdditionalFormats = true)DXIL resource metadata encodes component type + component count (not
DXGI_FORMAT), anddxil.dll's validator requiresTypedUAVLoadAdditionalFormats(0x800) strictly when a typed UAV load reads> 1component (ncomp > 1) — setting0x800on 1-componentUNormF32/SNormF32/F16(asmaindid previously) is rejected bydxil.dllwith a shader feature-flag mismatch.Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T20:52:00Z.
gpu_suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T06:31:36Z.
merge-check
base:
e429936c10head:
c20e5829a7merge: clean; an uncommitted merge onto this base changed only
gpu/dxil/ops.rsandops_tests.rs(+64/-5);git diff --cached --checkpassedbuild:
cargo build --offline --locked -j 4 --workspace-> ok on the merged treetests:
cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4-> 2,128 passed, 10 failed, 48 ignored across 39 targets; 25 distinct GPU SKIPPED notices. Untouched basee429936con this machine: 2,125 passed, the same 10 failed, 48 ignored. The three newops_feature_flags_*tests also passed in a focused run (3/0/0) with dxil 1.8.2502.11. Failing names are below.review: No blocker found in the full diff or current callers. The earlier scalar typed-UAV P1 conflates DXIL's shader flag with device support for a DXGI format: Microsoft's DXIL collector adds this flag for a typed UAV load when the resource has more than one component, matching the PR and its live validator cases. The heap structured-buffer flag and 64-bit wave operand flags match the collector's other rules. These changes are absent from current
main.performance: These are shader-generation metadata changes. They add a component-count field to the temporary texture handle and one condition at translation time; no frame-time or compile-time benchmark was run.
verdict: safe to merge
hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, rustc 1.99.1 MSVC, DXC/dxil 1.8.2502.11. Codex (GPT-6.2 Sol) ran the merge, build and tests and reviewed the diff; Codex (GPT-6.2 Astra) independently reviewed DXIL flag semantics and current callers.
Ten failures shared with the exact base
gpu::dxil::module::split::tests::dispatch_chain_oversized_loop_matches_wholegpu::dxil::module::split::tests::dispatch_chain_wave32_live_loopsgpu::dxil::module::split::tests::dispatch_chain_wave64_live_loops_and_exchangegpu::recomp::heap_window_tests::gpu_heap_flat_reads_match_guarded_and_root_outputgpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_diskgpu::recomp::tests::gpu_compute_mode_dispatch_abigpu::recomp::tests::gpu_float_cas_uses_ieee_equalitytest_title_draws_with_a_root_signature_under_the_debug_layertest_title_runs_and_game_folder_is_untouchedtest_title_runs_under_the_debug_layer_with_dredImported from ivall/xcl. Originally posted by throny on 2026-11-28T06:50:14Z.
merge-check claim
head:
c20e5829a7Imported from ivall/xcl. Originally posted by throny on 2026-11-28T07:06:58Z.
merge-check
base:
e429936chead:
c20e5829a7merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2129 passed, 9 failed, 48 ignored (26 SKIPPED lines). The 9 failures are main's own at
e429936con this GPU (reported with a bisect on #3041: they arrive with the merge of #2959); the set is identical with and without this PR. Base alone: 2126 passed, 9 failed, 48 ignored.review: no blocking finding. Both texture literals on main are updated; the two changed helpers have no callers outside tests, and the only non-test typed-UAV load already sets its flag, so the translated output of real shaders does not change today: these are latent fixes. A wrong flag would fail DXIL validation and fall back to HLSL; an extra capability bit could make pipeline creation fail on an adapter without it. Open from the thread: whether scalar 16- and 8-bit typed-UAV loads should set the flag (the PR follows DXC's more-than-one-component rule; I did not check DXC's source).
performance: none by default; direct DXIL only.
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).