Module Sarek_native.Native_vec_access

Element accessors of a vector argument as seen by PPX-generated native kernels: every v.(i) in a kernel calls one of the get_*/set_* closures of the Sarek_ir_types.NV record built here.

val mismatch : string -> string -> 'a
val primitive : string -> Spoc_framework.Typed_value.typed_value -> Spoc_framework__Typed_value.primitive

The scalar inside a typed_value, or a structured error naming name.

val float_of_primitive : string -> Spoc_framework.Typed_value.primitive -> float
val int32_of_primitive : string -> Spoc_framework.Typed_value.primitive -> int32
val int64_of_primitive : string -> Spoc_framework.Typed_value.primitive -> int64
val generic_vec_of_exec_vector : (module Spoc_framework.Typed_value.EXEC_VECTOR) -> Sarek_ir_types.native_arg

Accessors through the vector's EXEC_VECTOR interface: every read goes through a typed_value, so a kernel may read any scalar vector as any scalar type (e.g. an int32 vector with get_f32).

module Vector = Spoc_core.Vector
val get_float32 : (float, Stdlib.Bigarray.float32_elt) Vector.t -> int -> float
val get_int32 : (int32, Stdlib.Bigarray.int32_elt) Vector.t -> int -> int32
val set_float32 : (float, Stdlib.Bigarray.float32_elt) Vector.t -> int -> float -> unit
val set_int32 : (int32, Stdlib.Bigarray.int32_elt) Vector.t -> int -> int32 -> unit
val sync_once : ('a, 'b) Vector.t -> unit
val native_vec_of_exec_vector : (module Spoc_framework.Typed_value.EXEC_VECTOR) -> Sarek_ir_types.native_arg

The accessors a native kernel calls for a vector argument. A float32 or int32 vector reads and writes its own element type directly (what the typed_value path ends in, Vector.get/Vector.set, without the boxing on the way); every other access, including a read at another type, goes through generic_vec_of_exec_vector.

Contract relied on: an EXEC_VECTOR whose underlying_type_id is Vector.float32_vector_type_id or Vector.int32_vector_type_id has get/set equal to Vector.get/Vector.set on underlying (as Execute.exec_arg_of_vector builds it); the fast accessors read underlying directly.