Make Op
Thin entry point. The workflow + rules live in .agents/guidance/MAKE_OP_GUIDELINES.md and the
narrative how-to in docs/sphinx/advanced/make_operator.rst; the definition-of-done is gated by the
deterministic checker tools/make_op.py. Keep this skill thin; do not duplicate the guidelines.
Workflow
- Spec & approval (Part 0) — propose the operator's semantics + a cited reference oracle
(e.g. mimic TorchVision/OpenCV, or an explicit formula) + API + the support matrix
(dtype × channel × layout × container); get user approval (or an explicit oracle waiver for
a novel custom op), then record the contract in
Op<Name>.h(@brief+Reference:+ Limitations matrix). - Scaffold —
tools/mkop/mkop.sh <Name>→ the wired skeleton; gate withpython3 tools/make_op.py <Name> --phase scaffold(SCF-green). - Implement — kernel + an independent CPU gold reference + tests/bench per the
COV-*rules: bit-exact for every declared variant, required equivalent-layout parity, complement negatives, and every declared dtype benched. Image operators support interleaved and planar layouts by default; record an operator-local reason when image layouts do not apply. The scaffold emits the always-on NVTX markers (C-API submit / privoperator()/ PythonNvtxTrace); keep them and add the op to theOPERATORSregistry intests/cvcuda/python/test_nvtx_markers.py(NVTX-1). - Done gate —
python3 tools/make_op.py <Name> --phase done --run: composes/review-op(all domains) +/optimize-oppreflight and adds COV/EXEC/DOC-REL. Must be green; loop on the verdict — for eachGAPapply its named fix and re-run. Inviolable: never fabricate baselines (missing →GAP [requires CI]→ CI regen); bit-exact is the default (anEXPECT_NEARon an interleaved path is a GAP); layout-support gaps are author work. - Calibrate + seed baselines — calibrate each bench config to 1–2 ms nvbench GPU time
(per-dtype; measure with
bench_<op>and adjust the batch), exercise withbench/run_bench.py --operator <op> --lang both(noise < 5% + C++/Python parity), then trigger the named CIbaseline-regenworkflow to seed baselines on the reference SKUs and import its artifacts withbench/_internal/update_baseline.py --from <artifact-dir> --operator <op>. This closesBEN-7/RDY-1(never fabricate baselines; absolute timings are SKU-specific, so baselines come from CI). Followbench/README.mdfor the workflow andci/README.mdfor CI selection. - Hand off to
/optimize-op <Name>for the performance campaign.
For a wired skeleton with the implementation delegated to a human/other AI, use make-op-scaffold
(optionally --bare); make-op-verify is the done-gate. Findings-first.