Skip to content

Fix payload access qualifier ICEs on member method calls - #8726

Merged
damyanp merged 3 commits into
microsoft:mainfrom
damyanp:damyanp/fix-paq-nested-method-ice
Jul 31, 2026
Merged

Fix payload access qualifier ICEs on member method calls#8726
damyanp merged 3 commits into
microsoft:mainfrom
damyanp:damyanp/fix-paq-nested-method-ice

Conversation

@damyanp

@damyanp damyanp commented Jul 31, 2026

Copy link
Copy Markdown
Member

Calling a member method on a ray payload crashed the payload access qualifier
analysis, on any lib_6_7+ target or with -enable-payload-qualifiers. It goes
back to at least DXC 1.7.2207.

  • Fix the cast<FieldDecl> failure when the method is called on a payload field
  • Fix the uninitialized read when the method is called on the payload itself
  • Add a regression test that fails if either fix is reverted

Method bodies are still not analyzed, so a write inside a payload method is not
seen by the "never unconditionally written" check. That already matches how a
write through an inout free function parameter behaves today.

Fixes #6464
Assisted-by: copilot

Calling a member method on a payload under -enable-payload-qualifiers hit
two crashes in the SemaDXR payload-access analysis:

* A method on a nested payload field (`p.e.getType()`) was picked up as
  the payload field `MemberExpr`, so `cast<FieldDecl>` on the method
  decl failed with `llvm::cast<X>() argument of incompatible type!`.
  Payload access tracking now only considers member expressions that name
  a field, which also attributes the access to the correct field.

* A method on the payload itself (`p.getTag()`) has no explicit payload
  argument, so `DiagnosePayloadAsFunctionArg` never assigned
  `CalleeInfo.Payload`. `DxrShaderDiagnoseInfo` had no member
  initializers, so the subsequent null check read an indeterminate pointer
  and faulted in `GetPayloadType`. The members are now initialized, which
  also removes the same latent issue at the two other partially-initialized
  construction sites.

Add a DXC regression test covering both cases.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 545d43d4-7d8a-4f9c-b823-364bfee6c739
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 545d43d4-7d8a-4f9c-b823-364bfee6c739
@damyanp
damyanp marked this pull request as ready for review July 31, 2026 02:12
Copilot AI review requested due to automatic review settings July 31, 2026 02:12

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.

Pull request overview

Fixes payload access qualifier crashes caused by ray payload member-method calls.

Changes:

  • Safely distinguishes payload fields from member methods.
  • Initializes payload diagnostic state.
  • Adds regression coverage and release notes.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tools/clang/lib/Sema/SemaDXR.cpp Prevents invalid casts and uninitialized reads.
tools/clang/test/DXC/payload_qualifier_nested_method_call.hlsl Tests nested-field and payload method calls.
docs/ReleaseNotes.md Documents the fix.

@damyanp
damyanp marked this pull request as draft July 31, 2026 17:06
The DXIL compat suite re-runs tools/clang/test/DXC against released dxil.dll validators, and lib_6_9 is rejected by the 1.6 validator. The bug is not SM 6.9 specific, so target lib_6_7 and add the matching REQUIRES gate.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 545d43d4-7d8a-4f9c-b823-364bfee6c739
@damyanp
damyanp marked this pull request as ready for review July 31, 2026 20:47
Copilot AI review requested due to automatic review settings July 31, 2026 20:47

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@llvm-beanz llvm-beanz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks reasonable, but I don't really like that it's including changes unrelated to the issue it is resolving.

Comment thread tools/clang/lib/Sema/SemaDXR.cpp
@damyanp
damyanp enabled auto-merge (squash) July 31, 2026 21:37
@damyanp
damyanp merged commit 4f3e767 into microsoft:main Jul 31, 2026
14 checks passed
@github-project-automation github-project-automation Bot moved this from New to Done in HLSL Roadmap Jul 31, 2026
@damyanp
damyanp deleted the damyanp/fix-paq-nested-method-ice branch August 1, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Calling member function on raypayload causes cast<X>() argument of incompatible type error with PAQ

4 participants