hawk.ext#
The extension protocol: the seams a kind DECLARES.
Each seam is a declaration consumed by the walk and the emitter, never a post-hoc edit of generated text. This module lands two seams:
Sink policy — how an accumulate sink commits. Built:
plain,atomicandcompensated(Neumaier, correction committed to a companion plane the declaration names). A scattered accumulate commits through the target’s atomic add underplain/atomicalike (hawk_abi::accum_add) — a scattered read-modify-write has no correct use under any parallel launch;atomicjust names that commit explicitly. An own-column write is a store underplain/atomic, but an accumulate into the plane’s prior value undercompensated(seecompensated()for the host-side zeroing contract).bandedis a named, unbuilt slot that refuses with its own message.Guard policy — which mask gates the sample, and whether one is present at all. A set mask skips the sample’s whole body. The default gates on a bound
terminatedslot;Guard(mask=None)is the data-only seam, for a kind that must run every sample.Guard(active_set=True)additionally reads an active-set index map (eagle’sActiveSet): the index prologue maps launch positiontto sampleactive_map[t]and stops atactive_count, so live samples share warps; the body is unchanged.
The custom-primitive seam (hawk.ext.primitive) adds a forward the
author writes as an ordinary Python function of traced values, inlined at
every call, plus the VJP/JVP rules that replace the table’s rule for that
subgraph.
A Kind carries all of these plus its compile hook. A vocabulary is
extended by INHERITANCE: a KernelKind subclass, or Kind.extend()
for the instance form, carries a base’s vocabulary and seam fields forward,
merging rather than shadowing — see KernelKind for the rules.
Module Attributes
The default. |
|
The scattered commit |
|
gate on a bound |
|
plain commits, the default mask guard, no compile hook, no vocabulary. |
Functions
|
Resolve an value by name. |
|
A Neumaier-compensated accumulate whose correction lands in |
|
Register a custom primitive named |
A copy of the primitive registry, by name (introspection only). |
Classes
Which masks gate the sample. |
|
A kind's class-level vocabulary, its output set, its declared seams and its compile hook. |
|
Which sink parameter(s) a kind's kernel treats as its output set — the set a |
|
One registered primitive: its forward and the rules that replace the table. |
|
The class-form spelling of |