This document is relevant for: Trn2, Trn3

nki.isa.rand_get_state#

nki.isa.rand_get_state(dst, engine=engine.unknown, name=None)[source]#

Store the current pseudo random number generator (PRNG) states from the engine.

This instruction stores the current PRNG states cached inside the engine to SBUF/PSUM. Each partition in the output tensor holds the PRNG states for the corresponding compute lane inside the engine.

Memory types.

The output dst tile must be in SBUF (NeuronCore-v3) or SBUF/PSUM (NeuronCore-v4+).

Data types.

The output dst tile must be uint32.

Tile size.

  • dst element count for XORWOW must be 6 elements (GpSimd) or 24 elements (Vector).

Constraints.

  • Supported arch versions: NeuronCore-v3+.

  • Supported engines: NeuronCore-v3: GpSimd. NeuronCore-v4+: GpSimd, Vector.

  • Since GpSimd Engine cannot access PSUM, dst must be in SBUF when using GpSimd Engine.

Parameters:
  • dst – the destination tensor to store PRNG state values; must be a 2D uint32 tensor

  • engine – specify which engine to use: nki.isa.engine.vector, nki.isa.engine.gpsimd, or nki.isa.engine.unknown (default, the best engine will be selected)

This document is relevant for: Trn2, Trn3