Skip to content

Commit 78f604a

Browse files
committed
On ROCm, always use fast_tanhf for triton codegen.
(cherry picked from commit 7c5277f)
1 parent 63e525b commit 78f604a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

torch/_inductor/codegen/triton.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,12 @@ def tan(x):
12321232
@staticmethod
12331233
@maybe_upcast_float32()
12341234
def tanh(x):
1235-
return f"libdevice.fast_tanhf({x})"
1235+
# On ROCm, always use fast_tanhf
1236+
# Requires ROCm fork of Triton 3.3, 3.4, 3.5 or upstream Triton 3.6+
1237+
if torch.version.hip:
1238+
return f"libdevice.fast_tanhf({x})"
1239+
else:
1240+
return f"libdevice.tanh({x})"
12361241

12371242
@staticmethod
12381243
@maybe_upcast_float32()

0 commit comments

Comments
 (0)