-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[AMDGPU] Add support for v_exp_bf16 on gfx1250
#149229
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| ; RUN: llc -global-isel=0 -mtriple=amdgcn -mcpu=gfx1250 < %s | FileCheck -check-prefixes=GCN %s | ||
| ; xUN: llc -global-isel=1 -mtriple=amdgcn -mcpu=gfx1250 < %s | FileCheck -check-prefix=GCN %s | ||
|
|
||
| ; FIXME: GlobalISel does not work with bf16 | ||
|
|
||
| declare bfloat @llvm.amdgcn.exp2.bf16(bfloat) #0 | ||
|
|
||
| ; GCN-LABEL: {{^}}exp_bf16: | ||
| ; GCN: v_exp_bf16_e32 {{v[0-9]+}}, {{s[0-9]+}} | ||
| define amdgpu_kernel void @exp_bf16(ptr addrspace(1) %out, bfloat %src) #1 { | ||
| %exp = call bfloat @llvm.amdgcn.exp2.bf16(bfloat %src) #0 | ||
| store bfloat %exp, ptr addrspace(1) %out, align 2 | ||
| ret void | ||
| } | ||
|
|
||
| ; GCN-LABEL: {{^}}exp_bf16_constant_4 | ||
| ; GCN: v_exp_bf16_e32 v0, 4.0 | ||
| define amdgpu_kernel void @exp_bf16_constant_4(ptr addrspace(1) %out) #1 { | ||
| %exp = call bfloat @llvm.amdgcn.exp2.bf16(bfloat 4.0) #0 | ||
| store bfloat %exp, ptr addrspace(1) %out, align 2 | ||
| ret void | ||
| } | ||
|
|
||
| ; GCN-LABEL: {{^}}exp_bf16_constant_100 | ||
| ; GCN: v_exp_bf16_e32 {{v[0-9]+}}, 0x42c8 | ||
| define amdgpu_kernel void @exp_bf16_constant_100(ptr addrspace(1) %out) #1 { | ||
| %exp = call bfloat @llvm.amdgcn.exp2.bf16(bfloat 100.0) #0 | ||
| store bfloat %exp, ptr addrspace(1) %out, align 2 | ||
| ret void | ||
| } | ||
|
|
||
| attributes #0 = { nounwind readnone } | ||
| attributes #1 = { nounwind } |
Oops, something went wrong.
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.
If it's OK to directly select the generic intrinsic, why add the amdgcn one?
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.
They were added in different times in the past and we do have a builtin for that.
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 don't follow
Uh oh!
There was an error while loading. Please reload this page.
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 target intrinsic
int_amdgcn_exp2was added a long time ago (along with the patternAMDGPUexpf16). We didn't explicitly define a bf16 version of it. However, we did add a Clang builtin for that.On the other hand, the generic intrinsic support was only added about a month ago.
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.
Because it is direct access to the instruction w/o following potential legalization.
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.
There's no legalization if the instruction works correctly. There's no reason to have the clang builtin, though the codegen for the target intrinsic should still work with the new type if legal