This document is relevant for: Trn2, Trn3

nki.isa.register_move#

nki.isa.register_move(dst, src)[source]#

Move a value into a virtual register.

This instruction loads a value into the specified virtual register. The source can be either a compile-time constant integer or another virtual register.

The virtual register system allows the NKI compiler to allocate physical registers across different engine sequencers as needed. See nisa.register_alloc for more details on virtual register allocation.

This instruction operates on virtual registers only and does not access SBUF, PSUM, or HBM.

Parameters:
  • dst – the destination virtual register (allocated via nisa.register_alloc)

  • src – source value - either a compile-time constant integer or a VirtualRegister

Example:

# Allocate a register and initialize it with a constant
loop_count = nisa.register_alloc()
nisa.register_move(loop_count, 10)  # Set register to 10

# Copy from another register
reg2 = nisa.register_alloc()
nisa.register_move(reg2, loop_count)  # Copy value from loop_count

This document is relevant for: Trn2, Trn3