Skip to content

Preserve ViewID dependencies across retained helper calls - #9114

Open
Sandro Trianni (5andr0) wants to merge 1 commit into
microsoft:mainfrom
5andr0:codex/fix-callee-output-dependencies
Open

Sandro Trianni (5andr0) wants to merge 1 commit into
microsoft:mainfrom
5andr0:codex/fix-callee-output-dependencies

Conversation

@5andr0

Copy link
Copy Markdown

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.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 16:01
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@5andr0

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread lib/HLSL/ComputeViewIdStateBuilder.cpp Resolved
Comment thread lib/HLSL/ComputeViewIdStateBuilder.cpp Resolved
@5andr0
Sandro Trianni (5andr0) force-pushed the codex/fix-callee-output-dependencies branch from 8130d4e to 2d9b25d Compare November 11, 2026 16:41
Copilot AI balanced review requested due to automatic review settings November 11, 2026 16:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread lib/HLSL/ComputeViewIdStateBuilder.cpp Resolved
Comment thread lib/HLSL/ComputeViewIdStateBuilder.cpp Resolved
Comment thread lib/HLSL/ComputeViewIdStateBuilder.cpp Resolved
Comment thread lib/HLSL/ComputeViewIdStateBuilder.cpp Resolved
@5andr0
Sandro Trianni (5andr0) force-pushed the codex/fix-callee-output-dependencies branch from 2d9b25d to 0d3e2c6 Compare November 11, 2026 18:02
Copilot AI balanced review requested due to automatic review settings November 11, 2026 18:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Comment thread lib/HLSL/ComputeViewIdStateBuilder.cpp Resolved
Comment thread lib/HLSL/ComputeViewIdStateBuilder.cpp Resolved
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.
@5andr0
Sandro Trianni (5andr0) force-pushed the codex/fix-callee-output-dependencies branch from 0d3e2c6 to da86a8b Compare November 11, 2026 18:48
Copilot AI balanced review requested due to automatic review settings November 11, 2026 18:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The core ViewID analysis rewrite needs DXIL expert review of alias/PHI soundness and cross-stage compatibility beyond the focused validation reported.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants