Skip to content

Commit 4742f57

Browse files
[KUNLUNXIN] speed up rsqrt op (#1266)
1 parent 4be17e6 commit 4742f57

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • src/flag_gems/runtime/backend/_kunlunxin/ops

src/flag_gems/runtime/backend/_kunlunxin/ops/rsqrt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import triton
44
import triton.language as tl
5+
import triton.language.extra.xpu.libdevice as xpu
56

67
from ..utils.pointwise_dynamic import pointwise_dynamic
78

@@ -11,7 +12,7 @@
1112
@pointwise_dynamic(promotion_methods=[(0, "INT_TO_FLOAT")])
1213
@triton.jit
1314
def rsqrt_func(x):
14-
return 1.0 / tl.sqrt(x.to(tl.float32))
15+
return xpu.rsqrt(x.to(tl.float32))
1516

1617

1718
def rsqrt(A):

0 commit comments

Comments
 (0)