-
Notifications
You must be signed in to change notification settings - Fork 854
Support SV_DispatchGrid semantic in a nested record #6931
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 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1f60ce1
Support SV_DispatchGrid semantic in a nested record
f5d2552
Address review comments
eb88b69
Add template test cases for nested SV_DispatchGrid
3613f47
Update tools/clang/lib/CodeGen/CGHLSLMS.cpp
tcorringham b97b80a
Remove check for virtual base class
7e49199
Amend local variable naming
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
130 changes: 130 additions & 0 deletions
130
tools/clang/test/HLSLFileCheck/hlsl/workgraph/nested_sv_dispatchgrid.hlsl
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,130 @@ | ||
| // RUN: %dxc -T lib_6_8 %s | FileCheck %s | ||
|
|
||
| // Check that the SV_DispatchGrid DXIL metadata for a node input record is | ||
| // generated in cases where: | ||
| // node1 - the field with the SV_DispatchGrid semantic is in a nested record | ||
| // node2 - the field with the SV_DispatchGrid semantic is in a record field | ||
| // node3 - the field with the SV_DispatchGrid semantic is inherited from a base record | ||
| // node4 - the field with the SV_DispatchGrid semantic is within a nested record inherited from a base record | ||
| // node5 - the field with the SV_DispatchGrid semantic is within a base record of a nested record | ||
| // node6 - the field with the SV_DispatchGrid semantic is within a templated base record | ||
| // node7 - the field with the SV_DispatchGrid semantic is within a templated base record of a templated record | ||
| // node8 - the field with the SV_DispatchGrid semantic has templated type | ||
|
|
||
| struct Record1 { | ||
| struct { | ||
| // SV_DispatchGrid is within a nested record | ||
| uint3 grid : SV_DispatchGrid; | ||
| }; | ||
| }; | ||
|
|
||
| [Shader("node")] | ||
| [NodeMaxDispatchGrid(32,16,1)] | ||
| [NumThreads(32,1,1)] | ||
| void node1(DispatchNodeInputRecord<Record1> input) {} | ||
| // CHECK: {!"node1" | ||
| // CHECK: , i32 1, ![[SVDG_1:[0-9]+]] | ||
| // CHECK: [[SVDG_1]] = !{i32 0, i32 5, i32 3} | ||
|
|
||
| struct Record2a { | ||
| uint u; | ||
| uint2 grid : SV_DispatchGrid; | ||
| }; | ||
|
|
||
| struct Record2 { | ||
| uint a; | ||
| // SV_DispatchGrid is within a record field | ||
| Record2a b; | ||
| }; | ||
|
|
||
| [Shader("node")] | ||
| [NodeMaxDispatchGrid(32,16,1)] | ||
| [NumThreads(32,1,1)] | ||
| void node2(DispatchNodeInputRecord<Record2> input) {} | ||
| // CHECK: {!"node2" | ||
| // CHECK: , i32 1, ![[SVDG_2:[0-9]+]] | ||
| // CHECK: [[SVDG_2]] = !{i32 8, i32 5, i32 2} | ||
|
|
||
| struct Record3 : Record2a { | ||
| // SV_DispatchGrid is inherited | ||
| uint4 n; | ||
| }; | ||
|
|
||
| [Shader("node")] | ||
| [NodeMaxDispatchGrid(32,16,1)] | ||
| [NumThreads(32,1,1)] | ||
| void node3(DispatchNodeInputRecord<Record3> input) {} | ||
| // CHECK: {!"node3" | ||
| // CHECK: , i32 1, ![[SVDG_3:[0-9]+]] | ||
| // CHECK: [[SVDG_3]] = !{i32 4, i32 5, i32 2} | ||
|
|
||
| struct Record4 : Record2 { | ||
| // SV_DispatchGrid is in a nested field in a base record | ||
| float f; | ||
| }; | ||
|
|
||
| [Shader("node")] | ||
| [NodeMaxDispatchGrid(32,16,1)] | ||
| [NumThreads(32,1,1)] | ||
| void node4(DispatchNodeInputRecord<Record4> input) {} | ||
| // CHECK: {!"node4" | ||
| // CHECK: , i32 1, ![[SVDG_2]] | ||
|
|
||
| struct Record5 { | ||
| uint4 x; | ||
| // SV_DispatchGrid is in a base record of a record field | ||
| Record3 r; | ||
| }; | ||
|
|
||
| [Shader("node")] | ||
| [NodeLaunch("broadcasting")] | ||
| [NodeMaxDispatchGrid(32,16,1)] | ||
| [NumThreads(32,1,1)] | ||
| void node5(DispatchNodeInputRecord<Record5> input) {} | ||
| // CHECK: {!"node5" | ||
| // CHECK: , i32 1, ![[SVDG_5:[0-9]+]] | ||
| // CHECK: [[SVDG_5]] = !{i32 20, i32 5, i32 2} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about some test cases with templates? Something like: template <typename T>
struct Base {
T DG : SV_DispatchGrid;
};
struct Derived1 : Base<uint3> {
int4 x;
};
[Shader("node")]
[NodeLaunch("broadcasting")]
[NodeMaxDispatchGrid(32,16,1)]
[NumThreads(32,1,1)]
void node6(DispatchNodeInputRecord<Derived1 > input) {}
template <typename T>
struct Derived2 : Base<T> {
T Y;
};
[Shader("node")]
[NodeLaunch("broadcasting")]
[NodeMaxDispatchGrid(32,16,1)]
[NumThreads(32,1,1)]
void node7(DispatchNodeInputRecord<Derived2<uint2> > input) {}
template <typename T>
struct Derived3 {
Derived2<T> V;
};
[Shader("node")]
[NodeLaunch("broadcasting")]
[NodeMaxDispatchGrid(32,16,1)]
[NumThreads(32,1,1)]
void node8(DispatchNodeInputRecord< Derived3 <uint3> > input) {}
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great idea! I've updated the test to include these cases. |
||
|
|
||
| template <typename T> | ||
| struct Base { | ||
| T DG : SV_DispatchGrid; | ||
| }; | ||
|
|
||
| struct Derived1 : Base<uint3> { | ||
| int4 x; | ||
| }; | ||
|
|
||
| [Shader("node")] | ||
| [NodeLaunch("broadcasting")] | ||
| [NodeMaxDispatchGrid(32,16,1)] | ||
| [NumThreads(32,1,1)] | ||
| void node6(DispatchNodeInputRecord<Derived1 > input) {} | ||
| // CHECK: {!"node6" | ||
| // CHECK: , i32 1, ![[SVDG_1]] | ||
|
|
||
| template <typename T> | ||
| struct Derived2 : Base<T> { | ||
| T Y; | ||
| }; | ||
|
|
||
| [Shader("node")] | ||
| [NodeLaunch("broadcasting")] | ||
| [NodeMaxDispatchGrid(32,16,1)] | ||
| [NumThreads(32,1,1)] | ||
| void node7(DispatchNodeInputRecord<Derived2<uint2> > input) {} | ||
| // CHECK: {!"node7" | ||
| // CHECK: , i32 1, ![[SVDG_7:[0-9]+]] | ||
| // CHECK: [[SVDG_7]] = !{i32 0, i32 5, i32 2} | ||
|
|
||
| template <typename T> | ||
| struct Derived3 { | ||
| Derived2<T> V; | ||
| }; | ||
|
|
||
| [Shader("node")] | ||
| [NodeLaunch("broadcasting")] | ||
| [NodeMaxDispatchGrid(32,16,1)] | ||
| [NumThreads(32,1,1)] | ||
| void node8(DispatchNodeInputRecord< Derived3 <uint3> > input) {} | ||
| // CHECK: {!"node8" | ||
| // CHECK: , i32 1, ![[SVDG_1]] | ||
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.
Uh oh!
There was an error while loading. Please reload this page.