This document is relevant for: Trn2, Trn3

nki.compiler.OptLevel#

class nki.compiler.OptLevel(value)[source]#

How many optimizations the compiler applies in the new flow (CompileConfig.opt_level).

  • O0: a predictable baseline. Each instruction that can run on more than one engine and has no engine= runs on its default engine, also nisa.tensor_copy.

  • O1 (default): the compiler chooses the engine of each nisa.tensor_copy that has no engine=. Other instructions that have no engine= run on their default engine, unless engine_balancing is on.

  • O2: O1, plus the optimizations that the flow can turn on, for example prefetch_auto, dma_copy_elim and element_widening.

The current flow is the same at every level. See Optimization levels.

Attributes

O0

O1

O2

This document is relevant for: Trn2, Trn3