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 to SBUF.

This instruction stores the current PRNG states cached inside the engine to SBUF. 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 with the partition dimension representing the compute lanes and the free dimension containing the state values

  • engine – specify which engine to use: nki.isa.vector_engine, nki.isa.gpsimd_engine, or nki.isa.unknown_engine (default, the best engine will be selected)