Skip to content

Writing and Running Kernels

Document status

Owner: CL Team · Baseline: Legato 0.14.1+public, PyTorch 2.10.0+cpu, Bertha EVT0 · Last verified: 2026-10-19

Exercises for writing Legato kernels and compiling and running them in legato.session(...). The examples load inputs, compute on cores, store outputs, and compare them with CPU reference values.

Prerequisites

  • A Bertha LPU server with the SDK installed.
  • An environment with Legato 0.14.1, PyTorch 2.10, torch_ha, and the HW runtime.
  • Target: Bertha EVT0, 32 cores, BF16. Each example uses a fixed shape.

Save and run the Python files in the SDK environment. The first example uses core 0 only.

Order Example Topics
1 Vector addition Kernel definition, device memory, compilation, execution, and result checking
2 Matrix multiplication MPU weight layout and matrix multiplication
3 Multi-core addition Tile partitioning and per-core outputs

Each page provides a standalone executable file. Changes to shape, dtype, or core count require revalidation of memory layout and results. See the Compiler documentation for the full API.