Module Sarek_pure_registry

val fun_registry : (string list * string, framework:string -> string) Stdlib.Hashtbl.t

Pure function registry: no Device.t, no ctypes.

val register_fun : ?module_path:string list -> string -> device:(framework:string -> string) -> unit

Register a pure intrinsic function. module_path is the qualified path, e.g. ["Float32"] for Float32.sin. name is the unqualified function name. device is a closure ~framework:string -> string returning the device-code name to emit for a given backend framework string.

val fun_device_template : ?module_path:string list -> string -> (framework:string -> string) option

Look up device-code name for a path-qualified function. Returns None if not found.

val glsl_override_name : string -> string option

GLSL has no fabs/rsqrt/atan2 builtins: it spells them abs, inversesqrt, and the two-argument atan overload respectively. Every other backend (CUDA, OpenCL, Metal, WGSL) uses the OpenCL-style generic name directly, so this override only applies when framework = "GLSL".

val glsl_name : name:string -> generic_name:string -> string
val float32_math_template : name:string -> cuda_name:string -> generic_name:string -> framework:string -> string

Build a framework-dispatching closure for float32 math functions. CUDA uses the f-suffixed form (sinf, cosf, …); OpenCL and Metal use the un-suffixed form; GLSL uses the un-suffixed form except where its builtin is spelled differently (see glsl_override_name).

val named_math_template : name:string -> generic_name:string -> framework:string -> string

Same as float32_math_template but for functions with no CUDA f-suffix (Float64 math): one device symbol on every backend, modulo the GLSL rename.

name is the SAREK-SOURCE name (Float64.abs_float); generic_name is the DEVICE symbol to emit (fabs). They differ for exactly the entries where the OCaml stdlib spelling is not the C spelling, and keeping them separate is what stops Float64.abs_float from emitting a call to a nonexistent abs_float.

val generic_math_template : string -> framework:string -> string

named_math_template for the entries whose source name IS the device symbol.

val float32_list : (string * string * string) list

(name, cuda_name, generic_name) — the 32-entry float32 math list, shared verbatim across all four float32-exposing paths.

val float64_list : (string * string) list

(sarek_name, device_symbol) — the float64 math list, shared verbatim across both float64-exposing paths. Same symbol on every backend, modulo the GLSL override.

The pair, rather than a bare name list, is load-bearing: five of these entries (abs_float, and historically anything else whose OCaml stdlib spelling differs from its C spelling) would otherwise emit a call to a device function that does not exist. That is why adding a name to this table is safe only together with its symbol — see named_math_template.

val math_float64_list : string list

The 16-entry Math.Float64 list — intentionally a strict subset of float64_list; see the module-level comment above.

val register_float32_path : string list -> unit
val register_float64_path : string list -> unit
val register_math_float64_path : string list -> unit