Add or optimize a tensor-level kernel in veomni/ops, register its variants, integrate it with models, and add numerical and registry tests. Trigger: 'add op', 'new kernel', 'add attention variant', 'new fused op', 'add triton kernel', 'optimize operator'.
97%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
.agents/knowledge/constraints.md, especially device guards and patchgen rules.veomni/ops/README.md and docs/design/op_selection.md.veomni/ops/kernels/ and its tests under tests/ops/.veomni.ops.OP_REGISTRY is the tensor-kernel source of truth. Each
row has the identity (op, variant, implementation, device). Callers
select the public (op, variant, implementation) triple; the registry
derives the device from the row's KernelRequirement and resolves the current
device before a device-agnostic row.
A row provides exactly one of these forms:
forward and backward functions, from which the registry generates a
torch.autograd.Function wrapper; orwrapper for eager PyTorch or a library API that already owns its
autograd behavior.For a raw pair, forward returns (output, SavedState) and backward returns
one gradient entry per positional tensor input. Pass tensors positionally and
non-tensor attributes by keyword.
Model classes construct an instance-local VeomniOp handle and call it
directly. Input normalization, HuggingFace-compatible signatures, and loss
policy belong in veomni/models/; do not add consumer-specific adapters
to the registry. The public CLI/YAML field remains
model.ops_implementation, while model builders receive it through the
ops_implementation keyword.
Use these separate mechanisms only when their semantics require them:
veomni/ops/batch_invariant/ for the opt-in ATen patch controlled by
set_batch_invariant_mode(...);veomni/ops/install.py for idempotent process-wide integrations such as
registration with a third-party framework;veomni/distributed/hccl_premul_sum.py for the NPU collective compatibility
patch used by distributed ExtraParallel code.models.OpsImplementationConfig. Preserve existing CLI/YAML field names.Create or extend a family under
veomni/ops/kernels/<kernel_name>/.
Keep implementations in variant/device-oriented modules consistent with the neighboring families.
Register every row through register_op:
from veomni.ops import register_op
from veomni.ops.platform import GpuKernelRequirement, NvidiaGpuPlatform
register_op("example", "standard", "eager", wrapper=eager_example)
register_op(
"example",
"standard",
"triton",
forward=triton_forward,
backward=triton_backward,
requirement=GpuKernelRequirement(platforms=(NvidiaGpuPlatform(min_cc=80),)),
)Import the family from veomni/ops/kernels/__init__.py so registration
happens when veomni.ops is imported.
In each consuming model, construct a VeomniOp from
resolve_op_impl(...) and store it on the model/module instance.
For a compound raw kernel, call the nested row's raw forward/backward
and use the saved-state helpers in veomni/ops/compound.py; do not call
the nested autograd wrapper.
Guard optional device packages and attach an explicit requirement. A registered implementation must fail clearly when its requirement is not satisfied; it must not silently fall back to eager.
Add English module, module-level class, and public function docstrings.
Nested closures and ordinary _private helpers are not gated; forward /
backward / wrapper / __call__ still are. Checked by
tests/ops/base/test_op_documentation.py.
Add tests under tests/ops/<kernel_name>/ for:
Put consumer-specific normalization and model wiring tests under
tests/models/ instead of duplicating them in the raw-kernel suite.
Run the family tests plus the registry and documentation guards:
The GPU job runs tests/ops/ wholesale. The NPU job enumerates ops files,
so add an NPU workflow entry when the new tests must run on Ascend.
pytest -q tests/ops/<kernel_name>/ tests/ops/base/Add a benchmark only when performance is part of the acceptance criteria; compare it with the canonical eager contract.
veomni/ops/README.md with the family, variants, and supported
implementations.docs/design/op_selection.md when selection behavior changes..agents/knowledge/architecture.md when the layout or call chain
changes./veomni-review.make quality and the relevant kernel/model integration tests.OP_REGISTRY.list_registered(...) and
list_available(...) report the expected rows.kernels/__init__.py.ops_implementation while changing the internal kernel plumbing.ByteDance-Seed/VeOmni
eba362d
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.