Multi-Core Addition¶
Document status
Owner: CL Team · Baseline: Legato 0.14.1+public, PyTorch 2.10.0+cpu, Bertha EVT0 · Last verified: 2026-10-19
Split BF16 [32, 256] inputs by row and add them across 32 cores.
Core i processes row i and stores it in a separate [1, 256] output.
Save the complete executable in the SDK environment and run it:
1 | |
Load inputs for each core¶
1 2 3 4 5 6 7 | |
static.for_each generates the load requests for all 32 cores at compile time.
For each core, it requests one row of a followed by one row of b.
Common computation and output passing¶
1 2 3 4 5 | |
The kernel's param_kinds declares inputs a and b as top, and output out as core.
Outputs are allocated separately for each core. Passing legato.Args(outputs, bertha.all_cores) connects tensor i in the list to the out argument of core i.
The dtype and shape of all 32 tensors must match the output type declaration.
1 2 3 4 5 6 | |
After execution, retrieve all core outputs to the CPU and concatenate them in order to compare the entire [32, 256] result.
Each core uses different inputs, so the comparison also checks for incorrect row assignment.
On success, the program prints PASS: multi_core_add [32, 256], BF16, 32 cores.