pl.optimizations¶
The optimization entries a pl.at(..., optimizations=[...]) list accepts — pl.split,
pl.cross_core_slot and friends. See Runtime overhead.
Optimization config entries for pl.at(..., optimizations=[...]).
Each entry is an orthogonal optimization hint applied to the enclosing scope.
The entries can be combined freely in the optimizations= list.
Available entries
-
pl.split(mode)— Cross-core data-transfer split hint, consumed by theExpandMixedKernelpass. Lowers the scope toInCorewithsplit_=mode::with pl.at(level=pl.Level.CORE_GROUP, optimizations=[pl.split(pl.SplitMode.UP_DOWN)]): ...
-
pl.cross_core_slot(slot_num=N)— Slot count (ring depth) for the automatic cross-core pipe. Orthogonal to splitting; combine freely::with pl.at(level=pl.Level.CORE_GROUP, optimizations=[pl.split(pl.SplitMode.UP_DOWN), pl.cross_core_slot(slot_num=4)]): ...
CrossCoreSlot
dataclass
¶
Bases: Optimization
Slot count (ring depth) for the automatic cross-core pipe.
Orthogonal to splitting — it sizes a data channel, it does not partition
work. Sets the slot_num scope attr, which OutlineIncoreScopes
propagates to the outlined function and ExpandMixedKernel reads to emit
the initialize_pipe slot_num attribute, in whichever directions the
scope actually uses (cube→vector, vector→cube, or both). The reserved buffer
uses slot_size * local_slot_num when a local depth is supplied, otherwise
slot_size * slot_num. The GM ring always retains slot_num slots.
Omitting the entry keeps the default depth of 2 per live direction — enough to double-buffer the handoff while leaving on-chip room for the tiles. The value is ignored when the outlined scope ends up with no cross-core ops.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slot_num
|
int
|
Ring depth. Must be a positive integer. |
required |
local_slot_num
|
int | None
|
A2/A3 consumer-side local depth. Must be positive and
no greater than |
None
|
Optimization
¶
Base class for pl.at(..., optimizations=[...]) entries.
Split
dataclass
¶
Bases: Optimization
Cross-core data-transfer split hint.
Sets ScopeStmt::split_ on the enclosing pl.at scope; that metadata
is consumed by the ExpandMixedKernel pass via the outlined function's
SplitMode. optimizations=[pl.split(mode)] lowers the scope to
ScopeKind::InCore with the split metadata attached.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
SplitMode
|
Split mode ( |
required |
slot_num
|
int | None
|
Deprecated — use |
None
|
cross_core_slot(*, slot_num, local_slot_num=None)
¶
Create a CrossCoreSlot optimization entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slot_num
|
int
|
Cross-core pipe slot count (ring depth). Must be positive. |
required |
local_slot_num
|
int | None
|
Optional A2/A3 local FIFO depth, in |
None
|
Returns:
| Type | Description |
|---|---|
CrossCoreSlot
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If a depth is not a positive integer or the local depth exceeds the ring depth. |
Examples:
split(mode, *, slot_num=None)
¶
Create a Split optimization entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
SplitMode
|
Split mode. May be |
required |
slot_num
|
int | None
|
Deprecated — use |
None
|
Returns:
| Type | Description |
|---|---|
Split
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |