Python API

Programming Model

program_id

Returns the id of the current program instance along the given axis. Triton uses an SPMD model in which different @triton.jit functions run in parallel with different `program_id`s.

num_programs

Returns the number of program instances launched along the given axis.

Creation Ops

arange

Returns contiguous values within the open interval [start, end).

zeros

Returns a block filled with the scalar value 0 and the given shape.

Shape Manipulation Ops

broadcast_to

Tries to broadcast a block to a new shape.

reshape

Reshapes a block to a new shape.

ravel

Linear Algebra Ops

dot

Returns the matrix product of two blocks.

Memory Ops

load

Return a block of data whose values are, elementwise, loaded from memory at location defined by pointer.

store

Stores value block of elements in memory, element-wise, at the memory locations specified by pointer.

atomic_cas

atomic_xchg

Indexing Ops

where

Returns a block of elements from either x or y, depending on condition.

Reduction Ops

max

min

sum

Comparison ops

minimum

maximum

Compiler Hint Ops

multiple_of