Sarek_typed_asttype tparam = {tparam_name : string;tparam_type : Sarek_types.typ;tparam_index : int;tparam_is_vec : bool;Is this a vector parameter?
*)tparam_id : int;Variable ID for this parameter
*)}Typed kernel parameter - defined before texpr so TELetRec can reference it
type texpr = {te : texpr_desc;ty : Sarek_types.typ;Always resolved, never contains unbound TVar
*)te_loc : Sarek_ast.loc;}Typed expression - every node has its type
and texpr_desc = | TEUnit| TEBool of bool| TEInt of int| TEInt32 of int32| TEInt64 of int64| TEFloat of float| TEDouble of float| TEVar of string * intname, variable id
*)| TEVecGet of texpr * texpr| TEVecSet of texpr * texpr * texpr| TEArrGet of texpr * texpr| TEArrSet of texpr * texpr * texpr| TEFieldGet of texpr * string * intexpr, field name, field index
*)| TEFieldSet of texpr * string * int * texpr| TEBinop of Sarek_ast.binop * texpr * texpr| TEUnop of Sarek_ast.unop * texpr| TEApp of texpr * texpr list| TEAssign of string * int * texprname, var_id, value
*)| TELet of string * int * texpr * texprname, var_id, value, body
*)| TELetRec of string * int * tparam list * texpr * texprname, fn_id, params, fn_body, continuation
*)| TELetMut of string * int * texpr * texpr| TEIf of texpr * texpr * texpr option| TEFor of string * int * texpr * texpr * Sarek_ast.for_dir * texprvar, id, lo, hi, dir, body
*)| TEWhile of texpr * texpr| TESeq of texpr listFlattened sequence
*)| TEMatch of texpr * (tpattern * texpr) list| TERecord of string * (string * texpr) listtype_name, fields
*)| TEConstr of string * string * texpr optiontype_name, constr_name, arg
*)| TETuple of texpr list| TEReturn of texpr| TECreateArray of texpr * Sarek_types.typ * Sarek_types.memspace| TEGlobalRef of string * Sarek_types.typExternal ref with its type
*)| TENative of {gpu : Ppxlib.expression;fun dev -> "cuda/opencl code"
*)ocaml : Ppxlib.expression;OCaml fallback for interpreter/native
*)}Native code with GPU and OCaml expressions
*)| TEPragma of string list * texprpragma options body
*)| TEIntrinsicConst of Sarek_env.intrinsic_refReference to intrinsic constant
*)| TEIntrinsicFun of Sarek_env.intrinsic_ref
* Sarek_core_primitives.convergence option
* texpr listReference to intrinsic function, convergence requirement, args
*)| TESuperstep of string * bool * texpr * texprname, divergent, body, continuation
*)| TEOpen of string list * texprlet open M.N in e
*)type ttype_decl = | TTypeRecord of {tdecl_name : string;tdecl_module : string option;tdecl_fields : (string * Sarek_types.typ * bool) list;name, type, mutable
*)tdecl_loc : Sarek_ast.loc;}| TTypeVariant of {tdecl_name : string;tdecl_module : string option;tdecl_constructors : (string * Sarek_types.typ option) list;tdecl_loc : Sarek_ast.loc;}Typed type declarations
type tmodule_item = | TMConst of string * int * Sarek_types.typ * texprlet name : ty = expr, var id
*)| TMFun of string * bool * tparam list * texprTMFun(name, is_recursive, params, body)
*)Typed module item
type tkernel = {tkern_name : string option;tkern_type_decls : ttype_decl list;tkern_module_items : tmodule_item list;Number of module items that are external (from @sarek.module). The first N items in tkern_module_items are external, the rest are inline (defined within the kernel payload). Native code gen should skip external items - they're already available via the OCaml module system.
tkern_external_item_count : int;tkern_params : tparam list;tkern_body : texpr;tkern_return_type : Sarek_types.typ;tkern_loc : Sarek_ast.loc;}Typed kernel definition
type tdecl_item = | TDType of ttype_decl| TDFun of string * tparam list * texpr| TDConst of string * int * Sarek_types.typ * texprval mk_texpr : texpr_desc -> Sarek_types.typ -> Sarek_ast.loc -> texprCreate a simple typed expression
val resolve_type : Sarek_types.typ -> Sarek_types.typGet the fully resolved type (follow all links)
val pp_texpr : Stdlib.Format.formatter -> texpr -> unitPretty printing
val pp_tpattern : Stdlib.Format.formatter -> tpattern -> unitval pp_tparam : Stdlib.Format.formatter -> tparam -> unitval pp_tkernel : Stdlib.Format.formatter -> tkernel -> unit