Repository navigation
Recompiler: direct DXIL's signature dependencies are complete across loops - #1966
Merged
Merged
Conversation
…loops compute_deps (the input-to-output tables of dx.viewIdState and PSV0) breaks the recursion a loop makes by answering an empty set for a value whose own set is still being worked out, and then keeps what it derived from that answer. With acc = phi [X, entry], [next, loop] and next = acc + 1, asking for acc first reaches next while acc is open: next is remembered as depending on nothing, and an output written from next loses input X (xcl-dev#1892, its first point). The sets now say which pass worked them out and whether that is still going on. A pass that had to answer for an open value or block (a cut) is followed by another, each value starting from what the last pass knew of it, until no set grows. Code without a loop cuts nothing and is done after one pass, as before. The direct translator's version goes to 8, since the tables of programs with loops change. Assisted-by: OpenCode (Claude Fable 5.2)
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
Contributor
|
Tested exact head Tested
Not tested
AI use |
anoyarou
pushed a commit
to anoyarou/xcl
that referenced
this pull request
Nov 25, 2026
…loops (xcl-dev#1966) compute_deps (the input-to-output tables of dx.viewIdState and PSV0) breaks the recursion a loop makes by answering an empty set for a value whose own set is still being worked out, and then keeps what it derived from that answer. With acc = phi [X, entry], [next, loop] and next = acc + 1, asking for acc first reaches next while acc is open: next is remembered as depending on nothing, and an output written from next loses input X (xcl-dev#1892, its first point). The sets now say which pass worked them out and whether that is still going on. A pass that had to answer for an open value or block (a cut) is followed by another, each value starting from what the last pass knew of it, until no set grows. Code without a loop cuts nothing and is done after one pass, as before. The direct translator's version goes to 8, since the tables of programs with loops change. Assisted-by: OpenCode (Claude Fable 5.2)
Member
|
Both AMD and NVIDIA passes look solid on Remaining before merge: please rebase onto |
luckyteagirl
added a commit
to luckyteagirl/xcl
that referenced
this pull request
Nov 25, 2026
Track each memory write's pointer, value, and control block when computing input-to-output dependencies for dx.viewIdState and PSV0. Preserve the fixed-point traversal merged in xcl-dev#1966. The direct-DXIL source hash from xcl-dev#1947 accounts for the changed output without a manual version bump. Refs xcl-dev#1892
Contributor
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
luckyteagirl
added a commit
to luckyteagirl/xcl
that referenced
this pull request
Nov 25, 2026
Track each memory write's pointer, value, and control block when computing input-to-output dependencies for dx.viewIdState and PSV0. Preserve the fixed-point traversal merged in xcl-dev#1966. The direct-DXIL source hash from xcl-dev#1947 accounts for the changed output without a manual version bump. Refs xcl-dev#1892
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1892 (its first point; the second is not in this PR, see Not tested).
compute_depsingpu/dxil/graphics.rsworks out which input components each output component depends on, fordx.viewIdStateand thePSV0tables of the direct DXIL translator's vertex, pixel and mesh programs. A loop makes a value depend on itself, and the function broke that recursion by answering an empty set for a value whose own set was still being worked out, then kept whatever it derived from that answer.With
acc = phi [X, entry], [next, loop]andnext = acc + 1: asking foraccfirst reachesnextwhileaccis open,nextis remembered as depending on nothing, and an output written fromnextloses inputX. Which outputs are affected depends only on the order the stores are met in.The sets now record which pass worked them out and whether that is still going on. A pass that had to answer for an open value or block is followed by another, each value starting from what the last pass knew of it, until no set grows. Code without a loop cuts nothing and is done after one pass, as before.
What is in it
crates/xcl/src/gpu/dxil/graphics.rs:compute_depskeepsKnown { set, pass, open }per value and per block, and repeats its walk over the output stores while a pass both cut a cycle and grew a set.crates/xcl/src/gpu/dxil/kernel.rs:TRANSLATOR_VERSION7 → 8, since the tables of programs with loops change. Other open direct-DXIL PRs bump the same line (my Recompiler: v_pack_b32_f16 applies the abs and neg half modifiers #1720 among them), so whichever merges second needs the next number.crates/xcl/src/gpu/dxil/graphics_tests.rs:a_loop_value_first_reached_through_its_phi_keeps_the_phis_inputsbuilds the loop above with outputsA = accandB = nextand askscompute_depsdirectly. Onmainit fails withoutput B depends on input X through the loop; its inputs: {}.#1770 rewrites the same function's sets as bit masks and keeps the single pass, so the two conflict; this change is small enough to redo on top of it if that one goes first.
Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 991 passed, 0 failed, 45 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses,no heap windows, andcannot disable the driver cache (Windows Developer Mode is required))cargo test -p xcl --lib -- gpu::dxil::graphics: 25 passed, 0 failed, also withXCL_DIRECT_DXIL=all. That includesvs_control_dependence_matches_dxc, whose loop and branches still give the samePSV0bytes as DXC, so the extra passes add nothing DXC does not have there.main20cf130before the change: 0 passed, 1 failed (the message above)Regression run
main (
8e87fc7, clean tree, no local changes):PR (
25298fb, clean tree, no local changes):(These two runs use the default settings, where vertex and pixel programs go through HLSL and DXC, so they do not run the changed code. One more run of the PR's build with
XCL_DIRECT_DXIL=allset: 1629 frames,60 60 60, 0 crashes, 0 device removals, and no "rejected" line in the log. I did not count how many of the programs it translated have loops.)Not tested
compute_depson large programs with loops, which now takes at least two passes.AI use
scripts/smoke.ps1runs.