This document is relevant for: Trn2, Trn3
nki.isa.instruction#
- nki.isa.instruction(name=None, *, input_name=None, output_name=None, iterations=None)[source]#
Reference an instruction by its name or tensor debug names.
Each supplied name is matched exactly.
input_nameselects readers andoutput_nameselects writers. All supplied selectors must match one instruction; missing and ambiguous references fail compilation.References are resolved after loop unrolling, so
instruction("load_3")can select an instruction named"load"in iteration 3. Fixed names gain loop index suffixes automatically; explicit formatted names such asf"load_{i}"retain their format. Use the returned handle withdepends_on,schedule_after,schedule_before, ornki.Kernel.with_schedule. For example, after a loop withunroll=True:nisa.instruction("load", iterations=[3]).schedule_before( nisa.instruction("load", iterations=[0]) )
iterationsaccepts a list or tuple of integer loop index values, ordered outermost to innermost. It appends decimal suffixes toname:instruction("load", iterations=[i, j])is equivalent toinstruction(f"load_{i}_{j}"). Indices may be compiled loop variables that become constant after unrolling. An empty sequence leavesnameunchanged. Tensor selectors are matched as supplied, without suffixes.
This document is relevant for: Trn2, Trn3