triton.language.range
- class triton.language.range(arg1, arg2=None, step=None, num_stages=None, loop_unroll_factor=None)
Iterator that counts upward forever.
@triton.jit def kernel(...): for i in tl.range(10, num_stages=3): ...
- Note:
This is a special iterator used to implement similar semantics to Python’s
rangein the context oftriton.jitfunctions. In addition, it allows user to pass extra attributes to the compiler.- Parameters:
arg1 – the start value.
arg2 – the end value.
step – the step value.
num_stages –
pipeline the loop into this many stages (so there are
num_stagesiterations of the loop in flight at once).Note this is subtly different than passing
num_stagesas a kernel argument. The kernel argument only pipelines loads that feed intodotoperations, while this attribute tries to pipeline most (though not all) loads in this loop.loop_unroll_factor – Tells the Triton IR level loop unroller how many times to unroll a for loop that this range is used with. Less than 2 for this value implies no unrolling.
- __init__(arg1, arg2=None, step=None, num_stages=None, loop_unroll_factor=None)
Methods
__init__(arg1[, arg2, step, num_stages, ...])