-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[AMDGPU] Add builtins for wave reduction intrinsics #127013
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
Closed
Closed
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
29bb614
[AMDGPU] Wave Reduce Intrinsics for i32 type
easyonaadit 48783dc
Renamed function to getIdentityValueForWaveReduction
easyonaadit 38642e4
[AMDGPU] Add builtins for wave reduction intrinsics
easyonaadit ad1dd4e
add strategy argument in builtin
easyonaadit 054aa39
test for stratergy
easyonaadit 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -277,16 +277,31 @@ def : GCNPat <(vt (int_amdgcn_set_inactive vt:$src, vt:$inactive)), | |
| def : GCNPat<(i32 (int_amdgcn_set_inactive_chain_arg i32:$src, i32:$inactive)), | ||
| (V_SET_INACTIVE_B32 0, VGPR_32:$src, 0, VGPR_32:$inactive, (IMPLICIT_DEF))>; | ||
|
|
||
| let usesCustomInserter = 1, hasSideEffects = 0, mayLoad = 0, mayStore = 0, Uses = [EXEC] in { | ||
| def WAVE_REDUCE_UMIN_PSEUDO_U32 : VPseudoInstSI <(outs SGPR_32:$sdst), | ||
| (ins VSrc_b32: $src, VSrc_b32:$strategy), | ||
| [(set i32:$sdst, (int_amdgcn_wave_reduce_umin i32:$src, i32:$strategy))]> { | ||
| // clang-format off | ||
| defvar int_amdgcn_wave_reduce_ = "int_amdgcn_wave_reduce_"; | ||
| multiclass | ||
| AMDGPUWaveReducePseudoGenerator<string Op, string DataType, string Size> { | ||
| let usesCustomInserter = 1, hasSideEffects = 0, mayLoad = 0, mayStore = 0, Uses = [EXEC] in { | ||
| def !toupper(Op) #"_PSEUDO_" #DataType #Size | ||
| : VPseudoInstSI<(outs SGPR_32 : $sdst), | ||
| (ins VSrc_b32 : $src, VSrc_b32 : $strategy), | ||
| [(set i32 : $sdst, (!cast<AMDGPUWaveReduce>(int_amdgcn_wave_reduce_ #Op) i32 : $src, i32 : $strategy))]> {} | ||
| } | ||
| } | ||
| // clang-format on | ||
|
Contributor
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. why do we need
Contributor
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. tablegen has started getting formatted by |
||
|
|
||
| def WAVE_REDUCE_UMAX_PSEUDO_U32 : VPseudoInstSI <(outs SGPR_32:$sdst), | ||
| (ins VSrc_b32: $src, VSrc_b32:$strategy), | ||
| [(set i32:$sdst, (int_amdgcn_wave_reduce_umax i32:$src, i32:$strategy))]> { | ||
| } | ||
| // Input list : [Operation_name, | ||
| // type - Signed(I)/Unsigned(U)/Float(F)/Bitwise(B), | ||
| // Size_in_bits] | ||
| defvar Operations = [ | ||
| ["umin", "U", "32"], ["min", "I", "32"], ["umax", "U", "32"], | ||
| ["max", "I", "32"], ["uadd", "U", "32"], ["add", "I", "32"], | ||
| ["usub", "U", "32"], ["sub", "I", "32"], ["and", "B", "32"], | ||
| ["or", "B", "32"], ["xor", "B", "32"] | ||
| ]; | ||
|
|
||
| foreach Op = Operations in { | ||
| defm WAVE_REDUCE_ : AMDGPUWaveReducePseudoGenerator<Op[0], Op[1], Op[2]>; | ||
| } | ||
|
|
||
| let usesCustomInserter = 1, Defs = [VCC] in { | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.