ContContractRV.make_thunk#
- ContContractRV.make_thunk(node, storage_map, compute_map, no_recycling, impl=None)#
Create a thunk.
This function must return a thunk, that is a zero-arguments function that encapsulates the computation to be performed by this op on the arguments of the node.
- Parameters:
- node
Something previously returned by
Op.make_node().- storage_map
A
dictmappingVariables to single-element lists where a computed value for eachVariablemay be found.- compute_map
A
dictmappingVariables to single-element lists where a boolean value can be found. The boolean indicates whether theVariable’sstorage_mapcontainer contains a valid value (i.e.True) or whether it has not been computed yet (i.e.False).- no_recycling
List of
Variables for which it is forbidden to reuse memory allocated by a previous call.- impl
str Description for the type of node created (e.g.
"c","py", etc.)
Notes
If the thunk consults the
storage_mapon every call, it is safe for it to ignore theno_recyclingargument, because elements of theno_recyclinglist will have a value ofNonein thestorage_map. If the thunk can potentially cache return values (likeCLinkerdoes), then it must not do so for variables in theno_recyclinglist.Op.prepare_node()is always called. If it tries'c'and it fails, then it tries'py', andOp.prepare_node()will be called twice.