2025-11-15 14:36.03: New job: test ahrefs/ocannl https://github.com/ahrefs/ocannl.git#refs/heads/master (ed5eac4a5a24209119d22cf88f43fd8a0029c118) (linux-x86_64:(lint-fmt))Base: ocaml/opam:debian-13-ocaml-4.08@sha256:e3cc4e8fe5c00f48c72a719e3551b1d8a51c2862349a0f7507e8aa29fdf72321ocamlformat version: version 0.28.1 (from opam)To reproduce locally:git clone --recursive "https://github.com/ahrefs/ocannl.git" -b "master" && cd "ocannl" && git reset --hard ed5eac4acat > Dockerfile <<'END-OF-DOCKERFILE'FROM ocaml/opam:debian-13-ocaml-4.08@sha256:e3cc4e8fe5c00f48c72a719e3551b1d8a51c2862349a0f7507e8aa29fdf72321USER 1000:1000RUN cd ~/opam-repository && (git cat-file -e 6c1b38620288b5bf349067f089a7b1fc91185d94 || git fetch origin master) && git reset -q --hard 6c1b38620288b5bf349067f089a7b1fc91185d94 && git log --no-decorate -n1 --oneline && opam update -uRUN opam depext -i duneWORKDIR /srcRUN opam depext -i ocamlformat=0.28.1COPY --chown=1000:1000 . /src/RUN opam exec -- dune build @fmt --ignore-promoted-rules || (echo "dune build @fmt failed"; exit 2)END-OF-DOCKERFILEdocker build .END-REPRO-BLOCK2025-11-15 14:36.03: Using cache hint "ahrefs/ocannl-ocaml/opam:debian-13-ocaml-4.08@sha256:e3cc4e8fe5c00f48c72a719e3551b1d8a51c2862349a0f7507e8aa29fdf72321-debian-13-4.08_opam-2.4-ocamlformat-6c1b38620288b5bf349067f089a7b1fc91185d94"2025-11-15 14:36.03: Using OBuilder spec:((from ocaml/opam:debian-13-ocaml-4.08@sha256:e3cc4e8fe5c00f48c72a719e3551b1d8a51c2862349a0f7507e8aa29fdf72321)(user (uid 1000) (gid 1000))(run (cache (opam-archives (target /home/opam/.opam/download-cache)))(network host)(shell "cd ~/opam-repository && (git cat-file -e 6c1b38620288b5bf349067f089a7b1fc91185d94 || git fetch origin master) && git reset -q --hard 6c1b38620288b5bf349067f089a7b1fc91185d94 && git log --no-decorate -n1 --oneline && opam update -u"))(run (cache (opam-archives (target /home/opam/.opam/download-cache)))(network host)(shell "opam depext -i dune"))(workdir /src)(run (cache (opam-archives (target /home/opam/.opam/download-cache)))(network host)(shell "opam depext -i ocamlformat=0.28.1"))(copy (src .) (dst /src/))(run (shell "opam exec -- dune build @fmt --ignore-promoted-rules || (echo \"dune build @fmt failed\"; exit 2)")))2025-11-15 14:36.03: Waiting for resource in pool OCluster2025-11-15 14:36.03: Waiting for worker…2025-11-15 14:36.57: Got resource from pool OClusterBuilding on bremusa.ocamllabs.ioAll commits already cachedHEAD is now at ed5eac4a Fix the shape inference specification: we need to incorporate LUBs even for non-terminal shapes.(from ocaml/opam:debian-13-ocaml-4.08@sha256:e3cc4e8fe5c00f48c72a719e3551b1d8a51c2862349a0f7507e8aa29fdf72321)2025-11-15 14:36.58 ---> using "d458486dd7823c592e7ea9c88366c5f90e1939c3b51f3abbd6760272096f8a3e" from cache/: (user (uid 1000) (gid 1000))/: (run (cache (opam-archives (target /home/opam/.opam/download-cache)))(network host)(shell "cd ~/opam-repository && (git cat-file -e 6c1b38620288b5bf349067f089a7b1fc91185d94 || git fetch origin master) && git reset -q --hard 6c1b38620288b5bf349067f089a7b1fc91185d94 && git log --no-decorate -n1 --oneline && opam update -u"))6c1b386202 Merge pull request #28774 from Julow/release-ocamlformat-0.28.1<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>[default] Initialiseddefault (at git+file:///home/opam/opam-repository):[INFO] opam 2.1 and 2.2 include many performance and security improvements over 2.0; please consider upgrading (https://opam.ocaml.org/doc/Install.html)Everything as up-to-date as possible (run with --verbose to show unavailable upgrades).However, you may "opam upgrade" these packages explicitly, which will ask permission to downgrade or uninstall the conflicting packages.Nothing to do.# Run eval $(opam env) to update the current shell environment2025-11-15 14:39.18 ---> saved as "a7d3c7d9f6aff7dc059c465a33e7ef3fda4b4a1ee9c79bef8645b5cd4da72b96"/: (run (cache (opam-archives (target /home/opam/.opam/download-cache)))(network host)(shell "opam depext -i dune"))# Detecting depexts using vars: arch=x86_64, os=linux, os-distribution=debian, os-family=debian# No extra OS packages requirements found.# All required OS packages found.# Now letting opam install the packagesThe following actions will be performed:- install dune 3.20.2<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>[dune.3.20.2] found in cache<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>-> installed dune.3.20.2Done.# Run eval $(opam env) to update the current shell environment2025-11-15 14:40.51 ---> saved as "b8799a0f87a66bd49a9341889a0027044c03db80ad17a5edb3adaf72f166d8fd"/: (workdir /src)/src: (run (cache (opam-archives (target /home/opam/.opam/download-cache)))(network host)(shell "opam depext -i ocamlformat=0.28.1"))# Detecting depexts using vars: arch=x86_64, os=linux, os-distribution=debian, os-family=debian# No extra OS packages requirements found.# All required OS packages found.# Now letting opam install the packagesThe following actions will be performed:- install sexplib0 v0.14.0 [required by base]- install ocamlbuild 0.16.1 [required by fpath, astring, uuseg]- install either 1.0.0 [required by ocamlformat-lib]- install menhirLib 20250912 [required by ocamlformat-lib]- install csexp 1.5.2 [required by ocamlformat]- install camlp-streams 5.0.1 [required by ocamlformat-lib]- install seq base [required by re]- install menhirSdk 20250912 [required by ocamlformat-lib]- install fix 20250919 [required by ocamlformat-lib]- install menhirCST 20250912 [required by menhir]- install ocamlfind 1.9.8 [required by ocp-indent, astring, fpath, uuseg]- install dune-build-info 3.20.2 [required by ocamlformat-lib]- install cmdliner 2.0.0 [required by ocamlformat]- install ocaml-version 4.0.3 [required by ocamlformat-lib]- install dune-configurator 3.20.2 [required by base]- install re 1.11.0 [required by ocamlformat]- install menhir 20250912 [required by ocamlformat-lib]- install topkg 1.1.1 [required by fpath, astring, uuseg]- install ocp-indent 1.9.0 [required by ocamlformat-lib]- install base v0.14.3 [required by ocamlformat-lib]- install uutf 1.0.4 [required by ocamlformat-lib]- install astring 0.8.5 [required by ocamlformat-lib]- install stdio v0.14.0 [required by ocamlformat-lib]- install uucp 15.0.0 [required by uuseg]- install fpath 0.7.3 [required by ocamlformat-lib]- install uuseg 15.0.0 [required by ocamlformat-lib]- install ocamlformat-lib 0.28.1 [required by ocamlformat]- install ocamlformat 0.28.1===== 28 to install =====<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>[astring.0.8.5] found in cache[base.v0.14.3] found in cache[camlp-streams.5.0.1] found in cache[cmdliner.2.0.0] found in cache[csexp.1.5.2] found in cache[dune-build-info.3.20.2] found in cache[dune-configurator.3.20.2] found in cache[either.1.0.0] found in cache[fix.20250919] found in cache[fpath.0.7.3] found in cache[menhir.20250912] found in cache[menhirCST.20250912] found in cache[menhirLib.20250912] found in cache[menhirSdk.20250912] found in cache[ocaml-version.4.0.3] found in cache[ocamlbuild.0.16.1] found in cache[ocamlfind.1.9.8] found in cache[ocamlformat.0.28.1] found in cache[ocamlformat-lib.0.28.1] found in cache[ocp-indent.1.9.0] found in cache[re.1.11.0] found in cache[sexplib0.v0.14.0] found in cache[stdio.v0.14.0] found in cache[topkg.1.1.1] found in cache[uucp.15.0.0] found in cache[uuseg.15.0.0] found in cache[uutf.1.0.4] found in cache<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>-> installed seq.base-> installed camlp-streams.5.0.1-> installed csexp.1.5.2-> installed either.1.0.0-> installed fix.20250919-> installed menhirCST.20250912-> installed menhirLib.20250912-> installed menhirSdk.20250912-> installed ocaml-version.4.0.3-> installed sexplib0.v0.14.0-> installed re.1.11.0-> installed cmdliner.2.0.0-> installed dune-build-info.3.20.2-> installed ocamlfind.1.9.8-> installed dune-configurator.3.20.2-> installed ocp-indent.1.9.0-> installed ocamlbuild.0.16.1-> installed base.v0.14.3-> installed topkg.1.1.1-> installed stdio.v0.14.0-> installed uutf.1.0.4-> installed astring.0.8.5-> installed menhir.20250912-> installed fpath.0.7.3-> installed uucp.15.0.0-> installed uuseg.15.0.0-> installed ocamlformat-lib.0.28.1-> installed ocamlformat.0.28.1Done.<><> ocp-indent.1.9.0 installed successfully ><><><><><><><><><><><><><><><><><>=> This package requires additional configuration for use in editors. Install package 'user-setup', or manually:* for Emacs, add these lines to ~/.emacs:(add-to-list 'load-path "/home/opam/.opam/4.08/share/emacs/site-lisp")(require 'ocp-indent)* for Vim, add this line to ~/.vimrc:set rtp^="/home/opam/.opam/4.08/share/ocp-indent/vim"# Run eval $(opam env) to update the current shell environment2025-11-15 14:43.27 ---> saved as "7b71439e6ac9917292b28dc59ecc075d01d03dd2ef11c372809a6cf99e594a22"/src: (copy (src .) (dst /src/))2025-11-15 14:43.30 ---> saved as "ab01b5450ac0eb0343931041ab42b6840acff8c5568c1ebe2dbc0064c57c6b34"/src: (run (shell "opam exec -- dune build @fmt --ignore-promoted-rules || (echo \"dune build @fmt failed\"; exit 2)"))File "tensor/ppx_extend_dsls.ml", line 1, characters 0-0:diff --git a/_build/default/tensor/ppx_extend_dsls.ml b/_build/default/tensor/.formatted/ppx_extend_dsls.mlindex e30e785..352c5b7 100644--- a/_build/default/tensor/ppx_extend_dsls.ml+++ b/_build/default/tensor/.formatted/ppx_extend_dsls.ml@@ -50,19 +50,19 @@ let str_expander ~loc:pstr_loc ~path:_ str_items =let item_bindings, op_item_bindings =List.unzip@@ List.concat_map str_items ~f:(function- | { pstr_desc = Pstr_value (Nonrecursive, bindings); pstr_loc = loc; _ } ->- List.map bindings ~f:(fun binding ->- let params, binding = transform_dsl_binding ~loc ~dsl_name binding in- let op_binding = transform_op_binding params binding in- (binding, op_binding))- | { pstr_loc = loc; _ } ->- let pat = Ast_helper.Pat.var ~loc { txt = "syntax_error"; loc } in- let v =- Ast_builder.Default.pexp_extension ~loc- @@ Location.error_extensionf ~loc- "ppx_extend_dsls: currently only non-recursive value bindings are supported"- in- [ (Ast_helper.Vb.mk ~loc pat v, Ast_helper.Vb.mk ~loc pat v) ])+ | { pstr_desc = Pstr_value (Nonrecursive, bindings); pstr_loc = loc; _ } ->+ List.map bindings ~f:(fun binding ->+ let params, binding = transform_dsl_binding ~loc ~dsl_name binding in+ let op_binding = transform_op_binding params binding in+ (binding, op_binding))+ | { pstr_loc = loc; _ } ->+ let pat = Ast_helper.Pat.var ~loc { txt = "syntax_error"; loc } in+ let v =+ Ast_builder.Default.pexp_extension ~loc+ @@ Location.error_extensionf ~loc+ "ppx_extend_dsls: currently only non-recursive value bindings are supported"+ in+ [ (Ast_helper.Vb.mk ~loc pat v, Ast_helper.Vb.mk ~loc pat v) ])inlet item = { pstr_desc = Pstr_value (Nonrecursive, item_bindings); pstr_loc } inlet op_item = { pstr_desc = Pstr_value (Nonrecursive, op_item_bindings); pstr_loc } inFile "arrayjit/test/tree_map_test.ml", line 1, characters 0-0:diff --git a/_build/default/arrayjit/test/tree_map_test.ml b/_build/default/arrayjit/test/.formatted/tree_map_test.mlindex 5f9acfa..3939c56 100644--- a/_build/default/arrayjit/test/tree_map_test.ml+++ b/_build/default/arrayjit/test/.formatted/tree_map_test.ml@@ -5,7 +5,6 @@ open Utils(* Demo of Tree_map with tree-preserving sexp output *)let () =let open Tree_map in-(* Create a tree by inserting values *)let tree =empty@@ -23,8 +22,10 @@ let () =printf "%s\n\n" (Sexp.to_string_hum (sexp_of_t Int.sexp_of_t String.sexp_of_t tree));(* Test lookups *)- printf "Finding key 4: %s\n" (Option.value ~default:"not found" (find ~compare:Int.compare ~key:4 tree));- printf "Finding key 10: %s\n" (Option.value ~default:"not found" (find ~compare:Int.compare ~key:10 tree));+ printf "Finding key 4: %s\n"+ (Option.value ~default:"not found" (find ~compare:Int.compare ~key:4 tree));+ printf "Finding key 10: %s\n"+ (Option.value ~default:"not found" (find ~compare:Int.compare ~key:10 tree));(* Print as association list *)printf "\nAs alist (in-order): ";File "arrayjit/lib/context.ml", line 1, characters 0-0:diff --git a/_build/default/arrayjit/lib/context.ml b/_build/default/arrayjit/lib/.formatted/context.mlindex 9752637..d1edcba 100644--- a/_build/default/arrayjit/lib/context.ml+++ b/_build/default/arrayjit/lib/.formatted/context.ml@@ -24,7 +24,7 @@ type backend_wrapper =-> backend_wrappertype t = {- backend_wrapper : (backend_wrapper [@sexp.opaque]);+ backend_wrapper : (backend_wrapper[@sexp.opaque]);device_id : int;backend_name : string;initialized_nodes : Set.M(Tn).t; (* Track which nodes have been initialized *)File "tensor/ppx_op.ml", line 1, characters 0-0:diff --git a/_build/default/tensor/ppx_op.ml b/_build/default/tensor/.formatted/ppx_op.mlindex 2873eda..df32d9c 100644--- a/_build/default/tensor/ppx_op.ml+++ b/_build/default/tensor/.formatted/ppx_op.ml@@ -367,14 +367,14 @@ let rec translate ~no_grads_for_inline_defs ~num_configs ~is_toplevel ~opt_labellet vbs_args, processed_args =List.unzip@@ List.mapi args ~f:(fun i (arg_label, arg_expr) ->- match unit_position with- | Some unit_pos when i < unit_pos ->- (* Before unit: preserve as OCaml expression *)- (no_vbs, (arg_label, arg_expr))- | _ ->- (* After unit or no unit: transform *)- let vbs, e = loop arg_expr in- (vbs, (arg_label, e)))+ match unit_position with+ | Some unit_pos when i < unit_pos ->+ (* Before unit: preserve as OCaml expression *)+ (no_vbs, (arg_label, arg_expr))+ | _ ->+ (* After unit or no unit: transform *)+ let vbs, e = loop arg_expr in+ (vbs, (arg_label, e)))inlet all_vbs = reduce_vbss (vbs_fn :: vbs_args) in(all_vbs, Ast_builder.Default.pexp_apply ~loc e_fn processed_args)@@ -422,10 +422,10 @@ let rec translate ~no_grads_for_inline_defs ~num_configs ~is_toplevel ~opt_labellet labels =Option.to_list label@ List.filter_map args ~f:(function- | { pparam_desc = Pparam_val (_, _, pat); _ } ->- let loc = pat.ppat_loc in- Some [%expr [%e pat2expr pat].Tensor.value.Ir.Tnode.label]- | _ -> None)+ | { pparam_desc = Pparam_val (_, _, pat); _ } ->+ let loc = pat.ppat_loc in+ Some [%expr [%e pat2expr pat].Tensor.value.Ir.Tnode.label]+ | _ -> None)inlet label_locs = List.map labels ~f:(fun label -> label.pexp_loc) inlet label_starts = List.map label_locs ~f:(fun l -> l.loc_start) in@@ -453,8 +453,8 @@ let rec translate ~no_grads_for_inline_defs ~num_configs ~is_toplevel ~opt_labellet vbs, cases =List.unzip@@ List.map cases ~f:(fun ({ pc_rhs; _ } as c) ->- let vbs, pc_rhs = loop ~label pc_rhs in- (vbs, { c with pc_rhs }))+ let vbs, pc_rhs = loop ~label pc_rhs in+ (vbs, { c with pc_rhs }))in( List.fold vbs~init:(Map.empty (module String))@@ -472,8 +472,8 @@ let rec translate ~no_grads_for_inline_defs ~num_configs ~is_toplevel ~opt_labellet vbs, cases =List.unzip@@ List.map cases ~f:(fun ({ pc_rhs; _ } as c) ->- let vbs, pc_rhs = loop ?label pc_rhs in- (vbs, { c with pc_rhs }))+ let vbs, pc_rhs = loop ?label pc_rhs in+ (vbs, { c with pc_rhs }))in( List.fold vbs~init:(Map.empty (module String))@@ -531,18 +531,18 @@ let rec translate ~no_grads_for_inline_defs ~num_configs ~is_toplevel ~opt_labellet vbss, cases =List.unzip@@ List.map cases ~f:(fun ({ pc_rhs; _ } as c) ->- let vbs, pc_rhs = loop ?label pc_rhs in- (vbs, { c with pc_rhs }))+ let vbs, pc_rhs = loop ?label pc_rhs in+ (vbs, { c with pc_rhs }))in(reduce_vbss vbss, { expr with pexp_desc = Pexp_match (expr1, cases) })| { pexp_desc = Pexp_let (recflag, bindings, body); _ } ->let vbss1, bindings =List.unzip@@ List.map bindings ~f:(fun binding ->- let vbs, pvb_expr =- loop ~label:[%expr [ [%e pat2string binding.pvb_pat] ]] binding.pvb_expr- in- (vbs, { binding with pvb_expr }))+ let vbs, pvb_expr =+ loop ~label:[%expr [ [%e pat2string binding.pvb_pat] ]] binding.pvb_expr+ in+ (vbs, { binding with pvb_expr }))inlet vbs2, body = loop ?label body in(reduce_vbss (vbss1 @ [ vbs2 ]), { expr with pexp_desc = Pexp_let (recflag, bindings, body) })File "arrayjit/lib/indexing.ml", line 1, characters 0-0:diff --git a/_build/default/arrayjit/lib/indexing.ml b/_build/default/arrayjit/lib/.formatted/indexing.mlindex e4c9e9b..89414e4 100644--- a/_build/default/arrayjit/lib/indexing.ml+++ b/_build/default/arrayjit/lib/.formatted/indexing.ml@@ -291,15 +291,15 @@ let identity_projections ?debug_info ?derived_for ~lhs_dims () =let reflect_projection ~(dims : int array) ~(projection : axis_index array) =Array.zip_exn dims projection|> Array.fold_right ~init:(1, [], 0) ~f:(fun (dim, idx) (stride, symbols, offset) ->- match idx with- | Fixed_idx fixed_offset -> (stride * dim, symbols, offset + (fixed_offset * stride))- | Iterator sym -> (stride * dim, (stride, sym) :: symbols, offset)- | Affine { symbols = affine_symbols; offset = affine_offset } ->- let new_symbols =- List.map affine_symbols ~f:(fun (coeff, sym) -> (coeff * stride, sym))- in- (stride * dim, new_symbols @ symbols, offset + (affine_offset * stride))- | Sub_axis -> (stride * dim, symbols, offset))+ match idx with+ | Fixed_idx fixed_offset -> (stride * dim, symbols, offset + (fixed_offset * stride))+ | Iterator sym -> (stride * dim, (stride, sym) :: symbols, offset)+ | Affine { symbols = affine_symbols; offset = affine_offset } ->+ let new_symbols =+ List.map affine_symbols ~f:(fun (coeff, sym) -> (coeff * stride, sym))+ in+ (stride * dim, new_symbols @ symbols, offset + (affine_offset * stride))+ | Sub_axis -> (stride * dim, symbols, offset))|> fun (_, symbols, offset) -> Affine { symbols; offset }type variable_ref = { ref_label : string; mutable solved_dim : int option }File "test/operations/attention_test.ml", line 1, characters 0-0:diff --git a/_build/default/test/operations/attention_test.ml b/_build/default/test/operations/.formatted/attention_test.mlindex cf36028..3a2670a 100644--- a/_build/default/test/operations/attention_test.ml+++ b/_build/default/test/operations/.formatted/attention_test.ml@@ -19,7 +19,6 @@ let () =in(* Create input tensors *)-let seq =TDSL.range_of_shape ~label:[ "tgt" ] ~batch_dims:[ batch_size; tgt_seq_len ] ~input_dims:[]~output_dims:[ tgt_vocab_size ] ()File "arrayjit/lib/datatypes.ml", line 1, characters 0-0:diff --git a/_build/default/arrayjit/lib/datatypes.ml b/_build/default/arrayjit/lib/.formatted/datatypes.mlindex 35404a7..d1a76ca 100644--- a/_build/default/arrayjit/lib/datatypes.ml+++ b/_build/default/arrayjit/lib/.formatted/datatypes.ml@@ -39,8 +39,8 @@ let tl_exn = function| Empty -> raise @@ Not_found_s (Sexp.Atom "mutable_list.tl_exn")| Cons { tl; _ } -> tl-(** A dynamic array of weak references. *)type 'a weak_dynarray = 'a Stdlib.Weak.t ref+(** A dynamic array of weak references. *)let weak_create () : 'a weak_dynarray = ref @@ Stdlib.Weak.create 0@@ -67,12 +67,12 @@ let weak_iter (arr : 'a weak_dynarray) ~f =Option.iter (W.get !arr i) ~fdone-(** A lazy value that can be safely forced and compared by unique ID. *)type 'a safe_lazy = {mutable value : [ `Callback of unit -> 'a | `Value of 'a ];unique_id : string;}[@@deriving sexp_of]+(** A lazy value that can be safely forced and compared by unique ID. *)let safe_lazy unique_id f = { value = `Callback f; unique_id }@@ -123,37 +123,42 @@ let sexp_of_safe_lazy sexp_of_elem gated =Sexp.List [ Sexp.Atom "value"; status ];]-(** A persistent map implemented as a balanced binary tree.- The sexp_of function preserves and displays the tree structure. *)+(** A persistent map implemented as a balanced binary tree. The sexp_of function preserves and+ displays the tree structure. *)module Tree_map = structtype ('k, 'v) t =| Empty- | Node of {- key : 'k;- value : 'v;- left : ('k, 'v) t;- right : ('k, 'v) t;- height : int;- }+ | Node of { key : 'k; value : 'v; left : ('k, 'v) t; right : ('k, 'v) t; height : int }let empty = Empty-let height = function Empty -> 0 | Node { height; _ } -> heightlet create key value left right =Node { key; value; left; right; height = 1 + max (height left) (height right) }- let balance_factor = function- | Empty -> 0- | Node { left; right; _ } -> height left - height right+ let balance_factor = function Empty -> 0 | Node { left; right; _ } -> height left - height rightlet rotate_right = function- | Node { key; value; left = Node { key = lkey; value = lvalue; left = ll; right = lr; _ }; right; _ } ->+ | Node+ {+ key;+ value;+ left = Node { key = lkey; value = lvalue; left = ll; right = lr; _ };+ right;+ _;+ } ->create lkey lvalue ll (create key value lr right)| t -> tlet rotate_left = function- | Node { key; value; left; right = Node { key = rkey; value = rvalue; left = rl; right = rr; _ }; _ } ->+ | Node+ {+ key;+ value;+ left;+ right = Node { key = rkey; value = rvalue; left = rl; right = rr; _ };+ _;+ } ->create rkey rvalue (create key value left rl) rr| t -> t@@ -162,18 +167,22 @@ module Tree_map = struct| bf when bf > 1 -> (match t with| Node { left; _ } when balance_factor left < 0 ->- rotate_right (create (match t with Node n -> n.key | _ -> assert false)- (match t with Node n -> n.value | _ -> assert false)- (rotate_left left)- (match t with Node n -> n.right | _ -> assert false))+ rotate_right+ (create+ (match t with Node n -> n.key | _ -> assert false)+ (match t with Node n -> n.value | _ -> assert false)+ (rotate_left left)+ (match t with Node n -> n.right | _ -> assert false))| _ -> rotate_right t)| bf when bf < -1 -> (match t with| Node { right; _ } when balance_factor right > 0 ->- rotate_left (create (match t with Node n -> n.key | _ -> assert false)- (match t with Node n -> n.value | _ -> assert false)- (match t with Node n -> n.left | _ -> assert false)- (rotate_right right))+ rotate_left+ (create+ (match t with Node n -> n.key | _ -> assert false)+ (match t with Node n -> n.value | _ -> assert false)+ (match t with Node n -> n.left | _ -> assert false)+ (rotate_right right))| _ -> rotate_left t)| _ -> t@@ -200,7 +209,9 @@ module Tree_map = struct| Empty -> false| Node n ->let c = compare key n.key in- if c = 0 then true else if c < 0 then mem ~compare ~key n.left else mem ~compare ~key n.right+ if c = 0 then true+ else if c < 0 then mem ~compare ~key n.left+ else mem ~compare ~key n.rightlet rec fold t ~init ~f =match t with@@ -221,14 +232,12 @@ module Tree_map = structlet rec map t ~f =match t with| Empty -> Empty- | Node n ->- create n.key (f n.value) (map n.left ~f) (map n.right ~f)+ | Node n -> create n.key (f n.value) (map n.left ~f) (map n.right ~f)let rec mapi t ~f =match t with| Empty -> Empty- | Node n ->- create n.key (f ~key:n.key ~data:n.value) (mapi n.left ~f) (mapi n.right ~f)+ | Node n -> create n.key (f ~key:n.key ~data:n.value) (mapi n.left ~f) (mapi n.right ~f)let to_alist t = List.rev (fold t ~init:[] ~f:(fun ~key ~data acc -> (key, data) :: acc))File "tensor/shape.mli", line 1, characters 0-0:diff --git a/_build/default/tensor/shape.mli b/_build/default/tensor/.formatted/shape.mliindex 75ff71a..a68d82e 100644--- a/_build/default/tensor/shape.mli+++ b/_build/default/tensor/.formatted/shape.mli@@ -195,8 +195,8 @@ type logic =[s1], hence the name. *)| Broadcast_tern of ternary_type * t * t * t (** Matches the shapes for a ternary operation. *)| Terminal of { is_param : bool; logic : terminal_type }- (** Extracts any available shape information from the initialization.- The [is_param] field indicates if this is a parameter tensor that requires gradients. *)+ (** Extracts any available shape information from the initialization. The [is_param] field+ indicates if this is a parameter tensor that requires gradients. *)[@@deriving equal, sexp_of]type update_id [@@deriving equal, compare, hash, sexp]File "test/operations/test_where_simple.ml", line 1, characters 0-0:diff --git a/_build/default/test/operations/test_where_simple.ml b/_build/default/test/operations/.formatted/test_where_simple.mlindex 3a1f08c..9940f2a 100644--- a/_build/default/test/operations/test_where_simple.ml+++ b/_build/default/test/operations/.formatted/test_where_simple.ml@@ -7,7 +7,7 @@ let () =Tensor.unsafe_reinitialize ();let ctx = Context.auto () in(* Simple test: where(true, x, y) should have gradient flow to x only *)- let x = Tensor.number ~grad_spec:Require_grad 2.0 in+ let x = Tensor.number ~grad_spec:Require_grad 2.0 inlet y = Tensor.number ~grad_spec:Require_grad 3.0 inlet cond = Tensor.number 1.0 in(* true *)File "test/operations/transformer_test.ml", line 1, characters 0-0:diff --git a/_build/default/test/operations/transformer_test.ml b/_build/default/test/operations/.formatted/transformer_test.mlindex a2882f2..fc66e09 100644--- a/_build/default/test/operations/transformer_test.ml+++ b/_build/default/test/operations/.formatted/transformer_test.ml@@ -33,30 +33,32 @@ let () =(* For teacher forcing: create shifted versions of target sequence *)(* tgt_input: positions 0 to tgt_seq_len-2 (all but last) *)let tgt_input =- TDSL.range_of_shape ~label:[ "tgt_input" ] ~batch_dims:[ batch_size; tgt_seq_len - 1 ]+ TDSL.range_of_shape ~label:[ "tgt_input" ]+ ~batch_dims:[ batch_size; tgt_seq_len - 1 ]~input_dims:[] ~output_dims:[ tgt_vocab_size ] ()in(* tgt_target: positions 1 to tgt_seq_len-1 (all but first) *)(* In practice, this would be shifted token IDs, here we use one-hot for simplicity *)let tgt_target =- NTDSL.init ~l:"tgt_target" ~prec:Ir.Ops.single ~b:[ batch_size; tgt_seq_len - 1 ] ~i:[]- ~o:[ tgt_vocab_size ]+ NTDSL.init ~l:"tgt_target" ~prec:Ir.Ops.single+ ~b:[ batch_size; tgt_seq_len - 1 ]+ ~i:[] ~o:[ tgt_vocab_size ]~f:(function| [| _b; s; v |] ->(* Create a simple one-hot pattern for testing *)if v = Int.((s + 1) % tgt_vocab_size) then 1. else 0.- | idcs ->- failwith @@ "Invalid indices: "- ^ Sexp.to_string_hum ([%sexp_of: int array] idcs))+ | idcs -> failwith @@ "Invalid indices: " ^ Sexp.to_string_hum ([%sexp_of: int array] idcs))()in(* Create a causal mask for the decoder input (shifted target sequence) *)(* Mask should be 0 for positions to mask out, 1 for positions to keep *)let mask =- NTDSL.init ~l:"mask" ~prec:Ir.Ops.single ~b:[ batch_size; tgt_seq_len - 1 ]- ~i:[ tgt_seq_len - 1 ] ~o:[ 1 ]+ NTDSL.init ~l:"mask" ~prec:Ir.Ops.single+ ~b:[ batch_size; tgt_seq_len - 1 ]+ ~i:[ tgt_seq_len - 1 ]+ ~o:[ 1 ]~f:(function| [| _; s; _; t |] -> if s >= t then 1. else 0.| idcs ->@@ -78,7 +80,6 @@ let () =let _ctx = Ocannl.Train.forward_once ~output_cd_file:false ~bindings ctx loss in(* Verify shapes *)- Stdio.printf "Loss shape:\n%s\n"- (Sexp.to_string_hum ([%sexp_of: Shape.t] loss.Tensor.shape));+ Stdio.printf "Loss shape:\n%s\n" (Sexp.to_string_hum ([%sexp_of: Shape.t] loss.Tensor.shape));Stdio.printf "Logits shape:\n%s\n%!"(Sexp.to_string_hum ([%sexp_of: Shape.t] logits.Tensor.shape))File "tensor/ppx_shared.ml", line 1, characters 0-0:diff --git a/_build/default/tensor/ppx_shared.ml b/_build/default/tensor/.formatted/ppx_shared.mlindex 8c26a58..33ae188 100644--- a/_build/default/tensor/ppx_shared.ml+++ b/_build/default/tensor/.formatted/ppx_shared.ml@@ -298,8 +298,8 @@ let expr_expander_with_punning translate ~loc ~path:_ payload =let vbss, bindings =List.unzip@@ List.map bindings ~f:(fun vb ->- let vbs, v = translate ?ident_label:(Some vb.pvb_pat) vb.pvb_expr in- (vbs, { vb with pvb_expr = v }))+ let vbs, v = translate ?ident_label:(Some vb.pvb_pat) vb.pvb_expr in+ (vbs, { vb with pvb_expr = v }))inlet expr = { payload with pexp_desc = Pexp_let (recflag, bindings, body) } inlet_opt ~loc (reduce_vbss vbss) exprFile "test/operations/primitive_ops.ml", line 1, characters 0-0:diff --git a/_build/default/test/operations/primitive_ops.ml b/_build/default/test/operations/.formatted/primitive_ops.mlindex ccf0ebb..e3b3174 100644--- a/_build/default/test/operations/primitive_ops.ml+++ b/_build/default/test/operations/.formatted/primitive_ops.ml@@ -31,9 +31,9 @@ let plot_unop ?(x_min = -5.) ?(x_max = 5.) ~f () =let ys, dys =Array.unzip@@ Array.mapi xs ~f:(fun i _ ->- step_ref := i;- Train.run ctx fx_routine;- (fx.@[0], x.@%[0]))+ step_ref := i;+ Train.run ctx fx_routine;+ (fx.@[0], x.@%[0]))in(* It is fine to loop around the data: it's "next epoch". We redo the work though. *)PrintBox_utils.plot ~x_label:"x" ~y_label:"f(x)"File "arrayjit/lib/backends.ml", line 1, characters 0-0:diff --git a/_build/default/arrayjit/lib/backends.ml b/_build/default/arrayjit/lib/.formatted/backends.mlindex 166603a..b013e06 100644--- a/_build/default/arrayjit/lib/backends.ml+++ b/_build/default/arrayjit/lib/.formatted/backends.ml@@ -32,7 +32,7 @@ module Add_buffer_retrieval_and_syncing (Backend : No_buffer_retrieval_or_syncin(Fn.compose (List.filter ~f:(fun (_, e) -> not (Backend.is_done e)))@@ Option.value ~default:[])|> List.iter ~f:(fun (work_stream, e) ->- if not (equal_stream work_stream s) then Backend.will_wait_for ctx e)+ if not (equal_stream work_stream s) then Backend.will_wait_for ctx e)let wait_for_ready ~dst ~src tn =let s = src.stream in@@ -40,7 +40,7 @@ module Add_buffer_retrieval_and_syncing (Backend : No_buffer_retrieval_or_syncin(* TODO: maybe it's worthwhile to clean up s.updating_for every now and then. *)Hashtbl.find s.updating_for tn|> Option.iter ~f:(fun upd_e ->- if not (equal_stream s d || Backend.is_done upd_e) then Backend.will_wait_for dst upd_e)+ if not (equal_stream s d || Backend.is_done upd_e) then Backend.will_wait_for dst upd_e)let%track3_sexp to_host (ctx : Backend.context) (tn : Tn.t) =match (tn, Map.find ctx.ctx_arrays tn) with@@ -269,13 +269,13 @@ let lower_batch_assignments optim_ctx ?names ?occupancy bindings asgns_l =let occupancy = Option.value occupancy ~default:(fun ~name:_ ~src_n:_ -> true) inArray.unzip@@ Array.mapi names ~f:(fun src_n name ->- let asgns = asgns_l.(src_n) in- if occupancy ~name ~src_n then- ( Some name,- Some- (Assignments.lower optim_ctx ~unoptim_ll_source ~ll_source ~cd_source ~name bound- asgns) )- else (None, None))+ let asgns = asgns_l.(src_n) in+ if occupancy ~name ~src_n then+ ( Some name,+ Some+ (Assignments.lower optim_ctx ~unoptim_ll_source ~ll_source ~cd_source ~name bound asgns)+ )+ else (None, None))let%debug3_sexp verify_prior_context ~use_host_memory ~ctx_arrays ~from_prior_context : unit =Set.iter from_prior_context ~f:(fun tn ->@@ -659,8 +659,7 @@ let%track5_sexp fresh_backend ?backend_name ?(config = For_parallel_copying) (): Backend)| "sync_cc" ->(module Make_device_backend_from_lowered (Schedulers.Sync) (Cc_backend) (Config) : Backend)- | "cuda" ->- (module Raise_backend ((Cuda_backend_impl.Fresh (Config) : Lowered_backend)) : Backend)+ | "cuda" -> (module Raise_backend (Cuda_backend_impl.Fresh (Config) : Lowered_backend) : Backend)| "metal" ->- (module Raise_backend ((Metal_backend_impl.Fresh (Config) : Lowered_backend)) : Backend)+ (module Raise_backend (Metal_backend_impl.Fresh (Config) : Lowered_backend) : Backend)| backend -> invalid_arg [%string "Backends.fresh_backend: unknown backend %{backend}"]File "test/operations/zero2hero_1of7.ml", line 1, characters 0-0:diff --git a/_build/default/test/operations/zero2hero_1of7.ml b/_build/default/test/operations/.formatted/zero2hero_1of7.mlindex f68634c..d2bc5e2 100644--- a/_build/default/test/operations/zero2hero_1of7.ml+++ b/_build/default/test/operations/.formatted/zero2hero_1of7.ml@@ -175,9 +175,9 @@ let%expect_test "Graph drawing fetch" =let ys, dys =Array.unzip@@ Array.mapi xs ~f:(fun i _ ->- step_ref := i;- Train.run ctx fx_routine;- (fx.@[0], x.@%[0]))+ step_ref := i;+ Train.run ctx fx_routine;+ (fx.@[0], x.@%[0]))in(* It is fine to loop around the data: it's "next epoch". We redo the work though. *)let plot_box =File "test/operations/test_random_histograms.ml", line 1, characters 0-0:diff --git a/_build/default/test/operations/test_random_histograms.ml b/_build/default/test/operations/.formatted/test_random_histograms.mlindex 7d0e22d..558b282 100644--- a/_build/default/test/operations/test_random_histograms.ml+++ b/_build/default/test/operations/.formatted/test_random_histograms.ml@@ -18,16 +18,15 @@ let print_histogram bins ~title ~max_width =let max_count = Array.max_elt bins ~compare:Int.compare |> Option.value ~default:0 inlet total = Array.fold bins ~init:0 ~f:( + ) inArray.iteri bins ~f:(fun i count ->- let bar_width = (count * max_width) / max_count in+ let bar_width = count * max_width / max_count inlet bar = String.make bar_width '#' in- let percentage = (Float.of_int count /. Float.of_int total) *. 100.0 in+ let percentage = Float.of_int count /. Float.of_int total *. 100.0 inprintf "Bin %2d: %s %4d (%.1f%%)\n" i bar count percentage)let test_uniform_at_histogram () =Tensor.unsafe_reinitialize ();let ctx = Context.auto () inlet module O = TDSL.O in-(* Generate a large batch of random numbers using uniform_at *)(* Note: uniform_at produces 4 values per counter input (from uint4x32) *)let num_counters = 2500 in@@ -42,8 +41,8 @@ let test_uniform_at_histogram () =ignore (Ocannl.Train.forward_once ctx uniform_values);let result = Ir.Tnode.get_values uniform_values.value in- printf "Generated %d values from %d counters (%.1fx expansion)\n"- (Array.length result) num_counters+ printf "Generated %d values from %d counters (%.1fx expansion)\n" (Array.length result)+ num_counters(Float.of_int (Array.length result) /. Float.of_int num_counters);(* Create and print histogram *)@@ -52,10 +51,9 @@ let test_uniform_at_histogram () =print_histogram bins ~title:"Uniform Distribution [0, 1) Histogram" ~max_width:40;(* Statistical tests *)- let mean = Array.fold result ~init:0.0 ~f:(+.) /. Float.of_int (Array.length result) in+ let mean = Array.fold result ~init:0.0 ~f:( +. ) /. Float.of_int (Array.length result) inlet variance =- Array.fold result ~init:0.0 ~f:(fun acc x ->- acc +. ((x -. mean) *. (x -. mean)))+ Array.fold result ~init:0.0 ~f:(fun acc x -> acc +. ((x -. mean) *. (x -. mean)))/. Float.of_int (Array.length result)inlet std_dev = Float.sqrt variance in@@ -73,8 +71,8 @@ let test_uniform_at_histogram () =let diff = Float.of_int observed -. expected_per_bin inacc +. (diff *. diff /. expected_per_bin))in- printf " Chi-square statistic: %.2f (df=%d, critical value at 0.05: ~%.2f)\n"- chi_square (num_bins - 1) 30.14;+ printf " Chi-square statistic: %.2f (df=%d, critical value at 0.05: ~%.2f)\n" chi_square+ (num_bins - 1) 30.14;(* Check if all values are in range *)let all_in_range = Array.for_all result ~f:(fun x -> Float.(x >= 0.0 && x < 1.0)) in@@ -84,7 +82,6 @@ let test_normal_at_histogram () =Tensor.unsafe_reinitialize ();let ctx = Context.auto () inlet module O = TDSL.O in-(* Generate a large batch of random numbers using normal_at *)(* Note: normal_at also produces 4 values per counter input *)let num_counters = 2500 in@@ -100,10 +97,9 @@ let test_normal_at_histogram () =let result = Ir.Tnode.get_values normal_values.value in(* Calculate statistics *)- let mean = Array.fold result ~init:0.0 ~f:(+.) /. Float.of_int (Array.length result) in+ let mean = Array.fold result ~init:0.0 ~f:( +. ) /. Float.of_int (Array.length result) inlet variance =- Array.fold result ~init:0.0 ~f:(fun acc x ->- acc +. ((x -. mean) *. (x -. mean)))+ Array.fold result ~init:0.0 ~f:(fun acc x -> acc +. ((x -. mean) *. (x -. mean)))/. Float.of_int (Array.length result)inlet std_dev = Float.sqrt variance in@@ -124,15 +120,9 @@ let test_normal_at_histogram () =printf " Max: %.4f\n" max_val;(* Check what percentage falls within standard deviations *)- let within_1_std =- Array.count result ~f:(fun x -> Float.(abs x <= 1.0))- in- let within_2_std =- Array.count result ~f:(fun x -> Float.(abs x <= 2.0))- in- let within_3_std =- Array.count result ~f:(fun x -> Float.(abs x <= 3.0))- in+ let within_1_std = Array.count result ~f:(fun x -> Float.(abs x <= 1.0)) in+ let within_2_std = Array.count result ~f:(fun x -> Float.(abs x <= 2.0)) in+ let within_3_std = Array.count result ~f:(fun x -> Float.(abs x <= 3.0)) inprintf " Within 1 std dev: %.1f%% (expected: ~68.3%%)\n"(Float.of_int within_1_std /. Float.of_int (Array.length result) *. 100.0);@@ -143,20 +133,23 @@ let test_normal_at_histogram () =(* Normality test using skewness and kurtosis *)let skewness =- let sum_cubed = Array.fold result ~init:0.0 ~f:(fun acc x ->- let diff = x -. mean in- acc +. (diff *. diff *. diff))+ let sum_cubed =+ Array.fold result ~init:0.0 ~f:(fun acc x ->+ let diff = x -. mean in+ acc +. (diff *. diff *. diff))insum_cubed /. (Float.of_int (Array.length result) *. std_dev *. std_dev *. std_dev)inlet kurtosis =- let sum_fourth = Array.fold result ~init:0.0 ~f:(fun acc x ->- let diff = x -. mean in- let diff2 = diff *. diff in- acc +. (diff2 *. diff2))+ let sum_fourth =+ Array.fold result ~init:0.0 ~f:(fun acc x ->+ let diff = x -. mean in+ let diff2 = diff *. diff in+ acc +. (diff2 *. diff2))in- (sum_fourth /. (Float.of_int (Array.length result) *. std_dev *. std_dev *. std_dev *. std_dev)) -. 3.0+ (sum_fourth /. (Float.of_int (Array.length result) *. std_dev *. std_dev *. std_dev *. std_dev))+ -. 3.0inprintf " Skewness: %.4f (expected: ~0.0)\n" skewness;@@ -166,7 +159,6 @@ let test_batched_generation_consistency () =Tensor.unsafe_reinitialize ();let ctx = Context.auto () inlet module O = TDSL.O in-(* Test that batched generation gives consistent results *)let batch_size = 100 inlet num_batches = 10 in@@ -205,9 +197,8 @@ let test_batched_generation_consistency () =Array.sort sorted ~compare:Float.compare;let unique = ref 1 infor i = 1 to Array.length sorted - 1 do- let diff = Float.abs (sorted.(i) -. sorted.(i-1)) in- if Float.(diff > 1e-7) then- unique := !unique + 1+ let diff = Float.abs (sorted.(i) -. sorted.(i - 1)) in+ if Float.(diff > 1e-7) then unique := !unique + 1done;!uniquein@@ -217,11 +208,9 @@ let test_batched_generation_consistency () =let unique_normal = count_unique !all_normal_values inprintf "Generated %d values in %d batches of %d\n" total_values num_batches batch_size;- printf "Uniform values: %d unique out of %d (%.1f%%)\n"- unique_uniform total_values+ printf "Uniform values: %d unique out of %d (%.1f%%)\n" unique_uniform total_values(Float.of_int unique_uniform /. Float.of_int total_values *. 100.0);- printf "Normal values: %d unique out of %d (%.1f%%)\n"- unique_normal total_values+ printf "Normal values: %d unique out of %d (%.1f%%)\n" unique_normal total_values(Float.of_int unique_normal /. Float.of_int total_values *. 100.0);(* Verify batch consistency of statistical properties *)@@ -234,40 +223,44 @@ let test_batched_generation_consistency () =let normal_batch = Array.sub !all_normal_values ~pos:start_idx ~len:batch_size inbatch_means_uniform.(batch) <-- Array.fold uniform_batch ~init:0.0 ~f:(+.) /. Float.of_int batch_size;+ Array.fold uniform_batch ~init:0.0 ~f:( +. ) /. Float.of_int batch_size;batch_means_normal.(batch) <-- Array.fold normal_batch ~init:0.0 ~f:(+.) /. Float.of_int batch_size+ Array.fold normal_batch ~init:0.0 ~f:( +. ) /. Float.of_int batch_sizedone;let mean_of_means_uniform =- Array.fold batch_means_uniform ~init:0.0 ~f:(+.) /. Float.of_int num_batches+ Array.fold batch_means_uniform ~init:0.0 ~f:( +. ) /. Float.of_int num_batchesinlet mean_of_means_normal =- Array.fold batch_means_normal ~init:0.0 ~f:(+.) /. Float.of_int num_batches+ Array.fold batch_means_normal ~init:0.0 ~f:( +. ) /. Float.of_int num_batchesinlet std_of_means_uniform =- let diff_sum = Array.fold batch_means_uniform ~init:0.0 ~f:(fun acc x ->- let diff = x -. mean_of_means_uniform in- acc +. (diff *. diff)) in+ let diff_sum =+ Array.fold batch_means_uniform ~init:0.0 ~f:(fun acc x ->+ let diff = x -. mean_of_means_uniform in+ acc +. (diff *. diff))+ inFloat.sqrt (diff_sum /. Float.of_int num_batches)inlet std_of_means_normal =- let diff_sum = Array.fold batch_means_normal ~init:0.0 ~f:(fun acc x ->- let diff = x -. mean_of_means_normal in- acc +. (diff *. diff)) in+ let diff_sum =+ Array.fold batch_means_normal ~init:0.0 ~f:(fun acc x ->+ let diff = x -. mean_of_means_normal in+ acc +. (diff *. diff))+ inFloat.sqrt (diff_sum /. Float.of_int num_batches)inprintf "\nBatch means consistency:\n";- printf " Uniform: mean of batch means = %.4f, std = %.4f\n"- mean_of_means_uniform std_of_means_uniform;- printf " Normal: mean of batch means = %.4f, std = %.4f\n"- mean_of_means_normal std_of_means_normal+ printf " Uniform: mean of batch means = %.4f, std = %.4f\n" mean_of_means_uniform+ std_of_means_uniform;+ printf " Normal: mean of batch means = %.4f, std = %.4f\n" mean_of_means_normal+ std_of_means_normallet () =test_uniform_at_histogram ();printf "\n";test_normal_at_histogram ();printf "\n";- test_batched_generation_consistency ()\ No newline at end of file+ test_batched_generation_consistency ()File "arrayjit/lib/tnode.ml", line 1, characters 0-0:diff --git a/_build/default/arrayjit/lib/tnode.ml b/_build/default/arrayjit/lib/.formatted/tnode.mlindex 9061870..fdce12a 100644--- a/_build/default/arrayjit/lib/tnode.ml+++ b/_build/default/arrayjit/lib/.formatted/tnode.ml@@ -165,22 +165,22 @@ let debug_memory_mode = function| None -> "unknown"| Some (mem, prov) ->(match mem with- | Effectively_constant -> "Const"- | Virtual -> "Virt"- | Never_virtual -> "Non-virt"- | Local -> "Local"- | Device_only -> "Dev"- | Materialized -> "Material"- | On_device Unset -> "On-dev"- | On_device Shared_cross_streams -> "Dev-shared"- | On_device Per_stream -> "Dev-stream"- | Hosted Constant -> "Host-const"- | Hosted Nonconstant -> "Host-non-const"- | Hosted Unset_hosted -> "Host-unset"- | Hosted Volatile -> "Hosted"- | Hosted (Changed_on_devices Unset) -> "Host&dev"- | Hosted (Changed_on_devices Per_stream) -> "Host&stream"- | Hosted (Changed_on_devices Shared_cross_streams) -> "Host&shared")+ | Effectively_constant -> "Const"+ | Virtual -> "Virt"+ | Never_virtual -> "Non-virt"+ | Local -> "Local"+ | Device_only -> "Dev"+ | Materialized -> "Material"+ | On_device Unset -> "On-dev"+ | On_device Shared_cross_streams -> "Dev-shared"+ | On_device Per_stream -> "Dev-stream"+ | Hosted Constant -> "Host-const"+ | Hosted Nonconstant -> "Host-non-const"+ | Hosted Unset_hosted -> "Host-unset"+ | Hosted Volatile -> "Hosted"+ | Hosted (Changed_on_devices Unset) -> "Host&dev"+ | Hosted (Changed_on_devices Per_stream) -> "Host&stream"+ | Hosted (Changed_on_devices Shared_cross_streams) -> "Host&shared")^ "/" ^ Int.to_string provlet log_debug_info ~from_log_level tn =File "tensor/tensor.ml", line 1, characters 0-0:diff --git a/_build/default/tensor/tensor.ml b/_build/default/tensor/.formatted/tensor.mlindex f8e5c36..6b00695 100644--- a/_build/default/tensor/tensor.ml+++ b/_build/default/tensor/.formatted/tensor.ml@@ -119,9 +119,9 @@ let%debug7_sexp rec init_params ?skip (t : t) : Asgns.comp =let params : t list =Set.to_list t.params|> (match skip with- | None -> Fn.id- | Some skip -> List.filter ~f:(fun p -> not (Map.mem skip p.value)))- (* Compare to ordered_ts in op -- we need to sort to avoid computed-after-use bugs! *)+ | None -> Fn.id+ | Some skip -> List.filter ~f:(fun p -> not (Map.mem skip p.value)))+ (* Compare to ordered_ts in op -- we need to sort to avoid computed-after-use bugs! *)|> List.sort ~compare:(fun p1 p2 -> Int.ascending p1.id p2.id)inlet asgns =File "arrayjit/lib/utils.ml", line 1, characters 0-0:diff --git a/_build/default/arrayjit/lib/utils.ml b/_build/default/arrayjit/lib/.formatted/utils.mlindex a170906..d2a97b7 100644--- a/_build/default/arrayjit/lib/utils.ml+++ b/_build/default/arrayjit/lib/.formatted/utils.ml@@ -119,25 +119,25 @@ let config_file_args =let result =config_lines|> List.filter ~f:(fun l ->- not (String.is_prefix ~prefix:"~~" l || String.is_prefix ~prefix:"#" l))+ not (String.is_prefix ~prefix:"~~" l || String.is_prefix ~prefix:"#" l))|> List.map ~f:(String.split ~on:'=')|> List.filter_map ~f:(function- | [] -> None- | [ s ] when String.is_empty s -> None- | key :: [ v ] ->- let key =- String.(- lowercase @@ strip ~drop:(fun c -> equal_char '-' c || equal_char ' ' c) key)- in- let key =- if String.is_prefix key ~prefix:"ocannl" then- String.drop_prefix key 6 |> String.strip ~drop:(equal_char '_')- else key- in- str_nonempty ~f:(pair key) v- | l ->- failwith @@ "OCANNL: invalid syntax in the config file " ^ fname- ^ ", should have a single '=' on each non-empty line, found: " ^ String.concat l)+ | [] -> None+ | [ s ] when String.is_empty s -> None+ | key :: [ v ] ->+ let key =+ String.(+ lowercase @@ strip ~drop:(fun c -> equal_char '-' c || equal_char ' ' c) key)+ in+ let key =+ if String.is_prefix key ~prefix:"ocannl" then+ String.drop_prefix key 6 |> String.strip ~drop:(equal_char '_')+ else key+ in+ str_nonempty ~f:(pair key) v+ | l ->+ failwith @@ "OCANNL: invalid syntax in the config file " ^ fname+ ^ ", should have a single '=' on each non-empty line, found: " ^ String.concat l)|> Hashtbl.of_alist (module String)|> function| `Ok h -> h@@ -379,11 +379,11 @@ let get_local_debug_runtime =elseString.split pairs_str ~on:';'|> List.filter_map ~f:(fun pair_str ->- match String.split pair_str ~on:',' with- | [ id1; id2 ] ->- Option.try_with (fun () ->- (Int.of_string (String.strip id1), Int.of_string (String.strip id2)))- | _ -> None)+ match String.split pair_str ~on:',' with+ | [ id1; id2 ] ->+ Option.try_with (fun () ->+ (Int.of_string (String.strip id1), Int.of_string (String.strip id2)))+ | _ -> None)inlet truncate_children =let arg = get_global_arg ~default:"" ~arg_name:"debug_log_truncate_children" inFile "arrayjit/lib/ndarray.ml", line 1, characters 0-0:diff --git a/_build/default/arrayjit/lib/ndarray.ml b/_build/default/arrayjit/lib/.formatted/ndarray.mlindex efff2f6..ac068a2 100644--- a/_build/default/arrayjit/lib/ndarray.ml+++ b/_build/default/arrayjit/lib/.formatted/ndarray.ml@@ -691,22 +691,21 @@ let render_array ?(brief = false) ?(prefix = "") ?(entries_per_axis = 4) ?(labellet outer_grid v =(if brief then Fn.id else B.frame ~stretch:false)@@ B.init_grid ~bars:true ~line:nlines ~col:ncols (fun ~line ~col ->- if (not brief) && line = 0 && col = 0 then- B.lines @@ List.filter ~f:(Fn.non String.is_empty) @@ [ tag ~pos:v label0 ind0 ]- else if (not brief) && line = 0 then- B.lines- @@ List.filter ~f:(Fn.non String.is_empty)- @@ [ tag ~pos:(col - 1) label2 ind2; tag label4 ind4 ]- else if (not brief) && col = 0 then- B.lines- @@ List.filter ~f:(Fn.non String.is_empty)- @@ [ tag ~pos:(line - 1) label1 ind1; tag label3 ind3 ]- else- let nline = if brief then line else line - 1 in- let ncol = if brief then col else col - 1 in- if elide_for ncol ~ind:ind2 || elide_for nline ~ind:ind1 then- B.hpad 1 @@ B.line "..."- else inner_grid v nline ncol)+ if (not brief) && line = 0 && col = 0 then+ B.lines @@ List.filter ~f:(Fn.non String.is_empty) @@ [ tag ~pos:v label0 ind0 ]+ else if (not brief) && line = 0 then+ B.lines+ @@ List.filter ~f:(Fn.non String.is_empty)+ @@ [ tag ~pos:(col - 1) label2 ind2; tag label4 ind4 ]+ else if (not brief) && col = 0 then+ B.lines+ @@ List.filter ~f:(Fn.non String.is_empty)+ @@ [ tag ~pos:(line - 1) label1 ind1; tag label3 ind3 ]+ else+ let nline = if brief then line else line - 1 in+ let ncol = if brief then col else col - 1 in+ if elide_for ncol ~ind:ind2 || elide_for nline ~ind:ind1 then B.hpad 1 @@ B.line "..."+ else inner_grid v nline ncol)inlet screens =B.init_grid ~bars:true ~line:size0 ~col:1 (fun ~line ~col:_ ->File "arrayjit/lib/c_syntax.ml", line 1, characters 0-0:diff --git a/_build/default/arrayjit/lib/c_syntax.ml b/_build/default/arrayjit/lib/.formatted/c_syntax.mlindex cfb97ba..0a6b758 100644--- a/_build/default/arrayjit/lib/c_syntax.ml+++ b/_build/default/arrayjit/lib/.formatted/c_syntax.ml@@ -759,19 +759,19 @@ module C_syntax (B : C_syntax_config) = structlet params : (string * param_source) list =List.rev@@ Hashtbl.fold traced_store ~init:[] ~f:(fun ~key:tn ~data:_ params ->- let backend_info, is_param =- if Tn.is_virtual_force tn 334 then ("Virt", false)- else if in_ctx tn then ("Ctx", true)- else if Tn.is_materialized_force tn 335 then ("Global", true)- else if Tn.known_not_materialized tn then ("Local", false)- else assert false- in- let backend_info = Sexp.Atom backend_info in- if not @@ Utils.sexp_mem ~elem:backend_info tn.backend_info then- tn.backend_info <- Utils.sexp_append ~elem:backend_info tn.backend_info;- if is_param then- (B.typ_of_prec (Lazy.force tn.Tn.prec) ^ " *" ^ get_ident tn, Param_ptr tn) :: params- else params)+ let backend_info, is_param =+ if Tn.is_virtual_force tn 334 then ("Virt", false)+ else if in_ctx tn then ("Ctx", true)+ else if Tn.is_materialized_force tn 335 then ("Global", true)+ else if Tn.known_not_materialized tn then ("Local", false)+ else assert false+ in+ let backend_info = Sexp.Atom backend_info in+ if not @@ Utils.sexp_mem ~elem:backend_info tn.backend_info then+ tn.backend_info <- Utils.sexp_append ~elem:backend_info tn.backend_info;+ if is_param then+ (B.typ_of_prec (Lazy.force tn.Tn.prec) ^ " *" ^ get_ident tn, Param_ptr tn) :: params+ else params)inlet idx_params =List.map idx_params ~f:(fun s ->@@ -788,7 +788,7 @@ module C_syntax (B : C_syntax_config) = structOption.(to_list@@ map merge_node ~f:(fun tn ->- ("const " ^ B.typ_of_prec (Lazy.force tn.prec) ^ " *merge_buffer", Merge_buffer)))+ ("const " ^ B.typ_of_prec (Lazy.force tn.prec) ^ " *merge_buffer", Merge_buffer)))inlet all_params = log_file_param @ merge_param @ idx_params @ params inlet sorted_params =Warning: Invalid documentation comment:File "tensor/shape.ml", line 24, characters 0-0:End of text is not allowed in '[...]' (code).File "tensor/shape.ml", line 1, characters 0-0:diff --git a/_build/default/tensor/shape.ml b/_build/default/tensor/.formatted/shape.mlindex 79792b5..35864b8 100644--- a/_build/default/tensor/shape.ml+++ b/_build/default/tensor/.formatted/shape.ml@@ -328,7 +328,7 @@ let axis_map_to_dims_bio (type a) ?(default : a option) (idcs : a axis_map) =let back_axes, front_axes =Map.to_alist axes|> List.partition_map ~f:(fun ({ AxisKey.from_end; pos = i; _ }, v) ->- if from_end then Either.First (i, v) else Second (i, v))+ if from_end then Either.First (i, v) else Second (i, v))inlet back_size = List.fold back_axes ~init:0 ~f:(fun accu (i, _) -> max i accu) inlet front_size = List.fold front_axes ~init:0 ~f:(fun accu (i, _) -> max i accu) in@@ -888,21 +888,21 @@ let%debug4_sexp get_inequalities ({ shape = cur_sh; logic; id = _ } as _upd : up( proj_axis_env,(Option.to_list static_range|> List.map ~f:(fun range ->- Dim_eq- {- d1 = get_dim ~d:range ();- d2 = slice_var;- origin =- [- {- lhs_name = sh.debug_name;- lhs_kind = `Batch;- rhs_name = Idx.symbol_ident static_symbol;- rhs_kind = `Batch;- operation = Some "Slice";- };- ];- }))+ Dim_eq+ {+ d1 = get_dim ~d:range ();+ d2 = slice_var;+ origin =+ [+ {+ lhs_name = sh.debug_name;+ lhs_kind = `Batch;+ rhs_name = Idx.symbol_ident static_symbol;+ rhs_kind = `Batch;+ operation = Some "Slice";+ };+ ];+ }))@ [Row_eq { r1 = expanded_batch; r2 = sh.batch; origin = get_origin `Batch };Row_eq { r1 = cur_sh.input; r2 = sh.input; origin = get_origin `Input };@@ -1987,15 +1987,12 @@ let to_string_hum ?(style = Row.Axis_size) (sh : t) =let dims = (row_of_kind kind sh).dims inString.concat ~sep:","@@ List.mapi dims ~f:(fun i d ->- let num =- match kind with- | `Input -> n_batch + n_outputs + i- | `Output -> n_batch + i- | `Batch -> i- in- match style with- | Row.Only_labels | Axis_size | Projection_and_size -> Row.dim_to_string style d- | Axis_number_and_size -> Int.to_string num ^ ":" ^ Row.dim_to_string style d)+ let num =+ match kind with `Input -> n_batch + n_outputs + i | `Output -> n_batch + i | `Batch -> i+ in+ match style with+ | Row.Only_labels | Axis_size | Projection_and_size -> Row.dim_to_string style d+ | Axis_number_and_size -> Int.to_string num ^ ":" ^ Row.dim_to_string style d)inlet batch_dims = dims_to_string `Batch inlet input_dims = dims_to_string `Input inFile "arrayjit/lib/cuda_backend.ml", line 1, characters 0-0:diff --git a/_build/default/arrayjit/lib/cuda_backend.ml b/_build/default/arrayjit/lib/.formatted/cuda_backend.mlindex 79d1754..d083ec6 100644--- a/_build/default/arrayjit/lib/cuda_backend.ml+++ b/_build/default/arrayjit/lib/.formatted/cuda_backend.ml@@ -1014,10 +1014,10 @@ end) : Ir.Backend_impl.Lowered_backend = structArray.mapi code_batch.params_and_names ~f:(fun i pns ->Option.value ~default:None@@ Option.map2 pns ctx_arrays.(i) ~f:(fun (params, name) ctx_arrays ->- let task =- link_proc ~prior_context ~name ~params ~ctx_arrays lowered_bindings run_module- in- Some task))+ let task =+ link_proc ~prior_context ~name ~params ~ctx_arrays lowered_bindings run_module+ in+ Some task))in(lowered_bindings, procs)Warning: Invalid documentation comment:File "tensor/row.ml", line 795, characters 39-49:'{ var; _ }': bad markup.Suggestion: did you mean '{! var; _ }' or '[ var; _ ]'?File "tensor/ppx_cd.ml", line 1, characters 0-0:diff --git a/_build/default/tensor/ppx_cd.ml b/_build/default/tensor/.formatted/ppx_cd.mlindex 21a2fb9..f27b24a 100644--- a/_build/default/tensor/ppx_cd.ml+++ b/_build/default/tensor/.formatted/ppx_cd.ml@@ -421,8 +421,8 @@ let handle_cases ~bad_pun_hints ~proj_in_scope transl cases =let fields, transformed_cases =List.unzip@@ List.map cases ~f:(fun ({ pc_rhs; _ } as c) ->- let res = transl ~bad_pun_hints ~proj_in_scope pc_rhs in- ((res.vbs, res.typ, res.slot), { c with pc_rhs = res.expr }))+ let res = transl ~bad_pun_hints ~proj_in_scope pc_rhs in+ ((res.vbs, res.typ, res.slot), { c with pc_rhs = res.expr }))inlet vbss, typs, slots = List.unzip3 fields in(* TODO: make the inference of typ and slot more strict by detecting mismatches. *)@@ -450,55 +450,55 @@ let translate ?ident_label (expr : expression) : result =let assignment_op accu_op =loc|> Option.value_or_thunk (Hashtbl.find assignment_ops accu_op) ~default:(fun () _loc ->- ( false,- Ast_builder.Default.pexp_extension ~loc- @@ Location.error_extensionf ~loc- "ppx_ocannl %%cd: expected an assignment operator, one of: %s %s"- "=+ (Add), =- (Sub), =* (Mul),=/ (Div), =** (ToPowOf), =?/ (Relu_gate), =?^ \- (Satur01_gate), =|| (Or), =&& (And), =@^ (Max), =@- (Min), =^^^^ \- (threefry4x32), =: (Arg2), =:+, =:-,"- " =:*, =:/, =:**, =:?/, =:?^, =:||, =:&&, =:@^, =:@-, =:^^^^ (same with \- initializing the tensor to the neutral value before the start of the \- calculation)" ))+ ( false,+ Ast_builder.Default.pexp_extension ~loc+ @@ Location.error_extensionf ~loc+ "ppx_ocannl %%cd: expected an assignment operator, one of: %s %s"+ "=+ (Add), =- (Sub), =* (Mul),=/ (Div), =** (ToPowOf), =?/ (Relu_gate), =?^ \+ (Satur01_gate), =|| (Or), =&& (And), =@^ (Max), =@- (Min), =^^^^ \+ (threefry4x32), =: (Arg2), =:+, =:-,"+ " =:*, =:/, =:**, =:?/, =:?^, =:||, =:&&, =:@^, =:@-, =:^^^^ (same with \+ initializing the tensor to the neutral value before the start of the \+ calculation)" ))inlet unary_op un_op =loc|> Option.value_or_thunk (Hashtbl.find unary_ops un_op) ~default:(fun () loc ->- ( [%expr Shape.Pointwise_un],- Ast_builder.Default.pexp_extension ~loc- @@ Location.error_extensionf ~loc- "ppx_ocannl %%cd: expected a unary operator, one of: %s"- "id, relu, sat01, exp, log, exp2, log2, sin, cos, sqrt, recip, recip_sqrt, \- neg, tanh, uint4x32_to_prec_uniform1" ))+ ( [%expr Shape.Pointwise_un],+ Ast_builder.Default.pexp_extension ~loc+ @@ Location.error_extensionf ~loc+ "ppx_ocannl %%cd: expected a unary operator, one of: %s"+ "id, relu, sat01, exp, log, exp2, log2, sin, cos, sqrt, recip, recip_sqrt, neg, \+ tanh, uint4x32_to_prec_uniform1" ))inlet vec_unary_op vec_un_op =loc|> Option.value_or_thunk (Hashtbl.find vec_unary_ops vec_un_op) ~default:(fun () loc ->- ( [%expr Shape.Uint4x32_to_prec_uniform],- Ast_builder.Default.pexp_extension ~loc- @@ Location.error_extensionf ~loc- "ppx_ocannl %%cd: expected a vector unary operator, one of: \- uint4x32_to_prec_uniform; found: %s"- vec_un_op ))+ ( [%expr Shape.Uint4x32_to_prec_uniform],+ Ast_builder.Default.pexp_extension ~loc+ @@ Location.error_extensionf ~loc+ "ppx_ocannl %%cd: expected a vector unary operator, one of: \+ uint4x32_to_prec_uniform; found: %s"+ vec_un_op ))inlet binary_op bin_op =loc|> Option.value_or_thunk (Hashtbl.find binary_ops bin_op) ~default:(fun () _loc ->- ( [%expr Shape.Pointwise_bin],- Ast_builder.Default.pexp_extension ~loc- @@ Location.error_extensionf ~loc- "ppx_ocannl %%cd: expected a binary operator, one of: %s"- "+ (Add), - (Sub), * (Mul), / (Div), **(ToPowOf), -?/ (Relu_gate), -?^ \- (Satur01_gate), -/> (Arg2), < (Cmplt), = (Cmpeq), <> (Cmpne), || (Or), && \- (And), % (Mod), @^(Max), @- (Min), ^^^^ (threefry4x32)" ))+ ( [%expr Shape.Pointwise_bin],+ Ast_builder.Default.pexp_extension ~loc+ @@ Location.error_extensionf ~loc+ "ppx_ocannl %%cd: expected a binary operator, one of: %s"+ "+ (Add), - (Sub), * (Mul), / (Div), **(ToPowOf), -?/ (Relu_gate), -?^ \+ (Satur01_gate), -/> (Arg2), < (Cmplt), = (Cmpeq), <> (Cmpne), || (Or), && \+ (And), % (Mod), @^(Max), @- (Min), ^^^^ (threefry4x32)" ))inlet ternary_op tern_op =loc|> Option.value_or_thunk (Hashtbl.find ternary_ops tern_op) ~default:(fun () _loc ->- ( [%expr Shape.Pointwise_tern],- Ast_builder.Default.pexp_extension ~loc- @@ Location.error_extensionf ~loc- "ppx_ocannl %%cd: expected a ternary operator, one of: where, fma" ))+ ( [%expr Shape.Pointwise_tern],+ Ast_builder.Default.pexp_extension ~loc+ @@ Location.error_extensionf ~loc+ "ppx_ocannl %%cd: expected a ternary operator, one of: where, fma" ))in(* TODO: collapse these (code reuse) *)let process_assign_ternop ~accu_op ~lhs ~tern_op ~rhs1 ~rhs2 ~rhs3 ?projections ~proj_in_scope@@ -1306,10 +1306,10 @@ let translate ?ident_label (expr : expression) : result =let elements =expr :: List.map ~f:snd exprs|> List.map ~f:(function- | { pexp_desc = Pexp_constant (Pconst_string _); _ } as s -> s- | [%expr [%e? t].value] -> [%expr Ir.Tnode.debug_name [%e t].value]- | [%expr [%e? t].grad] -> [%expr Ir.Tnode.debug_name [%e t].value ^ ".grad"]- | t -> [%expr Ir.Tnode.debug_name [%e t].value])+ | { pexp_desc = Pexp_constant (Pconst_string _); _ } as s -> s+ | [%expr [%e? t].value] -> [%expr Ir.Tnode.debug_name [%e t].value]+ | [%expr [%e? t].grad] -> [%expr Ir.Tnode.debug_name [%e t].value ^ ".grad"]+ | t -> [%expr Ir.Tnode.debug_name [%e t].value])inlet res2 = loop ~proj_in_scope expr2 inlet block =@@ -1591,18 +1591,18 @@ let translate ?ident_label (expr : expression) : result =let proj_in_scope =proj_in_scope|| List.exists args ~f:(function- | { pparam_desc = Pparam_val ((Labelled s | Optional s), _, _); _ }- when String.equal s "projections" ->- true- | _ -> false)+ | { pparam_desc = Pparam_val ((Labelled s | Optional s), _, _); _ }+ when String.equal s "projections" ->+ true+ | _ -> false)inlet bad_pun_hints =Set.union_list (module String)@@ bad_pun_hints:: List.map args ~f:(fun arg ->- match arg.pparam_desc with- | Pparam_val (_, _, pat) -> collect_pat_idents pat- | _ -> Set.empty (module String))+ match arg.pparam_desc with+ | Pparam_val (_, _, pat) -> collect_pat_idents pat+ | _ -> Set.empty (module String))inlet result =match body withFile "arrayjit/lib/low_level.ml", line 1, characters 0-0:diff --git a/_build/default/arrayjit/lib/low_level.ml b/_build/default/arrayjit/lib/.formatted/low_level.mlindex 4e2ca58..41da273 100644--- a/_build/default/arrayjit/lib/low_level.ml+++ b/_build/default/arrayjit/lib/.formatted/low_level.ml@@ -372,7 +372,7 @@ let visit_llc traced_store ~merge_node_id reverse_node_map ~max_visits llc =if(not virtualize_settings.inline_complex_computations)|| Option.value_map access_pos ~default:true ~f:(fun pos ->- not ([%equal: int array] pos at_pos))+ not ([%equal: int array] pos at_pos))thenHashtbl.update traced.accesses at_pos~f:(visit ~is_assigned:(traced.zeroed_out || Hash_set.mem traced.assignments at_pos))@@ -712,11 +712,11 @@ let%track7_sexp inline_computation ~idlet computations =Hashtbl.find computations_table traced.tn|> Option.value_or_thunk ~default:(fun () ->- raise- @@ Utils.User_error- [%string- "Stale optimize_ctx: No computations found for #%{traced.tn.Tn.id#Int}: \- %{Tn.debug_name traced.tn}"])+ raise+ @@ Utils.User_error+ [%string+ "Stale optimize_ctx: No computations found for #%{traced.tn.Tn.id#Int}: \+ %{Tn.debug_name traced.tn}"])inlet body = List.rev_filter_map ~f:loop_proc computations inif List.is_empty body then raise @@ Non_virtual 14 else Some (unflat_lines body)dune build @fmt failed"/usr/bin/env" "bash" "-c" "opam exec -- dune build @fmt --ignore-promoted-rules || (echo "dune build @fmt failed"; exit 2)" failed with exit status 22025-11-15 14:43.37: Job failed: Failed: Build failed