hawk.chain#
- hawk.chain(*kernels, name)[source]#
Run
kernelsin sequence as ONE kernel namedname.A member’s input binds to the value an earlier member committed under the same name; any other input is the chain’s. A name no later member reads is an output, and a name several members update in turn keeps its last value. The values passed between members stay in the kernel: they are neither inputs nor outputs of the chain. A chain of chains is the chain of their members. The members must agree on their kind, launch grid, compaction group and jump width, and none may be stepped (chain the single step, then run
hawk.steps()over the chain).Best practices. Chain kernels that run one after another on the same lanes. Keep independent branches (a fork of species, say) as a graph, where they run side by side. The build decides how far a chain fuses: on the host it may cut a long chain into a few launches to keep each body in registers, on the GPU it fuses further. The values still agree with running the members one by one. The derivative of a chain is a chain:
hawk.diff.jvp(chain)runs the members’ tangents in order andhawk.diff.vjp(chain)the members, then their adjoints in reverse, and each is cut by the same rule.- Return type:
Chain- Parameters:
kernels (Kernel)
name (str)