-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[AMDGPU] Add type-generic llvm.amdgcn.readfirstlane2 intrinsic #87334
base: main
Are you sure you want to change the base?
Conversation
jayfoad
commented
Apr 2, 2024
- [AMDGPU] Generate readfirstlane checks
- [AMDGPU] Add type-generic llvm.amdgcn.readfirstlane2 intrinsic
Prior art: TODO:
This patch tries to legalize readfirstlane2 for all legal types, but it should probably work on illegal types like |
@@ -2206,11 +2206,18 @@ class AMDGPUWaveReduce<LLVMType data_ty = llvm_anyint_ty> : Intrinsic< | |||
def int_amdgcn_wave_reduce_umin : AMDGPUWaveReduce; | |||
def int_amdgcn_wave_reduce_umax : AMDGPUWaveReduce; | |||
|
|||
// i32 llvm.amdgcn.readfirstlane(i32) |
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 think we should just upgrade the intrinsic instead of introducing a new copy
@@ -1,71 +1,176 @@ | |||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 | |||
; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=fiji -verify-machineinstrs < %s | FileCheck -enable-var-scope %s |
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.
global-isel checks
%x = call float @llvm.amdgcn.readfirstlane2.f32(float %src) | ||
call void asm sideeffect "; use $0", "s"(float %x) | ||
ret void | ||
} |
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.
Check bfloat, vector bfloat/half, float2, some pointers/pointer vectors
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 is float2? Done the others.
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.
<2 x float>
MVT IntVT = MVT::getIntegerVT(VT.getSizeInBits()); | ||
return DAG.getBitcast( | ||
VT, DAG.getAnyExtOrTrunc( | ||
DAG.getNode(AMDGPUISD::READFIRSTLANE, DL, MVT::i32, |
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.
Maybe directly accept legal 32-bit types and avoid the bitcast?