Direct DXIL: compute_deps() poisons memo tables on cyclic phis/loops and omits store pointer/control dependencies in dx.viewIdState / PSV0 #1892
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#1892
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@microwave805 on GitHub · 2026-11-24 22:37 UTC · original
Static audit on
main @ 689f2dbfound two soundness bugs incompute_deps()(crates/xcl/src/gpu/dxil/graphics.rs:755-861), which computes the input-to-output dependency tables written into DXILdx.viewIdStatemetadata and thePSV0container part. (Note: open PR#1770preserves the exact same traversal and memoization algorithm, so these bugs apply there too.)Where
crates/xcl/src/gpu/dxil/graphics.rs:755-861(compute_deps,block_deps,value_deps)Root causes
Memo poisoning on cyclic PHIs and loops (
graphics.rs:786-808, 859)To break recursion cycles,
value_depsinserts an emptyBTreeSet::new()intomemobefore recursing (graphics.rs:808), andblock_depsdoes the same forctrl_memo(graphics.rs:790):A(depending onloadInput(in0)on the preheader edge andBon the back-edge) and PHI/valueB(depending onA).value_deps(A)starts first,memo[A]is seeded with{}. Whenvalue_deps(A)recurses intoB,Breadsmemo[A](getting{}), computesB's dependencies withoutin0, and permanently caches that incomplete set inmemo[B].Bthen omitsin0fromdx.viewIdState/PSV0, which causes DXIL validation failures or broken shader-stage linkage / interpolation optimization on drivers.block_depsfor mutually control-dependent blocks inside loops.Incomplete memory / control dependencies for
StoreandAlloca/TGSM loads (graphics.rs:758-771, 843-858)root_stores(graphics.rs:760-762) only records the stored valuev— it omits the store's pointer operandp(so an input-dependent array index used to select which slot is written is lost on subsequent loads) AND omits the store's enclosing block control dependencyblock_deps(store_block)(so a conditional store gated by an input-dependent branch is lost on subsequent loads).block_ofis built across all instructions (graphics.rs:755-759) and then explicitly ignored atgraphics.rs:858(let _ = cx.block_of;).Fix direction
(value_deps, block_deps)(or Tarjan SCC condensation) so cyclic PHIs and loops converge to the exact union of dependencies without memo poisoning.pandblock_deps(store_block)inroot_storesentries (and for atomics ingraphics.rs:763-770) so loads fromalloca/ TGSM capture pointer-index and control-flow dependencies.AI use
main @ 689f2dband issue drafting.@Decodere on GitHub · 2026-11-24 23:55 UTC · original · edited 2026-11-25 00:03 UTC
Stepping back from
#1892in favor of#1966(just opened) to avoid duplicate/overlapping edits ingraphics.rs.@JJAutoCompare on GitHub · 2026-11-25 00:51 UTC · original · edited 2026-11-25 01:05 UTC
Standalone CPU regression check for #1892
I reran a local Rust harness using the DXIL graphics code from
6567c5ffa38fbc7039b2d6bf520154689cc1f482and PR #1966 head25298fb70155f9b7c724560b7af4455bc9a4a450. Windows 11 build26200.9974, Ryzen 7 3800X, Rust1.100.0MSVC. The two harnesses used the same fixture and matching auxiliary source modules.harness.exe loopran the PR regression. Main failed with “output B depends on input X through the loop; its inputs: {}” (exit 101). The PR head passed (exit 0).harness.exe memory <out-dir> tests/data/dxil/dxc_vs_control.dxilcompleted on both heads (exit 0). The existing VS control case produced the same PSV0 bytes as its DXC reference. For a load influenced by an input-dependent write index and for a load influenced by a conditional write, both heads emitted the dependency mask0b10indx.viewIdStateand PSV0. These cases expect0b11because both outputs depend on the input. The harness printed these masks and did not assert their expected value, hence the successful process exits.These are harness checks. No Cargo suite, GPU execution, or DXIL validation was run. Test and report prepared with Codex in T3 Code (
gpt-6.2-sol).Cargo and DXC follow-up on #1966
Base
25298fb70155f9b7c724560b7af4455bc9a4a450. The base run added only the two regression tests. The patched runs used the local, uncommitted diff on that same base. SHA-256 ofgit diff --full-index --binaryfor the tested patch isf1be92ad2039df7c881954b06e10e02bced44bc7652e648cdd62da7b099d7ce6.Windows 11 build
26200.9974, Ryzen 7 3800X, Rust1.100.0MSVC debug, DXC and DXIL1.9.2609.5. The isolated checkout, Cargo target and temporary directory were underL:/XclTooling/1892-store-depswithCARGO_BUILD_JOBS=2andCARGO_INCREMENTAL=0. The draw run used Intel Arc A770 driver32.0.101.9175withXCL_ADAPTER=A770.cargo test -p xcl --lib vs_load_depends_on_store_ -- --nocapture --test-threads=1. 0 passed, 2 failed as expected, 0 ignored, 0 skipped, 967 filtered, exit 101. The input-dependent write index and conditional write each emitted0b10in bothdx.viewIdStateandPSV0.cargo test -p xcl --lib gpu::dxil::graphics::tests:: -- --nocapture --test-threads=1 --skip emitted_. 23 passed, 0 failed, 0 ignored, 0 skipped, 946 filtered, exit 0. Both new fixtures asserted0b11in both encodings and passed DXC validation. The existing loop and DXC PSV0 comparison regressions passed.& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { cargo test -p xcl --lib gpu::dxil::graphics::tests::emitted_ -- --nocapture --test-threads=1 }. 4 passed, 0 failed, 0 ignored, 0 skipped, 965 filtered, exit 0. The wrapper acquired and released the Arc lock. It ran with a process-scoped PowerShell execution policy override.Not tested
GPU execution of the two new fixtures, other adapters, retail shaders, title smoke, and the full workspace suite.
AI use
Codex in T3 Code (
gpt-6.2-sol) wrote the local patch and tests, ran them, and prepared this report.