[SM6.10] Linalg Builtin Diag on Bad Stage#8233
Open
V-FEXrt wants to merge 2 commits intomicrosoft:mainfrom
Open
[SM6.10] Linalg Builtin Diag on Bad Stage#8233V-FEXrt wants to merge 2 commits intomicrosoft:mainfrom
V-FEXrt wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Some builtins are only allowed in a limited set of shader stages. Raise a Sema Diag when they are improperly used.
V-FEXrt
commented
Mar 6, 2026
| // REQUIRES: dxil-1-10 | ||
| // RUN: %dxc -T lib_6_10 %s -verify | ||
|
|
||
| // expected-no-diagnostics |
Collaborator
Author
There was a problem hiding this comment.
No clue how this was ever passing. The DXIL op is appropiately marked as a restricted one.
Maybe some kind of DCE? Not sure, I need to follow up on what happened here
V-FEXrt
commented
Mar 6, 2026
| // REQUIRES: dxil-1-10 | ||
| // RUN: %dxc -T lib_6_10 %s -verify | ||
|
|
||
| // expected-no-diagnostics |
V-FEXrt
commented
Mar 6, 2026
| // expected-error@+3{{builtin unavailable in shader stage 'hull' (requires 'compute', 'mesh' or 'amplification')}} | ||
| // expected-error@+2{{builtin unavailable in shader stage 'domain' (requires 'compute', 'mesh' or 'amplification')}} | ||
| // expected-error@+1{{builtin unavailable in shader stage 'geometry' (requires 'compute', 'mesh' or 'amplification')}} | ||
| DO_FUNC |
Collaborator
Author
There was a problem hiding this comment.
DO_FUNC macro is a weird choice here.
I tried to both expected-error@* and expected-error@? where internal chat history implies the second should have worked but both failed.
Unless I can get wildcard working the only other option beyond the macro is to repeat the expected-error code a bunch
hekota
reviewed
Mar 6, 2026
bob80905
reviewed
Mar 7, 2026
| } | ||
|
|
||
| // Some LinAlg builtins are not available in all shader stages | ||
| // Detect those use cases and raise a Diagnositc |
| : Error<"argument must be linear algebra matrix type">; | ||
|
|
||
| def err_hlsl_linalg_unsupported_stage : Error< | ||
| "builtin unavailable in shader stage '%0' (requires 'compute', 'mesh' or 'amplification')">; |
Collaborator
There was a problem hiding this comment.
nit: perhaps change to "linalg builtin unavailable...", or make the diagnostic ID more abstract than hlsl_linalg_unsuppported_stage.
| #endif | ||
|
|
||
| // The builtins below are allowed in all stages, if they raise an error | ||
| // then the test will fall with "saw unexpected diagnostic" |
hekota
approved these changes
Mar 7, 2026
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.
Some builtins are only allowed in a limited set of shader stages. Raise a Sema Diag when they are improperly used.
Fixes #8229