Sarek_ppx_lib.Sarek_native_intrinsicsval core_type_of_typ :
loc:Ppxlib.location ->
Sarek_types.typ ->
Ppxlib.core_typeGenerate a core type from a Sarek type (for type annotations).
For scalar types (int32, float, etc), we generate explicit types to help OCaml infer the correct numeric type.
For record types, we generate the type name to help OCaml resolve field accesses. The type name may be qualified (e.g., "Module.point").
For vectors and other complex types, we use wildcards.
Map Sarek intrinsics to their OCaml equivalents. For cpu_kern, we call the OCaml implementations directly rather than generating GPU code.
Map stdlib module paths to their runtime module paths. Sarek stdlib modules are available at both "Foo" and "Sarek_stdlib.Foo" paths at compile time. At runtime, the corresponding CPU implementations are in Sarek_cpu_runtime.
val gen_intrinsic_const :
loc:Ppxlib__.Location.t ->
gen_mode:gen_mode ->
Sarek_env.intrinsic_ref ->
Ppxlib_ast.Ast.expressionGenerate intrinsic constant based on generation mode. For simple modes, direct global indices are used. For full mode, we access thread_state.
val gen_intrinsic_fun :
loc:Ppxlib__.Location.t ->
gen_mode:gen_mode ->
Sarek_env.intrinsic_ref ->
Ppxlib__.Import.expression list ->
Ppxlib__.Import.expressionGenerate intrinsic function call based on generation mode. For simple modes, we use thread_state for most operations. stdlib functions are called directly from their runtime implementations.