Native_plugin.BackendNative Backend - implements BACKEND
module Device : sig ... endDevice management
module Stream : sig ... endAsync execution streams / command queues
module Memory : sig ... endGPU memory allocation and transfer
module Event : sig ... endTiming events
module Kernel : sig ... endKernel compilation and execution
module Async :
Spoc_framework.Framework_sig.ASYNC
with type device := Device.t
and type stream := Stream.t
and type event := Event.t
and type 'a buffer := 'a Memory.bufferRanged / stream-ordered transfers, pinned host memory and inter-stream ordering (see ASYNC). Backends that do not provide them use Async_refused.
val execution_model : Spoc_framework.Framework_sig.execution_modelThe execution model this backend uses
val generate_source :
?block:Spoc_framework.Framework_sig.dims ->
?soa_params:string list ->
Sarek_ir_types.kernel ->
string optionGenerate source code from Sarek IR (for JIT backends). Returns None for Direct/Custom backends.
val execute_direct :
native_fn:
(block:Spoc_framework.Framework_sig.dims ->
grid:Spoc_framework.Framework_sig.dims ->
Spoc_framework.Framework_sig.exec_arg array ->
unit)
option ->
ir:Sarek_ir_types.kernel option ->
block:Spoc_framework.Framework_sig.dims ->
grid:Spoc_framework.Framework_sig.dims ->
Spoc_framework.Framework_sig.exec_arg array ->
unitExecute a kernel directly (for Direct/Custom backends). JIT backends should raise an error if this is called. The backend chooses which component to use:
Backend-specific intrinsic registry
val supported_source_langs : Spoc_framework.Framework_sig.source_lang listList of source languages this backend supports
val run_source :
source:string ->
lang:Spoc_framework.Framework_sig.source_lang ->
kernel_name:string ->
block:Spoc_framework.Framework_sig.dims ->
grid:Spoc_framework.Framework_sig.dims ->
shared_mem:int ->
Spoc_framework.Framework_sig.run_source_arg list ->
unitExecute an external kernel from source code.
Type-safe wrapping/unwrapping of backend-specific kernel args into the extensible kargs type. Each backend extends kargs with its own variant.
val wrap_kargs : Kernel.args -> Spoc_framework.Framework_sig.kargsWrap this backend's kernel args into a kargs variant
val unwrap_kargs : Spoc_framework.Framework_sig.kargs -> Kernel.args optionUnwrap kargs to this backend's kernel args. Returns None if wrong backend.
val wrap_stream : Stream.t -> Spoc_framework.Framework_sig.stream_refval unwrap_stream : Spoc_framework.Framework_sig.stream_ref -> Stream.t optionval wrap_event : Event.t -> Spoc_framework.Framework_sig.event_refval unwrap_event : Spoc_framework.Framework_sig.event_ref -> Event.t optionval run_source_on_stream :
stream:Stream.t ->
source:string ->
lang:Spoc_framework.Framework_sig.source_lang ->
kernel_name:string ->
block:Spoc_framework.Framework_sig.dims ->
grid:Spoc_framework.Framework_sig.dims ->
shared_mem:int ->
Spoc_framework.Framework_sig.run_source_arg list ->
unitrun_source enqueued on stream instead of the default stream. The call may return before the kernel has run. Backends whose async_support.stream_launch is false refuse with Feature_not_supported; Direct/Custom backends (Native, Interpreter) are never called through this entry point — their launches are synchronous.