Coverage for src/flag_gems/runtime/backend/_sunrise/ops/cos.py: 0%
19 statements
« prev ^ index » next coverage.py v7.6.9, created at 2026-06-05 07:36 +0800
« prev ^ index » next coverage.py v7.6.9, created at 2026-06-05 07:36 +0800
1import logging
3import triton
4import triton.language as tl
6from flag_gems.utils import pointwise_dynamic
7from flag_gems.utils.pointwise_dynamic import CodeGenConfig
9logger = logging.getLogger("flag_gems").getChild(__name__.lstrip("."))
11MAX_GRID_SIZES = (65535, 65535, 65535)
12config = CodeGenConfig(
13 max_tile_size=512,
14 max_grid_size=MAX_GRID_SIZES,
15 max_num_warps_per_cta=32,
16 prefer_block_pointer=True,
17 prefer_1d_tile=True,
18)
21@pointwise_dynamic(promotion_methods=[(0, "INT_TO_FLOAT")], config=config)
22@triton.jit
23def cos_func(x):
24 return tl.cos(x.to(tl.float32))
27def cos(A):
28 logger.debug("GEMS COS")
29 return cos_func(A)
32def cos_(A):
33 logger.debug("GEMS COS_")
34 cos_func(A, out0=A)
35 return A