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

18 statements  

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

1import logging 

2 

3import triton 

4import triton.language as tl 

5 

6from flag_gems.runtime import device 

7 

8from ..utils.pointwise_dynamic import pointwise_dynamic 

9 

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

11device = device.name 

12 

13 

14@pointwise_dynamic(is_tensor=[True, True], promotion_methods=[(0, 0, "DEFAULT")]) 

15@triton.jit 

16def minimum_kernel(X, Y): 

17 if X.dtype == tl.bfloat16: 

18 X = X.to(tl.float32) 

19 Y = Y.to(tl.float32) 

20 return tl.minimum(X, Y) 

21 

22 

23def minimum(X, Y): 

24 logger.debug("GEMS MINIMUM") 

25 assert X.device.type == device and Y.device.type == device 

26 return minimum_kernel(X, Y)