How-to guides#

Standalone pages, one task each. Start wherever the task matches what you need.

Write kernels#

Every way to write and call a kernel, reusing one kernel family, and what to do when hawk cannot spell a construct.

Derivatives#

Check a gradient, compare it with torch, and mix analytic physics with a learned correction. The names and options are on the derivatives reference.

Linear algebra#

Solve, factor and decompose a small matrix in every lane.

Sparse lanes#

Run a list of lanes you built, and loops whose length is known at run time.

Random draws#

Counter-based uniform, normal, lognormal, exponential, Bernoulli, integer, Poisson and correlated draws, the same on every run.

Rays and meshes#

Test a ray against a sphere, a box or a triangle, and find the nearest hit in a mesh.

Wide values#

Vectors with hundreds of components, and wide input and output planes.

Embedded C#

Emit a kernel as standalone C for a target without a runtime.