Skip to content

Commit 7cc238e

Browse files
committed
Conditionalize fast_tanhf on triton_version.
(cherry picked from commit f416c71)
1 parent 084d7b3 commit 7cc238e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

torch/_inductor/codegen/triton.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from torch._prims_common import is_integer_dtype
2727
from torch.utils._ordered_set import OrderedSet
2828
from torch.utils._sympy.functions import CeilDiv, FloorDiv, ModularIndexing
29-
from torch.utils._triton import has_triton_package
29+
from torch.utils._triton import has_triton_package, get_triton_version
3030

3131
from ...utils._sympy.symbol import free_symbol_is_type, prefix_str, symbol_is_type, SymT
3232
from ...utils._sympy.value_ranges import ValueRanges
@@ -1232,9 +1232,9 @@ def tan(x):
12321232
@staticmethod
12331233
@maybe_upcast_float32()
12341234
def tanh(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:
1235+
if torch.version.hip and get_triton_version() > (3, 2):
1236+
# On ROCm, use fast_tanhf depending on Triton version
1237+
# Requires ROCm fork of Triton 3.3, 3.4, 3.5 or upstream Triton 3.6+
12381238
return f"libdevice.fast_tanhf({x})"
12391239
else:
12401240
return f"libdevice.tanh({x})"

0 commit comments

Comments
 (0)