[SPIRV] Fix sign() result type for uint matrices - #8859
Open
David Browne (djb) wants to merge 1 commit into
Open
[SPIRV] Fix sign() result type for uint matrices#8859David Browne (djb) wants to merge 1 commit into
David Browne (djb) wants to merge 1 commit into
Conversation
HLSL's sign() returns a signed integer matrix for an unsigned integer matrix argument. SPIR-V codegen instead used the argument composite's type as the result type of OpCompositeConstruct, constructing an unsigned composite from signed vector constituents, which fails validation. Pass the call expression's result type to processEachVectorInMatrix so the composite is constructed with the intrinsic's signed result type, fixing the validation error. This issue affected all uintMxN matrices with M,N > 1. Fixes microsoft#8858
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes invalid SPIR-V generation for sign() on unsigned integer matrices.
Changes:
- Constructs signed result matrices using the intrinsic’s return type.
- Updates the SPIR-V regression expectation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
tools/clang/lib/SPIRV/SpirvEmitter.cpp |
Uses the signed call result type for matrix construction. |
tools/clang/test/CodeGenSPIRV/intrinsics.uintsign.hlsl |
Verifies signed matrix SPIR-V output. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } | ||
| return processEachVectorInMatrix(firstArg, doExpr(firstArg), actOnEachVec, | ||
| srcLoc, srcRange); | ||
| return processEachVectorInMatrix(firstArg, callExpr->getType(), |
Author
|
@microsoft-github-policy-service agree |
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.
HLSL's
sign()returns a signed integer matrix for an unsigned integer matrix argument. SPIR-V codegen instead used the argument composite's type as the result type ofOpCompositeConstruct,constructing an unsigned composite from signed vector constituents, which fails validation.Pass the call expression's result type to
processEachVectorInMatrixso the composite is constructed with the intrinsic's signed result type, fixing the validation error.This issue affected all
uintMxNmatrices withM,N> 1.Fixes #8858
Assisted-by: GPT 5.6 Sol