Sarek_native.Native_vec_accessElement 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 primitive :
string ->
Spoc_framework.Typed_value.typed_value ->
Spoc_framework__Typed_value.primitiveThe scalar inside a typed_value, or a structured error naming name.
val float_of_primitive :
string ->
Spoc_framework.Typed_value.primitive ->
floatval int32_of_primitive :
string ->
Spoc_framework.Typed_value.primitive ->
int32val int64_of_primitive :
string ->
Spoc_framework.Typed_value.primitive ->
int64val scalar :
(module Spoc_framework.Typed_value.SCALAR_TYPE with type t = 'a) ->
'a ->
Spoc_framework.Typed_value.typed_valueval generic_vec_of_exec_vector :
(module Spoc_framework.Typed_value.EXEC_VECTOR) ->
Sarek_ir_types.native_argAccessors 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.Vectorval get_float32 : (float, Stdlib.Bigarray.float32_elt) Vector.t -> int -> floatval get_int32 : (int32, Stdlib.Bigarray.int32_elt) Vector.t -> int -> int32val set_float32 :
(float, Stdlib.Bigarray.float32_elt) Vector.t ->
int ->
float ->
unitval set_int32 :
(int32, Stdlib.Bigarray.int32_elt) Vector.t ->
int ->
int32 ->
unitval sync_once : ('a, 'b) Vector.t -> unitval native_vec_of_exec_vector :
(module Spoc_framework.Typed_value.EXEC_VECTOR) ->
Sarek_ir_types.native_argThe 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.