package arrayjit
Module Backends.Simple_no_device_backendSource
Parameters
module Backend : Simple_backendSignature
val sexp_of_buffer_ptr : buffer_ptr -> Sexplib0.Sexp.tval sexp_of_context : context -> Sexplib0.Sexp.tval name : Base.stringInitializes a backend before first use or (on some backends) after unsafe_cleanup. Does nothing if the backend is already initialized.
Returns false if there was no previous initialize call, or, on some backends, the most recent call was followed by unsafe_cleanup. If it returns false, one must call initialize before using the backend.
val init : label:Base.string -> contextlabel is usually the backend name concatenated with the device number.
val alloc_buffer :
?old_buffer:(buffer_ptr * Base.int) ->
size_in_bytes:Base.int ->
Base.unit ->
buffer_ptrval compile :
?shared:Base.bool ->
?name:Base.string ->
Indexing.unit_bindings ->
Assignments.t ->
codeIf ~shared:true (default false), the backend should prefer to do more compile work in a device-agnostic way. If ~shared:false, the backend can opt to postpone compiling altogether until link is called, to benefit from more optimizations.
val compile_batch :
?shared:Base.bool ->
?names:Base.string Base.array ->
?occupancy:(name:Base.string -> src_n:Base.int -> Base.bool) ->
Indexing.unit_bindings ->
Assignments.t Base.array ->
code_batchUnlike the ~shared parameter, compile_batch vs. compile is mostly about improving the compile time and debugging convenience by generating fewer files -- ideally does not affect execution, but there can be backend-specific differences. Only array entries for which occupancy returns true are included.
val link :
?from_prior_context:Tnode.t Base.list ->
merge_buffer:(buffer_ptr * Tnode.t) Base.option Base.ref ->
context ->
code ->
routineReturns the routine for the code's procedure, in a new context derived from the given context.
The from_prior_context nodes must not be added to the resulting context -- if needed in context, they must be part of the given context.
val link_batch :
?from_prior_context:Tnode.t Base.list ->
merge_buffer:(buffer_ptr * Tnode.t) Base.option Base.ref ->
context ->
code_batch ->
context * routine Base.option Base.arrayReturns the routines for the procedures included in the code batch. The returned context is downstream of all the returned routines (in particular, the routines' contexts are not independent).
The from_prior_context nodes must not be added to the resulting context -- if needed in context, they must be part of the given context.
Cleans up all work on a backend, releases resources. All previously retrieved values (contexts, virtual and physical devices) become invalid. The backend needs to be initialized again to be used again.