Sarek_pure_registryPure function registry: no Device.t, no ctypes.
val register_fun :
?module_path:string list ->
string ->
device:(framework:string -> string) ->
unitRegister 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.
Look up device-code name for a path-qualified function. Returns None if not found.
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 float32_math_template :
name:string ->
cuda_name:string ->
generic_name:string ->
framework:string ->
stringBuild 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).
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.
named_math_template for the entries whose source name IS the device symbol.
(name, cuda_name, generic_name) — the 32-entry float32 math list, shared verbatim across all four float32-exposing paths.
(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.
The 16-entry Math.Float64 list — intentionally a strict subset of float64_list; see the module-level comment above.