Add a primitive call to a graph descriptor. Inside a primitive body created
with new_primitive(), pass the lexically-bound self as the primitive
argument.
Usage
graph_desc_add(
primitive,
args,
params = list(),
infer_fn,
desc = NULL,
device = NULL
)Arguments
- primitive
(
AnvlPrimitive|JitPrimitive)
The primitive the call is for. AJitPrimitiveis accepted and unwrapped to its underlyingAnvlPrimitivemetadata.- args
(
listofGraphNode)
The arguments to the primitive.- params
(
list)
The parameters to the primitive.- infer_fn
(
function)
The inference function to use. Must output a list ofAbstractArrays.- desc
(
GraphDescriptor|NULL)
The graph descriptor to add the primitive call to. Uses the current descriptor ifNULL.- device
(
NULL|character(1)| device object)
The device the call places its result on, for a primitive that constructs an array out of nothing (e.g.prim_fill(),prim_iota()) and so has no operand to carry one. It is declared todesc, where it counts like the device of an array input to the same trace: it decides what that program is compiled for, and disagreeing with another device in it is an error. Every other primitive takes its device from its operands and leaves thisNULL.
Value
(list of GraphBox)