MCPcopy Create free account
hub / github.com/ByteDance-Seed/Triton-distributed / __sub__

Method __sub__

python/little_kernel/core/expr.py:72–81  ·  view source on GitHub ↗
(self, other)

Source from the content-addressed store, hash-verified

70 return BinOp(BinOpKind.ADD, self, other, self.type)
71
72 def __sub__(self, other):
73 other = self._to_expr(other)
74 # Pointer - int -> PTR_SUB
75 if self.type.is_pointer():
76 if isinstance(other.type, IntType):
77 return BinOp(BinOpKind.PTR_SUB, self, other, self.type)
78 else:
79 raise ValueError(f"Can't sub pointer with value of {other.type} type.")
80 # Regular subtraction
81 return BinOp(BinOpKind.SUB, self, other, self.type)
82
83 def __mul__(self, other):
84 other = self._to_expr(other)

Callers

nothing calls this directly

Calls 3

_to_exprMethod · 0.95
BinOpClass · 0.85
is_pointerMethod · 0.45

Tested by

no test coverage detected