This document is relevant for: Trn2, Trn3

nki.compiler#

The nki.compiler module provides the public per-kernel configuration passed to nki.jit().

Per-kernel config#

Passed to the nki.jit() decorator as @nki.jit(compile_config=CompileConfig(...), specialization_config=SpecializationConfig(...)). CompileConfig holds options that impact downstream compiler behavior; SpecializationConfig holds options that tune the specialization phase.

CompileConfig

Per-kernel compile configuration passed to @nki.jit(compile_config=...).

SpecializationConfig

Per-kernel specialization-time config passed to @nki.jit(specialization_config=...).

AddressRotation

Which tensors the compiler can move to a different SBUF address or PSUM bank after allocation (see CompileConfig.address_rotation).

Allocation

How the compiler assigns SBUF, PSUM and HBM addresses to the tiles of the kernel (CompileConfig.allocation).

AllocationMode

How the new allocation selects an address for each tile (CompileConfig.experimental_allocation_mode).

SchedulingHeuristic

How the new scheduling selects the next instruction from the ready instructions (CompileConfig.experimental_scheduling_heuristic).

OptLevel

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

This document is relevant for: Trn2, Trn3