Coverage for src/flag_gems/runtime/backend/_kunlunxin/ops/cos.py: 0%
18 statements
« prev ^ index » next coverage.py v7.6.9, created at 2026-06-10 07:09 +0800
« prev ^ index » next coverage.py v7.6.9, created at 2026-06-10 07:09 +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=False,
19 kunlunAutoGrid=True,
20 unroll_num=8,
21)
24@pointwise_dynamic(promotion_methods=[(0, "INT_TO_FLOAT")], config=config_)
25@triton.jit
26def cos_func(x):
27 return tl.cos(x.to(tl.float32))
30def cos(A):
31 logger.debug("GEMS_KUNLUNXIN COS")
32 return cos_func(A)
35def cos_(A):
36 logger.debug("GEMS_KUNLUNXIN COS_")
37 cos_func(A, out0=A)
38 return A