Coverage for src/flag_gems/runtime/backend/_kunlunxin/ops/tan.py: 0%

20 statements  

« prev     ^ index     » next       coverage.py v7.6.9, created at 2026-03-19 02:32 +0800

1import logging 

2 

3import triton 

4import triton.language as tl 

5from _kunlunxin.utils.codegen_config_utils import CodeGenConfig 

6 

7from flag_gems.utils import tl_extra_shim 

8 

9from ..utils.pointwise_dynamic import pointwise_dynamic 

10 

11logger = logging.getLogger("flag_gems").getChild(__name__.lstrip(".")) 

12 

13config_ = CodeGenConfig( 

14 512, 

15 (65536, 65536, 65536), 

16 32, 

17 True, 

18 prefer_1d_tile=True, 

19 buffer_size_limit=4096, 

20 unroll_num=4, 

21) 

22 

23 

24@pointwise_dynamic(promotion_methods=[(0, "INT_TO_FLOAT")], config=config_) 

25@triton.jit 

26def tan_func(x): 

27 y = tl_extra_shim.tan(x.to(tl.float32)) 

28 return y 

29 

30 

31def tan(A): 

32 logger.debug("GEMS TAN") 

33 return tan_func(A) 

34 

35 

36def tan_(A): 

37 logger.debug("GEMS TAN_") 

38 tan_func(A, out0=A) 

39 return A