Repository navigation
Preserve ViewID dependencies across retained helper calls - #9114
Sandro Trianni (5andr0) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
🟡 Changes recommended
Unchecked calls to GetDxilOpFuncCallInst on non-DXIL instructions can abort assertions-enabled builds or misinterpret constant arguments as DXIL opcodes when assertions are disabled.
2 open issues
What changed in this PR
This PR updates DXC’s ViewID analysis to preserve input and ViewID dependencies across retained helper calls, including writes through output pointers.
Changes:
- Replaces recursive dependency tracing with reusable function summaries and fixed-point memory analysis.
- Tracks reachable blocks, PHI selection control, and recognized DXIL pointer operations.
- Adds regression tests for helper calls, aliasing, memory operations, unsupported calls, and amplification payloads.
| File | Description |
|---|---|
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/unreachable-out-store.ll | Tests exclusion of unreachable writes. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/unreachable-opaque-call.ll | Tests ignoring unreachable opaque calls. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/unknown-out-call.ll | Tests rejection of unknown memory-writing calls. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/summary-alias-feedback.ll | Tests alias feedback and private allocation isolation. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/shared-call-dag.hlsl | Tests shared helper call graphs without expansion. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/scalar-phi-out-dependencies.ll | Tests PHI dependencies through output pointers. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/scalar-phi-dependencies.ll | Tests PHI dependencies through return values. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/recursive-out-call.ll | Tests rejection of recursive calls. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/recognized-pointer-memory.ll | Tests DXIL pointer load/store dependencies. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/pointer-call-dependencies.ll | Tests nested pointer calls, casts, and PHI cycles. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/out-argument-dependencies.hlsl | Tests call-specific output argument dependencies. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/opaque-readonly-call.ll | Tests rejection of opaque readonly calls. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/nested-out-dependencies.hlsl | Tests nested inout and conditional writes. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/memory-intrinsic-dependencies.ll | Tests memcpy, memset, and atomic updates. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/memmove-cmpxchg-dependencies.ll | Tests memmove and compare-exchange dependencies. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/indirect-out-call.ll | Tests rejection of indirect calls. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/identical-pointer-phi.ll | Tests independence of identical pointer selections. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/identical-phi-out-actuals.ll | Tests identical arguments selected into output pointers. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/identical-phi-actuals.ll | Tests identical arguments selected into return values. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/distinct-pointer-phi.ll | Tests control dependence of distinct pointer selections. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/caller-control-dependencies.ll | Tests caller control over helper writes. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/callee-viewid-dependencies.ll | Tests callee ViewID reads and shared global writes. |
| tools/clang/test/HLSLFileCheck/hlsl/semantics/sv_viewid/amplification-payload.hlsl | Tests amplification payload compilation. |
| lib/HLSL/ComputeViewIdStateBuilder.cpp | Implements function summaries and fixed-point dependency propagation. |
Review effort: Balanced
8130d4e to
2d9b25d
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
8 open issues
The guard-composition logic can become unsound whenDalready contains guarded dependencies… · New Skip non-DXIL calls before extracting opcodes Guard DXIL opcode extraction with the call predicate TheDependencytuple is difficult to reason about and makes it easy to misuse field positions… · New The fixed-point loop re-computesSize()(which walks all maps/sets) every iteration, turning… · New The fixed-point loop re-computesSize()(which walks all maps/sets) every iteration, turning… · New This test encodes call-count expectations by repeating the same FileCheck pattern many times, which… · New The negative test only checks for the substringerror, which is broad and risks matching… · New
Review effort: Lite
2d9b25d to
0d3e2c6
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Reverse-ordered dependency and memory-copy chains still cause quadratic rescanning, requiring change-driven scheduling and regression coverage.
3 open issues
7 resolved since last review
Skip non-DXIL calls before extracting opcodes Guard DXIL opcode extraction with the call predicate The negative test only checks for the substringerror, which is broad and risks matching… This test encodes call-count expectations by repeating the same FileCheck pattern many times, which… The fixed-point loop re-computesSize()(which walks all maps/sets) every iteration, turning… The fixed-point loop re-computesSize()(which walks all maps/sets) every iteration, turning… TheDependencytuple is difficult to reason about and makes it easy to misuse field positions…
Review effort: Balanced
Compute completed symbolic function summaries for return values, memory effects and signature outputs, and propagate them into callers. Revisit pointer, value and memory readers when their sets grow, including control consumers and alias feedback, instead of repeatedly sweeping instructions. Preserve reachable-CFG filtering, selection precision and empty effects. Add reverse-layout and loop-carried coverage and a release note. An assertions-enabled build passes 50 focused files / 58 RUN commands. The original retained-IR case and four normal source configurations restore the exact 82 missing input-output dependency edges.
0d3e2c6 to
da86a8b
Compare



ViewID analysis can miss input dependencies when a retained helper writes through an output pointer. Summarize each reachable function's return, memory effects and signature outputs, then substitute the used arguments at each call site. Resolve pointer and memory dependencies to a fixed point without expanding call paths.
Preserve PHI selection control and independent identical selections, exclude unreachable blocks, and account for recognized DXIL pointer operations while retaining amplification shader support.
Validation: 43 focused ViewID test files with 51 RUN commands, including helper calls, alias feedback, PHIs, shared call graphs, memory intrinsics and amplification payloads. The existing 29 files and 34 RUN commands retain their assertions; the official amplification compilation and FileCheck check also pass.