-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[AMDGPU] Add support for v_tanh_bf16
on gfx1250
#147425
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13658,6 +13658,7 @@ bool SITargetLowering::isCanonicalized(Register Reg, const MachineFunction &MF, | |
case Intrinsic::amdgcn_frexp_mant: | ||
case Intrinsic::amdgcn_fdot2: | ||
case Intrinsic::amdgcn_trig_preop: | ||
case Intrinsic::amdgcn_tanh: | ||
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. This isn't tested 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. It was but not by this instruction, since this intrinsic is used for those different types. I'll remove them then? 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. I don't follow, this shouldn't be hard to test? e.g. fcanonicalize-elimination.ll, you should just need a canonicalize call after these which should fold out 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. We can't do it at this moment because the support for I'll add the test to downstream though. |
||
return true; | ||
default: | ||
break; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1250 -mattr=+real-true16 %s -o - | FileCheck -check-prefix=SDAG-REAL16 %s | ||
; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1250 -mattr=-real-true16 %s -o - | FileCheck -check-prefix=SDAG-FAKE16 %s | ||
; xUN: llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1250 -mattr=+real-true16 %s -o - | FileCheck -check-prefix=GISEL-REAL16 %s | ||
; xUN: llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1250 -mattr=-real-true16 %s -o - | FileCheck -check-prefix=GISEL-FAKE16 %s | ||
|
||
; FIXME: GlobalISel does not work with bf16 | ||
|
||
declare bfloat @llvm.amdgcn.tanh.bf16(bfloat) #0 | ||
|
||
define amdgpu_kernel void @tanh_bf16(ptr addrspace(1) %out, bfloat %src) #1 { | ||
; SDAG-REAL16-LABEL: tanh_bf16: | ||
; SDAG-REAL16: ; %bb.0: | ||
; SDAG-REAL16-NEXT: s_load_b96 s[0:2], s[4:5], 0x0 | ||
; SDAG-REAL16-NEXT: v_mov_b32_e32 v1, 0 | ||
; SDAG-REAL16-NEXT: s_wait_kmcnt 0x0 | ||
; SDAG-REAL16-NEXT: v_tanh_bf16_e32 v0.l, s2 | ||
; SDAG-REAL16-NEXT: flat_store_b16 v1, v0, s[0:1] | ||
; SDAG-REAL16-NEXT: s_endpgm | ||
; | ||
; SDAG-FAKE16-LABEL: tanh_bf16: | ||
; SDAG-FAKE16: ; %bb.0: | ||
; SDAG-FAKE16-NEXT: s_load_b96 s[0:2], s[4:5], 0x0 | ||
; SDAG-FAKE16-NEXT: v_mov_b32_e32 v1, 0 | ||
; SDAG-FAKE16-NEXT: s_wait_kmcnt 0x0 | ||
; SDAG-FAKE16-NEXT: v_tanh_bf16_e32 v0, s2 | ||
; SDAG-FAKE16-NEXT: global_store_b16 v1, v0, s[0:1] | ||
; SDAG-FAKE16-NEXT: s_endpgm | ||
%tanh = call bfloat @llvm.amdgcn.tanh.bf16(bfloat %src) #0 | ||
store bfloat %tanh, ptr addrspace(1) %out, align 2 | ||
ret void | ||
} | ||
|
||
define amdgpu_kernel void @tanh_bf16_constant_4(ptr addrspace(1) %out) #1 { | ||
; SDAG-REAL16-LABEL: tanh_bf16_constant_4: | ||
; SDAG-REAL16: ; %bb.0: | ||
; SDAG-REAL16-NEXT: s_load_b64 s[0:1], s[4:5], 0x0 | ||
; SDAG-REAL16-NEXT: v_tanh_bf16_e32 v0.l, 4.0 | ||
; SDAG-REAL16-NEXT: v_mov_b32_e32 v1, 0 | ||
; SDAG-REAL16-NEXT: s_wait_kmcnt 0x0 | ||
; SDAG-REAL16-NEXT: flat_store_b16 v1, v0, s[0:1] | ||
; SDAG-REAL16-NEXT: s_endpgm | ||
; | ||
; SDAG-FAKE16-LABEL: tanh_bf16_constant_4: | ||
; SDAG-FAKE16: ; %bb.0: | ||
; SDAG-FAKE16-NEXT: s_load_b64 s[0:1], s[4:5], 0x0 | ||
; SDAG-FAKE16-NEXT: v_tanh_bf16_e32 v0, 4.0 | ||
; SDAG-FAKE16-NEXT: v_mov_b32_e32 v1, 0 | ||
; SDAG-FAKE16-NEXT: s_wait_kmcnt 0x0 | ||
; SDAG-FAKE16-NEXT: global_store_b16 v1, v0, s[0:1] | ||
; SDAG-FAKE16-NEXT: s_endpgm | ||
%tanh = call bfloat @llvm.amdgcn.tanh.bf16(bfloat 4.0) #0 | ||
store bfloat %tanh, ptr addrspace(1) %out, align 2 | ||
ret void | ||
} | ||
|
||
define amdgpu_kernel void @tanh_bf16_constant_100(ptr addrspace(1) %out) #1 { | ||
; SDAG-REAL16-LABEL: tanh_bf16_constant_100: | ||
; SDAG-REAL16: ; %bb.0: | ||
; SDAG-REAL16-NEXT: s_load_b64 s[0:1], s[4:5], 0x0 | ||
; SDAG-REAL16-NEXT: v_tanh_bf16_e32 v0.l, 0x42c8 | ||
; SDAG-REAL16-NEXT: v_mov_b32_e32 v1, 0 | ||
; SDAG-REAL16-NEXT: s_wait_kmcnt 0x0 | ||
; SDAG-REAL16-NEXT: flat_store_b16 v1, v0, s[0:1] | ||
; SDAG-REAL16-NEXT: s_endpgm | ||
; | ||
; SDAG-FAKE16-LABEL: tanh_bf16_constant_100: | ||
; SDAG-FAKE16: ; %bb.0: | ||
; SDAG-FAKE16-NEXT: s_load_b64 s[0:1], s[4:5], 0x0 | ||
; SDAG-FAKE16-NEXT: v_tanh_bf16_e32 v0, 0x42c8 | ||
; SDAG-FAKE16-NEXT: v_mov_b32_e32 v1, 0 | ||
; SDAG-FAKE16-NEXT: s_wait_kmcnt 0x0 | ||
; SDAG-FAKE16-NEXT: global_store_b16 v1, v0, s[0:1] | ||
; SDAG-FAKE16-NEXT: s_endpgm | ||
%tanh = call bfloat @llvm.amdgcn.tanh.bf16(bfloat 100.0) #0 | ||
store bfloat %tanh, ptr addrspace(1) %out, align 2 | ||
ret void | ||
} | ||
|
||
attributes #0 = { nounwind readnone } | ||
attributes #1 = { nounwind } |
Uh oh!
There was an error while loading. Please reload this page.