Sarek_interp.Sarek_ir_interptype value = Sarek_ir_interp_value.value = Re-export value type and constructors for external callers
val to_int : Sarek_ir_interp_value.value -> intval to_int32 : Sarek_ir_interp_value.value -> int32val to_int64 : Sarek_ir_interp_value.value -> int64val to_float32 : Sarek_ir_interp_value.value -> floatval to_float64 : Sarek_ir_interp_value.value -> floatval to_bool : Sarek_ir_interp_value.value -> booltype thread_state = Sarek_ir_interp_value.thread_state = {thread_idx : int * int * int;block_idx : int * int * int;block_dim : int * int * int;grid_dim : int * int * int;}Re-export thread_state type for external callers
type env = Sarek_ir_interp_value.env = {vars : (int, value) Stdlib.Hashtbl.t;vars_by_name : (string, value) Stdlib.Hashtbl.t;arrays : (string, value array) Stdlib.Hashtbl.t;funcs : (string, Sarek_ir_types.helper_func) Stdlib.Hashtbl.t;coopmats : (string, value array) Stdlib.Hashtbl.t;}Re-export env type for external callers
val create_env : unit -> Sarek_ir_interp_value.envval copy_env : Sarek_ir_interp_value.env -> Sarek_ir_interp_value.envval bind_var :
Sarek_ir_interp_value.env ->
Sarek_ir_types.var ->
Sarek_ir_interp_value.value ->
unitval lookup_var :
Sarek_ir_interp_value.env ->
Sarek_ir_types.var ->
Sarek_ir_interp_value.valueval eval_binop :
Sarek_ir_types.binop ->
Sarek_ir_interp_value.value ->
Sarek_ir_interp_value.value ->
Sarek_ir_interp_value.valueval eval_unop :
Sarek_ir_types.unop ->
Sarek_ir_interp_value.value ->
Sarek_ir_interp_value.valueval eval_expr :
Sarek_ir_interp_value.thread_state ->
Sarek_ir_interp_value.env ->
Sarek_ir_types.expr ->
Sarek_ir_interp_value.valueval exec_stmt :
Sarek_ir_interp_value.thread_state ->
Sarek_ir_interp_value.env ->
Sarek_ir_types.stmt ->
unitmodule DomainPool : sig ... endResolve how many domains the interpreter's DomainPool should use.
Reads SAREK_DOMAIN_COUNT first (any positive integer) so tests can force a domain count higher than the host's physical core count - this is the only reliable way to reproduce oversubscription races such as the DomainPool record-aliasing bug on a small developer machine. Falls back to Domain.recommended_domain_count (), and finally to a fixed default if that raises.
val global_pool : DomainPool.t option Stdlib.refGlobal pool - lazily initialized
val get_pool : unit -> DomainPool.tval run_grid_parallel :
Sarek_ir_interp_value.env ->
Sarek_ir_types.stmt ->
(int * int * int) ->
(int * int * int) ->
unitRun all blocks in a grid (parallel - distributes blocks across domain pool)
val run_grid :
Sarek_ir_interp_value.env ->
Sarek_ir_types.stmt ->
(int * int * int) ->
(int * int * int) ->
unitRun all blocks in a grid (uses parallel or sequential based on flag)
val run_kernel :
Sarek_ir_types.kernel ->
block:(int * int * int) ->
grid:(int * int * int) ->
(string * arg) list ->
unitRun a kernel on CPU
These functions work with typed Kernel_arg.t values. This is the preferred interface for Native/Interpreter backends.
val vector_to_array : 'a 'b. ('a, 'b) Spoc_core.Vector.t -> value arrayConvert V2 Vector to interpreter value array. Uses the vector's element type to create properly typed values.
val array_to_vector : 'a 'b. value array -> ('a, 'b) Spoc_core.Vector.t -> unitWrite interpreter value array back to V2 Vector
Existential wrapper to track V2 Vector + its interpreter array for writeback
type exec_writeback = | Exec_writeback : (module Spoc_framework.Typed_value.EXEC_VECTOR)
* value array -> exec_writebackval value_of_bytes : bytes -> Sarek_tuple_vec.field_layout -> valueval bytes_of_shape : Sarek_tuple_vec.shape -> value array -> bytesval value_of_typed_value : Spoc_framework.Typed_value.typed_value -> valueval typed_value_of_value :
(module Spoc_framework.Typed_value.EXEC_VECTOR with type elt = 'a) ->
value ->
Spoc_framework.Typed_value.typed_value optionval exec_vector_to_array :
(module Spoc_framework.Typed_value.EXEC_VECTOR) ->
value arrayval array_to_exec_vector :
(module Spoc_framework.Typed_value.EXEC_VECTOR) ->
value array ->
unitval args_from_exec_args :
Sarek_ir_types.kernel ->
Spoc_framework.Framework_sig.exec_arg list ->
(string * arg) list * exec_writeback listval run_kernel_with_exec_args :
Sarek_ir_types.kernel ->
block:(int * int * int) ->
grid:(int * int * int) ->
Spoc_framework.Framework_sig.exec_arg list ->
unitval args_from_kernel_args :
Sarek_ir_types.kernel ->
Spoc_core.Kernel_arg.t list ->
(string * arg) list * writeback listConvert Kernel_arg.t list to interpreter args, tracking vectors for writeback
val run_kernel_with_args :
Sarek_ir_types.kernel ->
block:(int * int * int) ->
grid:(int * int * int) ->
Spoc_core.Kernel_arg.t list ->
unitRun kernel with V2 Vector arguments (Kernel_arg.t list). This is the preferred entry point for Native/Interpreter backends. Handles conversion to/from interpreter format with proper writeback.