new_target
Scaffold a benchmark target from your PyTorch function by generating baseline, editable candidate, and contract files, then bench the baseline and verify the candidate before edits.
Instructions
Scaffold a target from the user's own PyTorch function so the loop can run on it: writes
<out_dir>/_baseline.py (the function as the baseline plus the Target definition:
inputs, seed, fp32 reference, dtype-default tolerances, rotation, timer),
<out_dir>/_candidate.py (the file to edit; starts as the baseline) and the vendored
hotkernel_contract.py (protocol 3) they import, so they run in HOTKERNEL_PYTHON without
hotkernel installed there. from: 'torch.nn.functional:gelu' or './mykernels.py:fused';
shape: the primary input x, e.g. '4096x8192'; extra: more inputs in call order like
['w:8192', 'b:8192'] (random tensors of the same dtype); rotate: inputs that stream through
memory (default ['x']); flops: nominal flops per call for roofline(); reference: a different
'module:function' to run in fp32 as the reference when the baseline cannot run in fp32
(a backend-forced SDPA call, a bf16-only library kernel). For inputs randn cannot draw (a
quantized weight): derive: a 'module:function' from the dict of raw random tensors to the
dict of tensors the call takes, in call order; inputs: the names it returns, e.g.
['x', 'w_q', 'scales'] or 'x,w_q,scales', which become the candidate's signature; reference
is then required and gets the derived inputs as they are (it must do its own fp32 math);
min_bytes: the bytes one call must read (one weight layout), which sizes the rotation K.
Same as the CLI hotkernel new. Then bench() the baseline and verify() the blank candidate
(expect 'inconclusive') before changing anything.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| atol | No | ||
| rtol | No | ||
| seed | No | ||
| dtype | No | bf16 | |
| extra | No | ||
| flops | No | ||
| force | No | ||
| from_ | Yes | ||
| iters | No | ||
| shape | Yes | ||
| derive | No | ||
| inputs | No | ||
| rotate | No | ||
| target | Yes | ||
| out_dir | No | . | |
| min_bytes | No | ||
| reference | No |