Module Spoc_core_js

All types, kind helpers, type-id helpers, creation, accessors, copy, slicing, list/array creation, and sync-callback API from the base functor. Refer to Spoc_core_base.Make for full documentation.

include sig ... end
type (!'a, !'b) scalar_kind =
  1. | Float32 : (float, Stdlib.Bigarray.float32_elt) scalar_kind
  2. | Float64 : (float, Stdlib.Bigarray.float64_elt) scalar_kind
  3. | Int32 : (int32, Stdlib.Bigarray.int32_elt) scalar_kind
  4. | Int64 : (int64, Stdlib.Bigarray.int64_elt) scalar_kind
  5. | Char : (char, Stdlib.Bigarray.int8_unsigned_elt) scalar_kind
  6. | Complex32 : (Stdlib.Complex.t, Stdlib.Bigarray.complex32_elt) scalar_kind
type location = Spoc_core_base.Make(Spoc_core_js__.Js_ops).location =
  1. | CPU
  2. | GPU of unit
  3. | Both of unit
  4. | Stale_CPU of unit
  5. | Stale_GPU of unit
type !'a custom_type = 'a Spoc_core_base.Make(Spoc_core_js__.Js_ops).custom_type = {
  1. elem_size : int;
  2. type_id : 'a Sarek_ir_types.Type_id.t;
  3. vector_type_id : ('a, unit) t Sarek_ir_types.Type_id.t;
  4. get : unit -> int -> 'a;
  5. set : unit -> int -> 'a -> unit;
  6. name : string;
}
and (!'c, !'d) kind = ('c, 'd) Spoc_core_base.Make(Spoc_core_js__.Js_ops).kind =
  1. | Scalar : ('a, 'b) scalar_kind -> ('a, 'b) kind
  2. | Custom : 'a0 custom_type -> ('a0, unit) kind
