Builds an AnvlPrimitive metadata object, wraps fn with jit(),
attaches the metadata via attr(., "primitive"), prepends class
"JitPrimitive", and (by default) registers the result under name in
the primitive registry.
The backend is always "auto" and cannot be configured.
Arguments
- name
(
character(1))
Primitive name.- fn
(
function)
Body of the primitive. Its formals become the formals of the returned JIT-compiled callable. Insidefn, the primitive is accessible via the lexically-bound symbolself(anAnvlPrimitive); pass it as the first argument tograph_desc_add().- subgraphs
(
character())
Names of parameters that are subgraphs (for higher-order primitives).- static
(
character()|integer())
Passed tojit().- device
(
NULL|character(1)|device_arg())
Passed tojit(). Useful for primitives with no array inputs (e.g.prim_fill) where the device must come from an explicit argument.- register
(
logical(1))
IfTRUE(default), register the result undernamein the primitive registry.