hawk.kernel#
- hawk.kernel(fn=None, *, kind=None, steps=None, time=None, time_step=None, jump=None, group=1)[source]#
Trace
fninto aKernel. Refusals fire here.kindsupplies the kernel’shawk.ext.Kind(vocabulary, output set, seams); omitted, it getshawk.ext.DEFAULT_KIND.stepsis how many steps one launch advances a kernel that finishes its own sample (terminated = cond):@hawk.kernel(steps=16) def oscillator_step(...): ...
is
hawk.steps(<kernel>, 16), namedoscillator_step_x16with state kept in registers across the steps.steps="auto"makes ONE kernel whose launch reads the step count from the reservedfused_stepsword (at mosthawk.trace.steps.AUTO_K_MAX); an invalidstepsrefuses at decoration.Without
steps=, a kernelhawk.steps()admits for"auto"is built as the automatic kernel instead, paced byeagle.until_done().steps=1is the explicit opt-out: the plain kernel, always.time_stepnames the step-size parameter (a declared scalar input) andtimethe time plane (default"t"oncetime_stepis given). The plain kernel is unchanged;hawk.diff.tape()reads them to promote the step size to a per-sample plane and to write the time plane in index form. A time plane the body updates must update ast = t + dt(checked here, at decoration); one the body does not declare is minted by the twin.jumpmakeshawk.diff.vjp()/jvp()differentiate the kernel’s parameter-dependentif/whereswitches as the smoothed loss: a comparisonl < rpasses on the jump between its branches, spread over|l - r| < sqrt(5) * jump(Epanechnikov kernel of standard deviationjump).jump=is the width in the units of the compared values (about 2% of their span), or the name of aParam[Scalar]holding it;"auto"picks it per batch from the spread of the compared values. The primal kernel is unchanged.groupis the compaction unit: a lane count (group=32) or the label of aGridaxis (group="sample": that axis and every axis after it). A run that drops finished lanes keeps whole groups together. The default, 1, compacts lane by lane.- Return type:
Any- Parameters:
fn (Callable[[...], None] | None)
kind (Any)
steps (Any)
time (str | None)
time_step (str | None)
jump (Any)
group (int | str)