Coverage for src/flag_gems/runtime/backend/_kunlunxin/ops/exp.py: 0%
20 statements
« prev ^ index » next coverage.py v7.6.9, created at 2026-03-09 01:57 +0800
« prev ^ index » next coverage.py v7.6.9, created at 2026-03-09 01:57 +0800
1import logging
3import triton
4import triton.language as tl
5from _kunlunxin.utils.codegen_config_utils import CodeGenConfig
7from ..utils.pointwise_dynamic import pointwise_dynamic
9logger = logging.getLogger("flag_gems").getChild(__name__.lstrip("."))
11config_ = CodeGenConfig(
12 512,
13 (65536, 65536, 65536),
14 32,
15 True,
16 prefer_1d_tile=True,
17 buffer_size_limit=4096,
18 isCloseVectorization=True,
19 kunlunAutoGrid=True,
20 unroll_num=8,
21)
24@pointwise_dynamic(promotion_methods=[(0, "INT_TO_FLOAT")], config=config_)
25@triton.jit
26def exp_func(x):
27 return tl.exp(x.to(tl.float32))
30def exp(A):
31 logger.debug("GEMS EXP")
32 return exp_func(A)
35def exp_(A):
36 logger.debug("GEMS EXP_")
37 return exp_func(A, out0=A)
40# exp.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
41def exp_out(A, out):
42 logger.debug("GEMS EXP_OUT")
43 return exp_func(A, out0=out)