Sarek_registryInformation about a primitive/intrinsic type (float32, int64, etc.)
Information about a record field
Information about a record type (user-defined via @@sarek.type)
Information about a variant constructor
Information about a variant type
type fun_info = {fi_name : string;fi_arity : int;fi_device : string -> string;fi_arg_types : string list;fi_ret_type : string;}Information about an intrinsic function
val type_registry : (string, type_info) Stdlib.Hashtbl.tType registry - maps type names to their info (primitives)
val record_registry : (string, record_info) Stdlib.Hashtbl.tRecord registry - maps type names to their info (user-defined records)
val variant_registry : (string, variant_info) Stdlib.Hashtbl.tVariant registry - maps type names to their info (user-defined variants)
val fun_registry : (string list * string, fun_info) Stdlib.Hashtbl.tFunction registry - maps (module_path, name) to their info
Register a primitive type
val register_record : string -> fields:field_info list -> size:int -> unitRegister a record type (called by PPX-generated code for @@sarek.type)
val register_variant : string -> constructors:constructor_info list -> unitRegister a variant type (called by PPX-generated code for @@sarek.type)
val register_fun :
?module_path:string list ->
string ->
arity:int ->
device:(string -> string) ->
arg_types:string list ->
ret_type:string ->
unitRegister an intrinsic function
val find_type : string -> type_info optionFind a primitive type by name
val find_record : string -> record_info optionFind a record type by name
val find_variant : string -> variant_info optionFind a variant type by name
val find_fun : ?module_path:string list -> string -> fun_info optionFind a function by name, optionally in a module
Get device code for a function
Get device code template for a function, using a minimal device. This is for V2 IR codegens that don't have SPOC device objects.
val find_record_by_short_name : string -> record_info optionFind a record by short name (last component after '.'). This handles cases where the registry uses qualified names like "Module.typename" but the custom_type uses just "typename".
val record_fields : string -> field_info listGet record field info - tries exact match first, then short name
val variant_constructors : string -> constructor_info listGet variant constructors