Skip to content

Commit be87a96

Browse files
committed
On ROCm, always use fast_tanhf for triton codegen.
(cherry picked from commit 7c5277f)
1 parent c8b6bc9 commit be87a96

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
@@ -1315,7 +1315,12 @@ def tan(x):
13151315
@staticmethod
13161316
@maybe_upcast_float32()
13171317
def tanh(x):
1318-
return f"libdevice.fast_tanhf({x})"
1318+
# On ROCm, always use fast_tanhf
1319+
# Requires ROCm fork of Triton 3.3, 3.4, 3.5 or upstream Triton 3.6+
1320+
if torch.version.hip:
1321+
return f"libdevice.fast_tanhf({x})"
1322+
else:
1323+
return f"libdevice.tanh({x})"
13191324

13201325
@staticmethod
13211326
@maybe_upcast_float32()

0 commit comments

Comments
 (0)