Coverage for src/flag_gems/ops/bitwise_or.py: 93%

27 statements  

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

1import logging 

2 

3import triton 

4 

5from flag_gems.utils import pointwise_dynamic 

6 

7logger = logging.getLogger(__name__) 

8 

9 

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

11@triton.jit 

12def bitwise_or_func(x, y): 

13 return x | y 

14 

15 

16def bitwise_or_tensor(A, B): 

17 logger.debug("GEMS BITWISE OR") 

18 return bitwise_or_func(A, B) 

19 

20 

21def bitwise_or_tensor_(A, B): 

22 logger.debug("GEMS BITWISE OR_") 

23 return bitwise_or_func(A, B, out0=A) 

24 

25 

26@pointwise_dynamic(is_tensor=[True, False], promotion_methods=[(0, 1, "DEFAULT")]) 

27@triton.jit 

28def bitwise_or_func_scalar(x, y): 

29 return x | y 

30 

31 

32def bitwise_or_scalar(A, B): 

33 logger.debug("GEMS BITWISE OR SCALAR") 

34 return bitwise_or_func_scalar(A, B) 

35 

36 

37def bitwise_or_scalar_(A, B): 

38 logger.debug("GEMS BITWISE OR_ SCALAR") 

39 return bitwise_or_func_scalar(A, B, out0=A) 

40 

41 

42def bitwise_or_scalar_tensor(A, B): 

43 logger.debug("GEMS BITWISE OR SCALAR TENSOR") 

44 return bitwise_or_func_scalar(B, A)