and (!'c, !'d) host_storage = ('c, 'd) Spoc_core_base.Make(Spoc_core_js__.Js_ops).host_storage =
  1. | Bigarray_storage : ('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t -> ('a, 'b) host_storage
  2. | Custom_storage : {
    1. ptr : unit;
    2. custom : 'a0 custom_type;
    3. length : int;
    } -> ('a0, unit) host_storage
and (!'a, !'b) t = ('a, 'b) Spoc_core_base.Make(Spoc_core_js__.Js_ops).t = {
  1. host : ('a, 'b) host_storage;
  2. device_buffers : (int, unit) Stdlib.Hashtbl.t;
  3. length : int;
  4. kind : ('a, 'b) kind;
  5. mutable location : location;
  6. mutable auto_sync : bool;
  7. id : int;
}
val to_bigarray_kind : ('a, 'b) scalar_kind -> ('a, 'b) Stdlib.Bigarray.kind
val bigarray_elem_size : ('a, 'b) Stdlib.Bigarray.kind -> int
val scalar_elem_size : ('a, 'b) scalar_kind -> int
val elem_size : ('a, 'b) kind -> int
val scalar_kind_name : ('a, 'b) scalar_kind -> string
val kind_name : ('a, 'b) kind -> string
val float32_type_id : float Sarek_ir_types.Type_id.t
val float64_type_id : float Sarek_ir_types.Type_id.t
val int32_type_id : int32 Sarek_ir_types.Type_id.t
val int64_type_id : int64 Sarek_ir_types.Type_id.t
val char_type_id : char Sarek_ir_types.Type_id.t
val complex32_type_id : Stdlib.Complex.t Sarek_ir_types.Type_id.t
val scalar_type_id : ('a, 'b) scalar_kind -> 'a Sarek_ir_types.Type_id.t
val type_id : ('a, 'b) kind -> 'a Sarek_ir_types.Type_id.t
val float32_vector_type_id : (float, Stdlib.Bigarray.float32_elt) t Sarek_ir_types.Type_id.t
val float64_vector_type_id : (float, Stdlib.Bigarray.float64_elt) t Sarek_ir_types.Type_id.t
val int32_vector_type_id : (int32, Stdlib.Bigarray.int32_elt) t Sarek_ir_types.Type_id.t
val int64_vector_type_id : (int64, Stdlib.Bigarray.int64_elt) t Sarek_ir_types.Type_id.t
val char_vector_type_id : (char, Stdlib.Bigarray.int8_unsigned_elt) t Sarek_ir_types.Type_id.t
val complex32_vector_type_id : (Stdlib.Complex.t, Stdlib.Bigarray.complex32_elt) t Sarek_ir_types.Type_id.t
val vector_type_id : ('a, 'b) kind -> ('a, 'b) t Sarek_ir_types.Type_id.t
val create_scalar : ('a, 'b) scalar_kind -> ?dev:unit -> int -> ('a, 'b) t
val create : ('a, 'b) kind -> ?dev:unit -> int -> ('a, 'b) t
val create_custom : 'a custom_type -> ?dev:unit -> int -> ('a, unit) t
val of_bigarray : ('a, 'b) scalar_kind -> ('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t -> ('a, 'b) t
val of_raw_handle : 'a custom_type -> nativeint -> int -> ('a, unit) t
val to_bigarray : ('a, 'b) t -> ('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t
val has_buffer : ('a, 'b) t -> unit -> bool
val get_buffer : ('a, 'b) t -> unit -> unit option
type sub_meta = Spoc_core_base.Make(Spoc_core_js__.Js_ops).sub_meta = {
  1. parent_id : int;
  2. start : int;
  3. ok_range : int;
  4. ko_range : int;
  5. depth : int;
}
val is_sub : ('a, 'b) t -> bool
val get_sub_meta : ('a, 'b) t -> sub_meta option
val depth : ('a, 'b) t -> int
val parent_id : ('a, 'b) t -> int option
val sub_start : ('a, 'b) t -> int option
val sub_ok_range : ('a, 'b) t -> int option
val sub_ko_range : ('a, 'b) t -> int option
val copy_host_only : ('a, 'b) t -> ('a, 'b) t
val sub_vector_host : ('a, 'b) t -> start:int -> len:int -> ('a, 'b) t
val sub_vector : ('a, 'b) t -> start:int -> len:int -> ok_range:int -> ko_range:int -> ('a, 'b) t
val partition_host : ('a, 'b) t -> unit array -> ('a, 'b) t array
val of_list : ('a, 'b) kind -> 'a list -> ('a, 'b) t
val of_array : ('a, 'b) kind -> 'a array -> ('a, 'b) t
type sync_callback = Spoc_core_base.Make(Spoc_core_js__.Js_ops).sync_callback = {
  1. sync : 'a 'b. ('a, 'b) t -> bool;
}
val register_sync_callback : sync_callback -> unit
val ensure_cpu_sync : ('a, 'b) t -> unit
val host_handle : ('a, 'b) t -> unit
val host_raw : ('a, 'b) t -> nativeint
val float32 : (float, Stdlib.Bigarray.float32_elt) kind
val float64 : (float, Stdlib.Bigarray.float64_elt) kind
val int32 : (int32, Stdlib.Bigarray.int32_elt) kind
val int64 : (int64, Stdlib.Bigarray.int64_elt) kind
val char : (char, Stdlib.Bigarray.int8_unsigned_elt) kind
val complex32 : (Stdlib.Complex.t, Stdlib.Bigarray.complex32_elt) kind
val get : ('a, 'b) t -> int -> 'a

get vec i returns the i-th element of a scalar vector. Raises Invalid_argument if vec uses custom storage (not reachable on the pure Bigarray path).

val set : ('a, 'b) t -> int -> 'a -> unit

set vec i v sets the i-th element of a scalar vector. Raises Invalid_argument if vec uses custom storage.

val to_array : ('a, 'b) t -> 'a array

to_array vec converts a scalar vector to an OCaml array. Raises Invalid_argument if vec uses custom storage.