-
Notifications
You must be signed in to change notification settings - Fork 706
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
Support SV_DispatchGrid semantic in a nested record #6931
Open
tcorringham
wants to merge
3
commits into
microsoft:main
Choose a base branch
from
tcorringham:issue-6928
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+205
−55
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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 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} | ||
|
||
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]] |
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.
What about some test cases with templates?
Something like:
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.
Great idea! I've updated the test to include these cases.