Sarek_native.Native_plugin_baseval native_kernels :
(string,
Spoc_framework.Framework_sig.exec_arg array ->
(int * int * int) ->
(int * int * int) ->
unit)
Stdlib.Hashtbl.tRegistry for native kernel functions.
Kernels are registered by name. The function signature uses exec_arg array for type-safe argument passing:
Defined at module level so it can be accessed by both the Native module and the external registration functions.
module Native : sig ... endval register_kernel :
string ->
(Spoc_framework.Framework_sig.exec_arg array ->
(int * int * int) ->
(int * int * int) ->
unit) ->
unitRegister a native kernel function by name.
This is called by PPX-generated code at module load time to register the pre-compiled OCaml kernel function. The function signature matches what Sarek_cpu_runtime expects:
Example:
let () =
Sarek_native.Native_plugin.register_kernel
"my_kernel"
(fun args grid block ->
Sarek_cpu_runtime.run_threadpool
~has_barriers:false
~block
~grid
my_kernel_fn
args)val run_kernel_raw :
name:string ->
args:Spoc_framework.Framework_sig.exec_arg array ->
grid:(int * int * int) ->
block:(int * int * int) ->
unitRun a kernel directly with typed arguments. This bypasses the Runtime API.