triton.program_id

triton.program_id(axis, builder=None)

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.

Parameters
  • axis (int) – The axis of the 3D launch grid. Has to be either 0, 1 or 2.

  • builder (triton.ir.builder) – IR builder to generate code into, optional from within @triton.jit functions