Skip to content

UOp

UOp ¤

UOp(
    op: UOps,
    dtype: DType = void,
    src: Tuple[UOp, ...] = tuple(),
    arg: Any = None,
)

Bases: MathTrait

Source code in tinygrad/ops.py
184
185
186
187
188
189
190
191
def __init__(self, op: UOps, dtype:DType=dtypes.void, src: Tuple[UOp,...]=tuple(), arg:Any=None):
  # TODO: instant check rules here make debugging easier
  #assert op in UOps and isinstance(dtype, DType), f"bad UOp creation with {op} {dtype}"
  #if op is UOps.ALU and arg is BinaryOps.CMPNE: assert dtype.scalar() == dtypes.bool
  #if op is UOps.VECTORIZE and dtype != dtypes.void: assert len(src) == dtype.count, f"{len(src)} invalid for {dtype}"
  #if op is UOps.ALU and arg not in (BinaryOps.CMPNE, BinaryOps.CMPLT, TernaryOps.WHERE): assert all_same([dtype] + [x.dtype for x in src])
  #if op is UOps.CAST: assert dtype.count == src[0].dtype.count, f"cast can't change vectorization {src[0].dtype} --> {dtype}"
  self.op, self.dtype, self.src, self.arg = op, dtype, src, arg

UOps ¤

Bases: FastEnum

Attributes:

SINK ¤

SINK = auto()

CONTIGUOUS ¤

CONTIGUOUS = auto()

COPY ¤

COPY = auto()

EMPTY ¤

EMPTY = auto()

BUFFER_VIEW ¤

BUFFER_VIEW = auto()

EXPAND ¤

EXPAND = auto()

CONTRACT ¤

CONTRACT = auto()

VIEW ¤

VIEW = auto()

DEFINE_GLOBAL ¤

DEFINE_GLOBAL = auto()

BUFFER ¤

BUFFER = auto()

DEFINE_VAR ¤

DEFINE_VAR = auto()

DEFINE_LOCAL ¤

DEFINE_LOCAL = auto()

DEFINE_ACC ¤

DEFINE_ACC = auto()

VCONST ¤

VCONST = auto()

CONST ¤

CONST = auto()

VALID ¤

VALID = auto()

SPECIAL ¤

SPECIAL = auto()

NOOP ¤

NOOP = auto()

REDUCE ¤

REDUCE = auto()

REDUCE_AXIS ¤

REDUCE_AXIS = auto()

GEP ¤

GEP = auto()

VECTORIZE ¤

VECTORIZE = auto()

CAST ¤

CAST = auto()

BITCAST ¤

BITCAST = auto()

LOAD ¤

LOAD = auto()

ALU ¤

ALU = auto()

WMMA ¤

WMMA = auto()

STORE ¤

STORE = auto()

ASSIGN ¤

ASSIGN = auto()

BIND ¤

BIND = auto()

BARRIER ¤

BARRIER = auto()

IF ¤

IF = auto()

RANGE ¤

RANGE = auto()

ENDRANGE ¤

ENDRANGE = auto()

ENDIF ¤

ENDIF = auto()