Coverage for src/flag_gems/ops/ceil.py: 91%

22 statements  

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

1import logging 

2 

3import triton 

4import triton.language as tl 

5 

6from flag_gems.utils import pointwise_dynamic 

7 

8logger = logging.getLogger(__name__) 

9 

10 

11@pointwise_dynamic(promotion_methods=[(0, "DEFAULT")]) 

12@triton.jit 

13def ceil_func(x): 

14 return tl.ceil(x.to(tl.float32)).to(x.dtype) 

15 

16 

17def ceil(A): 

18 logger.debug("GEMS CEIL") 

19 return ceil_func(A) 

20 

21 

22def ceil_out(A, *, out=None): 

23 logger.debug("GEMS CEIL_OUT") 

24 if out is None: 

25 return ceil_func(A) 

26 ceil_func(A, out0=out) 

27 return out 

28 

29 

30def ceil_(A): 

31 logger.debug("GEMS CEIL_") 

32 ceil_func(A, out0=A) 

33 return A