-
Notifications
You must be signed in to change notification settings - Fork 686
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
[spirv] support vk::ext_execution_mode_id(..) #4190
Merged
Merged
Changes from all commits
Commits
Show all changes
4 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
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
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
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
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
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
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
7 changes: 5 additions & 2 deletions
7
tools/clang/test/CodeGenSPIRV/spv.intrinsicExecutionMode.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 |
---|---|---|
@@ -1,14 +1,17 @@ | ||
// RUN: %dxc -T ps_6_0 -E main -spirv | ||
|
||
|
||
// CHECK: OpCapability ShaderClockKHR | ||
// CHECK: OpExtension "SPV_KHR_shader_clock" | ||
// CHECK: OpExecutionMode {{%\w+}} StencilRefReplacingEXT | ||
// CHECK: OpExecutionMode {{%\w+}} SubgroupSize 32 | ||
// CHECK: OpDecorate {{%\w+}} BuiltIn FragStencilRefEXT | ||
|
||
[[vk::ext_decorate(11, 5014)]] | ||
int main() : SV_Target0 { | ||
|
||
[[vk::ext_capability(5055)]] | ||
[[vk::ext_extension("SPV_KHR_shader_clock")]] | ||
vk::ext_execution_mode(/*StencilRefReplacingEXT*/5027); | ||
|
||
vk::ext_execution_mode(/*SubgroupSize*/35, 32); | ||
return 3; | ||
} |
16 changes: 16 additions & 0 deletions
16
tools/clang/test/CodeGenSPIRV/spv.intrinsicExecutionModeId.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,16 @@ | ||
// RUN: %dxc -T ps_6_0 -E main -spirv | ||
|
||
// CHECK: OpCapability ShaderClockKHR | ||
// CHECK: OpExtension "SPV_KHR_shader_clock" | ||
// CHECK: OpExecutionModeId {{%\w+}} LocalSizeId %uint_8 %uint_8 %uint_8 | ||
// CHECK: OpExecutionModeId {{%\w+}} LocalSizeHintId %uint_4 %uint_4 %uint_4 | ||
|
||
int main() : SV_Target0 { | ||
vk::ext_execution_mode_id(/*LocalSizeId*/38, 8, 8, 8); | ||
|
||
[[vk::ext_capability(5055)]] | ||
[[vk::ext_extension("SPV_KHR_shader_clock")]] | ||
vk::ext_execution_mode_id(/*LocalSizeHintId*/39, 4, 4, 4); | ||
|
||
return 3; | ||
} |
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
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
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.
the vk::ext_execution_mode function call with extension and capability looks a little bit heavy
i think we might introduce new intrinsic functions directly.
vk::ext_capability(5055);
vk::ext_extension("SPV_KHR_shader_clock")
or
put these vk::attributes before entry functions.
[[vk::ext_capability(5055)]]
[[vk::ext_extension("SPV_KHR_shader_clock")]]
[[vk::ext_decorate(11, 5014)]]
int main() : SV_Target0 {
}
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.
Actually I also thought we have to add separate functions for capabilities and extensions.
However, in our email discussion (between you and me and Tobias Hector) a few months ago, Tobias Hector said
This is the motivation to add capabilities and extensions as attributes in the initial GLSL version of GL_EXT_spirv_intrinsics design.
For example, I think Tobias Hector is worried about the following case:
When the code size becomes big e.g., more than 3000 lines and many preprocessor based options and header files, users can miss enabling capabilites and extensions if we separate them from
vk::ext_instruction
orvk::ext_execution_mode
orvk::ext_type_def
.I agree with Tobias Hector's opinion. Just I think it would be unlikely that users use this feature for actual game shaders that has more than 1000 lines. I guess it would be mainly used by hardware vendors to test new specs.
However, since we can prevent users from making mistakes using some language design, I think this is a reasonable direction to go.
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.
thanks, it makes sense.