nki.isa.rand_set_state#
- nki.isa.rand_set_state(src_seeds, engine=engine.unknown, name=None)[source]#
Seed the pseudo random number generator (PRNG) inside the engine.
This instruction initializes the PRNG state for future random number generation operations. Each partition in the source tensor seeds the PRNG states for the corresponding compute lane inside the engine.
The PRNG state is cached inside the engine as a persistent state during the rest of NEFF execution. However, the state cannot survive TPB resets or Runtime reload.
Memory types.
The input
src_seedstile must be in SBUF or PSUM.Data types.
The input
src_seedstile must be uint32.Tile size.
src_seeds 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,
src_seedsmust be in SBUF when using GpSimd Engine.
- Parameters:
src_seeds – the source tensor containing seed values for the PRNG; must be a 2D uint32 tensor with the partition dimension representing the compute lanes and the free dimension containing the seed values
engine – specify which engine to use:
nki.isa.vector_engine,nki.isa.gpsimd_engine, ornki.isa.unknown_engine(default, the best engine will be selected)