Utilstype settings = {mutable log_level : Base.int;mutable debug_log_from_routines : Base.bool;If the debug_log_from_routines flag is true _and_ the flag log_level > 1, backends should generate code (e.g. fprintf statements) to log the execution, and arrange for the logs to be emitted via ppx_minidebug.
mutable output_debug_files_in_build_directory : Base.bool;Writes compilation related files in the build_files subdirectory of the run directory (additional files, or files that would otherwise be in temp directory). When both output_debug_files_in_build_directory = true and log_level > 1, compilation should also preserve debug and line information for runtime debugging.
mutable fixed_state_for_init : Base.int Base.option;mutable print_decimals_precision : Base.int;When rendering arrays etc., outputs this many decimal digits.
*)mutable check_half_prec_constants_cutoff : Base.float Base.option;If given, generic code optimization should fail if a half precision FP16 constant exceeds the cutoff.
*)mutable default_prng_variant : Base.string;The default variant of threefry4x32 PRNG to use. Options: "crypto" (20 rounds) or "light" (2 rounds). Defaults to "light" for better performance.
*)mutable large_models : Base.bool;If true, use uint64 for indexing arithmetic. If false, use uint32 for indexing arithmetic. This affects all backends' kernel index parameters and local index variables, and gates the per-pool offset width (uint32 caps a pool at 4 GB; see the pool allocator). Decoupled in intent from element indexing within a single tensor, though both currently follow it.
*)}val settings_of_sexp : Sexplib0.Sexp.t -> settingsval sexp_of_settings : settings -> Sexplib0.Sexp.tval settings : settingsWhether to print where each configuration setting comes from (commandline, environment, config file, or the hard-coded default). It gates the logging of the config-reading functions themselves, so it is bootstrapped directly rather than via get_global_arg: the initial value only reflects the commandline and the environment, and the config file setting is applied once the config file is read. Can also be set programmatically, e.g. to trace configs a test reads.
val read_cmdline_var :
?qualified_only:bool ->
Base.String.t ->
(Base.String.t * Base.String.t) optionThe commandline sublevel of get_global_arg: returns the setting's value and the Sys.argv element it came from. Pure -- the sourcing log lives at the resolution seam, which is the only place that knows which sublevel actually won.
qualified_only drops the prefix-free spellings, leaving the ocannl_-qualified ones. OCANNL is a library: it scans the host executable's Sys.argv, so a prefix-free key claims an application's own option of that name. That is tolerable for keys nobody else would spell (--virtualize_max_visits) and not for --profile, which is a common application flag and which OCANNL treats as fatal when it does not name a known bundle -- a host passing --profile=prod would die during module initialization (Codex P2 on PR #291).
The environment sublevel of get_global_arg: returns the setting's value and the variable it came from. An empty value counts as unset.
The bootstrap reader: the few keys that are consulted before the config file exists (and hence before profiles are resolved) come from the commandline or the environment only.
val parse_config_lines :
source:Base.String.t ->
Base.String.t Base.List.t ->
(Base.String.t * Base.String.t) Base.List.tParses the ocannl_config syntax: one key=value per line, # and ~~ lines are comments, empty values mean "unset", the ocannl_ key prefix is optional and keys are case-insensitive. Shared by the config file and by the embedded profile payloads (which are literally partial config files); source names the origin in error messages.
The source levels a setting can come from, in decreasing priority. Each level splits into two sublevels: the keys stated explicitly at that level, then the payload of a profile picked at that level -- so a specific setting always beats an aggregate one of equal immediacy, and a profile named on the commandline still overrides an exhaustive config file.
val equal_config_level : config_level -> config_level -> boolval describe_config_level : config_level -> stringtype config_source = | From_cmdline of Base.stringthe matching Sys.argv element
| From_env of Base.stringthe matching environment variable
*)| From_config_file| From_profile of config_level * Base.stringthe level that picked the profile, and its name
*)| From_defaultWhere get_global_arg found a value; reported by the log_config_sourcing trace.
val config_source_label : config_source -> stringA short provenance tag, e.g. "profile 'reproducible' via the commandline".
val describe_config_source :
value:string ->
default:string ->
config_source ->
stringval resolve_config_value :
cmdline:('a -> ('b * Base.string) Base.Option.t) ->
env:('a -> ('b * Base.string) Base.Option.t) ->
file:('a -> 'b Base.Option.t) ->
profile:(config_level * Base.string * ('a -> 'b Base.Option.t)) option ->
default:'b ->
arg_name:'a ->
'b * config_sourceThe precedence walk, factored out of get_global_arg so it can be exercised on synthetic sources (see test/operations/config_profiles.ml). The lookups are pure; logging happens at the call site, which is the only place that knows which sublevel won.
The keys a profile payload may not set: they are read before profiles are resolved (or would make the resolution recursive).
The embedded profile payloads, by name. Each is literally a partial ocannl_config file: same syntax, same parser, setting only the keys where the profiles' goals disagree.
val active_profile :
(config_level * Base.String.t * (Base.String.t, Base.String.t) Base.Hashtbl.t)
Base.Option.tThe profile picked for this run, if any: its level (which decides the priority of its payload), its name, and the parsed payload.
val profile_lookup :
(config_level
* Base.String.t
* (Base.String.t Base.Hashtbl.key ->
Base.String.t option))
Base.Option.tval get_global_arg_with_source :
default:Base.String.t ->
arg_name:Base.string ->
Base.String.t * config_sourceRetrieves the arg_name setting from the commandline, the environment, the config file, or the payload of the profile picked at one of those levels; returns default if none has it, together with where the value came from.
The directory generated-code debug files are written to (created if missing): build_files/<prefix>/, where the prefix defaults to the executable's base name.
The directory diagnostic and routine-debug logs are written to (created if missing): log_files/<prefix>/, sharing the prefix resolution of build_files_dir.
Filters the list keeping the first occurrence of each element.
Returns the multiset difference of l1 and l2, where l1 and l2 must be sorted in increasing order.
Removes the first occurrence of an element from the list that is equal to the given element.
parallel_merge merge num_devices progressively invokes the pairwise merge callback, converging on the 0th position, with from ranging from 1 to num_devices - 1, and to_ < from.
module Lazy : sig ... endval compare_requirement : requirement -> requirement -> Base.intval requirement_of_sexp : Sexplib0.Sexp.t -> requirementval sexp_of_requirement : requirement -> Sexplib0.Sexp.tmodule Set_O : sig ... endA mutable linked list structure.
val equal_mutable_list :
'a. ('a -> 'a -> Base.bool) ->
'a mutable_list ->
'a mutable_list ->
Base.boolval mutable_list_of_sexp :
'a. (Sexplib0.Sexp.t -> 'a) ->
Sexplib0.Sexp.t ->
'a mutable_listval sexp_of_mutable_list :
'a. ('a -> Sexplib0.Sexp.t) ->
'a mutable_list ->
Sexplib0.Sexp.tval empty : 'a mutable_listval cons : hd:'a -> tl:'a mutable_list -> 'a mutable_listval is_empty : 'a mutable_list -> boolval is_cons : 'a mutable_list -> boolval empty_val : 'a mutable_list -> unit Stdlib.Option.tval cons_val :
'a mutable_list ->
([> `hd of 'a ] * [> `tl of 'a mutable_list ]) Stdlib.Option.tmodule Variants_of_mutable_list : sig ... endval insert : next:'a -> 'a mutable_list -> 'a mutable_listval tl_exn : 'a mutable_list -> 'a mutable_listval weak_create : unit -> 'a weak_dynarrayval register_new :
'a weak_dynarray ->
?grow_by:Base__Int.t ->
(int -> 'a) ->
'aval weak_iter : 'a weak_dynarray -> f:('a -> unit) -> unitval safe_lazy : Base.string -> (Base.unit -> 'a) -> 'a safe_lazyval safe_force : 'a safe_lazy -> 'aval is_safe_val : 'a safe_lazy -> boolval hash_fold_safe_lazy :
'a ->
Base__.Ppx_hash_lib.Std.Hash.state ->
'b safe_lazy ->
Base__.Ppx_hash_lib.Std.Hash.stateval sexp_of_safe_lazy : ('a -> Base.Sexp.t) -> 'a safe_lazy -> Base.Sexp.tmodule Tree_map : sig ... endA persistent map implemented as a balanced binary tree. The sexp_of function preserves and displays the tree structure.
val open_build_file :
base_name:Base.String.t ->
extension:Base.String.t ->
build_file_channelval captured_log_processors : captured_log_processor Base.list Base.ref