-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[HLSL][RootSignature] Introduce HLSLFrontendAction
to implement rootsig-define
#154639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d91de5f
nfc: move invocation of parsing to common location
inbelic 373add4
define the `fdx-rootsignature-define` option
inbelic 2ebb085
[Frontend][HLSL] Define `HLSLFrontendAction` to add a `PPCallback`
inbelic 0406db0
[SemaHLSL] actually replace the entry function root signature
inbelic 8d47830
testing
inbelic ec96787
[Driver][DXC] add `rootsig-define` as an alias option
inbelic e691dd3
review: remove custom `Frontend/HLSL` library
inbelic b08b3ac
review: style guide
inbelic 137bd96
review: add clang checks
inbelic e09338a
review: fix up comment
inbelic 457c679
Merge branch 'main' into inbelic/rootsig-define
inbelic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Establish a baseline without define specified | ||
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \ | ||
// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,NO-OVERRIDE | ||
|
||
// Check that we can set the entry function even if it doesn't have an attr | ||
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \ | ||
// RUN: -hlsl-entry none_main -fdx-rootsignature-define=SampleCBV \ | ||
// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,SET | ||
|
||
// Check that we can set the entry function overriding an attr | ||
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \ | ||
// RUN: -hlsl-entry uav_main -fdx-rootsignature-define=SampleCBV \ | ||
// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,OVERRIDE | ||
|
||
// Check that we can override with a command line root signature | ||
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \ | ||
// RUN: -hlsl-entry cbv_main -fdx-rootsignature-define=CmdRS -DCmdRS='"SRV(t0)"' \ | ||
// RUN: -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CMD | ||
|
||
#define SampleCBV "CBV(b0)" | ||
#define SampleUAV "UAV(u0)" | ||
|
||
// CMD: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[CMD_DECL:__hlsl_rootsig_decl_\d*]] | ||
// CMD-SAME: version: 1.1, RootElements{ | ||
// CMD-SAME: RootSRV(t0, | ||
// CMD-SAME: space = 0, visibility = All, flags = DataStaticWhileSetAtExecute | ||
// CMD-SAME: )} | ||
|
||
// CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[CBV_DECL:__hlsl_rootsig_decl_\d*]] | ||
// CHECK-SAME: version: 1.1, RootElements{ | ||
// CHECK-SAME: RootCBV(b0, | ||
// CHECK-SAME: space = 0, visibility = All, flags = DataStaticWhileSetAtExecute | ||
// CHECK-SAME: )} | ||
|
||
// CHECK-LABEL: -FunctionDecl 0x{{.*}} {{.*}} cbv_main | ||
// NO-OVERRIDE: -RootSignatureAttr 0x{{.*}} {{.*}} [[CBV_DECL]] | ||
// SET: -RootSignatureAttr 0x{{.*}} {{.*}} [[CBV_DECL]] | ||
// CMD: -RootSignatureAttr 0x{{.*}} {{.*}} [[CMD_DECL]] | ||
|
||
[RootSignature(SampleCBV)] | ||
void cbv_main() {} | ||
|
||
// CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[UAV_DECL:__hlsl_rootsig_decl_\d*]] | ||
// CHECK-SAME: version: 1.1, RootElements{ | ||
// CHECK-SAME: RootUAV(u0, | ||
// CHECK-SAME: space = 0, visibility = All, flags = DataVolatile | ||
// CHECK-SAME: )} | ||
|
||
// CHECK-LABEL: -FunctionDecl 0x{{.*}} {{.*}} uav_main | ||
// NO-OVERRIDE: -RootSignatureAttr 0x{{.*}} {{.*}} [[UAV_DECL]] | ||
// SET: -RootSignatureAttr 0x{{.*}} {{.*}} [[UAV_DECL]] | ||
// OVERRIDE: -RootSignatureAttr 0x{{.*}} {{.*}} [[CBV_DECL]] | ||
|
||
[RootSignature(SampleUAV)] | ||
void uav_main() {} | ||
|
||
// CHECK-LABEL: -FunctionDecl 0x{{.*}} {{.*}} none_main | ||
// NO-OVERRIDE-NONE: -RootSignatureAttr | ||
// SET: -RootSignatureAttr 0x{{.*}} {{.*}} [[CBV_DECL]] | ||
// OVERRIDE-NONE: -RootSignatureAttr | ||
|
||
void none_main() {} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exposing this as a Clang option and not just a CC1 option is an interesting choice. I think I like it since I'd like us to someday move away from the DXC driver, but is this a conscious decision? I don't recall that in the proposal (https://github.com/llvm/wg-hlsl/blob/main/proposals/0029-root-signature-driver-options.md).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was under the impression that in general we were adding these to clang as well, see
hlsl-entry
,dxil-validator-version
,dx_rootsignature_version
, etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have no tests that actually test that, I'm going to guess that's a copypasta mistake, not an intentional design decision. That said I'm okay leaving this as-is.