2025-08-06 13:37.28: New job: test ahrefs/ocannl https://github.com/ahrefs/ocannl.git#refs/heads/master (f4a9bfc54f9447c02aa9fffba8b1ddd63a18e75a) (linux-x86_64:(lint-fmt)) Base: ocaml/opam:debian-12-ocaml-4.08@sha256:474656ea1593a299054f8966c700443fa0944c9534de3da94ca6dfab4a44c47a ocamlformat version: version 0.27.0 (from opam) To reproduce locally: git clone --recursive "https://github.com/ahrefs/ocannl.git" -b "master" && cd "ocannl" && git reset --hard f4a9bfc5 cat > Dockerfile <<'END-OF-DOCKERFILE' FROM ocaml/opam:debian-12-ocaml-4.08@sha256:474656ea1593a299054f8966c700443fa0944c9534de3da94ca6dfab4a44c47a USER 1000:1000 RUN cd ~/opam-repository && (git cat-file -e b8021439f8c57ba6435bc2263f6596671f4f4466 || git fetch origin master) && git reset -q --hard b8021439f8c57ba6435bc2263f6596671f4f4466 && git log --no-decorate -n1 --oneline && opam update -u RUN opam depext -i dune WORKDIR /src RUN opam depext -i ocamlformat=0.27.0 COPY --chown=1000:1000 . /src/ RUN opam exec -- dune build @fmt --ignore-promoted-rules || (echo "dune build @fmt failed"; exit 2) END-OF-DOCKERFILE docker build . END-REPRO-BLOCK 2025-08-06 13:37.28: Using cache hint "ahrefs/ocannl-ocaml/opam:debian-12-ocaml-4.08@sha256:474656ea1593a299054f8966c700443fa0944c9534de3da94ca6dfab4a44c47a-debian-12-4.08_opam-2.4-ocamlformat-b8021439f8c57ba6435bc2263f6596671f4f4466" 2025-08-06 13:37.28: Using OBuilder spec: ((from ocaml/opam:debian-12-ocaml-4.08@sha256:474656ea1593a299054f8966c700443fa0944c9534de3da94ca6dfab4a44c47a) (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 b8021439f8c57ba6435bc2263f6596671f4f4466 || git fetch origin master) && git reset -q --hard b8021439f8c57ba6435bc2263f6596671f4f4466 && 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.27.0")) (copy (src .) (dst /src/)) (run (shell "opam exec -- dune build @fmt --ignore-promoted-rules || (echo \"dune build @fmt failed\"; exit 2)")) ) 2025-08-06 13:37.28: Waiting for resource in pool OCluster 2025-08-06 13:37.28: Waiting for worker… 2025-08-06 13:39.36: Got resource from pool OCluster Building on toxis.caelum.ci.dev All commits already cached HEAD is now at f4a9bfc5 Arrrgh... bug fix to Utils.sorted_diff (from ocaml/opam:debian-12-ocaml-4.08@sha256:474656ea1593a299054f8966c700443fa0944c9534de3da94ca6dfab4a44c47a) 2025-08-06 13:40.29 ---> saved as "1d0024db739bd078f91b2384c47919652a4b72a425e3e24ce24cfd1f6debdfbc" /: (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 b8021439f8c57ba6435bc2263f6596671f4f4466 || git fetch origin master) && git reset -q --hard b8021439f8c57ba6435bc2263f6596671f4f4466 && git log --no-decorate -n1 --oneline && opam update -u")) b8021439f8 Merge pull request #28261 from kit-ty-kate/deploy-fix-25819 <><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> [default] Initialised default (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 environment 2025-08-06 13:42.41 ---> saved as "76d9d96bb26da3c78200d383fd35f876d80571baf05962331a1fff5f47db0e2e" /: (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 packages The following actions will be performed: - install dune 3.19.1 <><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><> [dune.3.19.1] found in cache <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed dune.3.19.1 Done. # Run eval $(opam env) to update the current shell environment 2025-08-06 13:43.37 ---> saved as "da0888a20a067de19f6183f0b497dcc2d1ea7f7036861cc50f633c662efdce4f" /: (workdir /src) /src: (run (cache (opam-archives (target /home/opam/.opam/download-cache))) (network host) (shell "opam depext -i ocamlformat=0.27.0")) # 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 packages The following actions will be performed: - install sexplib0 v0.14.0 [required by base] - install menhirLib 20240715 [required by ocamlformat-lib] - install menhirCST 20240715 [required by menhir] - install ocamlbuild 0.16.1 [required by fpath, astring, uuseg] - install cmdliner 1.3.0 [required by ocamlformat] - install menhirSdk 20240715 [required by ocamlformat-lib] - install either 1.0.0 [required by ocamlformat-lib] - install csexp 1.5.2 [required by ocamlformat] - install dune-build-info 3.19.1 [required by ocamlformat-lib] - install camlp-streams 5.0.1 [required by ocamlformat-lib] - install seq base [required by re] - install fix 20250428 [required by ocamlformat-lib] - install ocaml-version 4.0.1 [required by ocamlformat-lib] - install ocamlfind 1.9.8 [required by ocp-indent, astring, fpath, uuseg] - install menhir 20240715 [required by ocamlformat-lib] - install dune-configurator 3.19.1 [required by base] - install re 1.11.0 [required by ocamlformat] - install topkg 1.1.0 [required by fpath, astring, uuseg] - install base-bytes base [required by ocp-indent] - 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 ocp-indent 1.8.1 [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.27.0 [required by ocamlformat] - install ocamlformat 0.27.0 ===== 29 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.1.3.0] found in cache [csexp.1.5.2] found in cache [dune-build-info.3.19.1] found in cache [dune-configurator.3.19.1] found in cache [either.1.0.0] found in cache [fix.20250428] found in cache [fpath.0.7.3] found in cache [menhir.20240715] found in cache [menhirCST.20240715] found in cache [menhirLib.20240715] found in cache [menhirSdk.20240715] found in cache [ocaml-version.4.0.1] found in cache [ocamlbuild.0.16.1] found in cache [ocamlfind.1.9.8] found in cache [ocamlformat.0.27.0] found in cache [ocamlformat-lib.0.27.0] found in cache [ocp-indent.1.8.1] 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.0] 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.20250428 -> installed menhirCST.20240715 -> installed menhirLib.20240715 -> installed menhirSdk.20240715 -> installed cmdliner.1.3.0 -> installed ocaml-version.4.0.1 -> installed re.1.11.0 -> installed sexplib0.v0.14.0 -> installed dune-build-info.3.19.1 -> installed dune-configurator.3.19.1 -> installed ocamlfind.1.9.8 -> installed base-bytes.base -> installed ocp-indent.1.8.1 -> installed ocamlbuild.0.16.1 -> installed base.v0.14.3 -> installed stdio.v0.14.0 -> installed topkg.1.1.0 -> installed uutf.1.0.4 -> installed astring.0.8.5 -> installed fpath.0.7.3 -> installed menhir.20240715 -> installed uucp.15.0.0 -> installed uuseg.15.0.0 -> installed ocamlformat-lib.0.27.0 -> installed ocamlformat.0.27.0 Done. <><> ocp-indent.1.8.1 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 environment 2025-08-06 13:45.04 ---> saved as "86ec8dcb8046a1e5dacfb1841e8c026d30cfead67649bcb6d6a8f9ddd6fb153d" /src: (copy (src .) (dst /src/)) 2025-08-06 13:45.05 ---> saved as "e288b0ae344992230885f3fd5162d8d319e78dbe08e0256d4c029a33e6cd0985" /src: (run (shell "opam exec -- dune build @fmt --ignore-promoted-rules || (echo \"dune build @fmt failed\"; exit 2)")) File "arrayjit/bin/dune", line 6, characters 30-43: 6 | (pps ppx_here ppx_minidebug ppx_sexp_conv)) ^^^^^^^^^^^^^ Error: Library "ppx_sexp_conv" not found. -> required by _build/default/arrayjit/bin/read_config.exe -> required by %{dep:../../../arrayjit/bin/read_config.exe} at test/operations/dune:17 -> required by _build/default/test/operations/config/ocannl_backend.txt -> required by %{read:config/ocannl_backend.txt} at test/operations/dune:33 -> required by Computing directory contents of _build/default/test/operations File "arrayjit/bin/dune", line 6, characters 7-15: 6 | (pps ppx_here ppx_minidebug ppx_sexp_conv)) ^^^^^^^^ Error: Library "ppx_here" not found. -> required by _build/default/arrayjit/bin/.merlin-conf/exe-read_config -> required by _build/default/arrayjit/bin/read_config.exe -> required by %{dep:../../../arrayjit/bin/read_config.exe} at test/operations/dune:17 -> required by _build/default/test/operations/config/ocannl_backend.txt -> required by %{read:config/ocannl_backend.txt} at test/operations/dune:33 -> required by Computing directory contents of _build/default/test/operations File "datasets/half_moons.ml", line 1, characters 0-0: diff --git a/_build/default/datasets/half_moons.ml b/_build/default/datasets/.formatted/half_moons.ml index dea5c70..2256b9e 100644 --- a/_build/default/datasets/half_moons.ml +++ b/_build/default/datasets/.formatted/half_moons.ml @@ -51,7 +51,7 @@ let generate_with_kind kind ?(config = Config.default) ~len () = let c = Float.cos v and s = Float.sin v in let x = 1.0 -. c +. noise () in let y = 0.5 -. s +. noise () in - let idx = i * 2 + 1 in + let idx = (i * 2) + 1 in Genarray.set coordinates [| idx; 0 |] x; Genarray.set coordinates [| idx; 1 |] y; Genarray.set labels [| idx; 0 |] (-1.0) File "arrayjit/lib/builtins_cuda_large.ml", line 1, characters 0-0: diff --git a/_build/default/arrayjit/lib/builtins_cuda_large.ml b/_build/default/arrayjit/lib/.formatted/builtins_cuda_large.ml index 9f8e884..9a7add2 100644 --- a/_build/default/arrayjit/lib/builtins_cuda_large.ml +++ b/_build/default/arrayjit/lib/.formatted/builtins_cuda_large.ml @@ -1,4 +1,5 @@ -let source = {| +let source = + {| #include <cuda_runtime.h> #include <stdint.h> @@ -110,4 +111,4 @@ __device__ uint4x32_t arrayjit_threefry4x32_impl(uint4x32_t key, uint4x32_t coun __device__ uint4x32_t ( *arrayjit_threefry4x32)(uint4x32_t key, uint4x32_t counter) = arrayjit_threefry4x32_impl; -|} \ No newline at end of file +|} File "arrayjit/lib/builtins_cuda_small.ml", line 1, characters 0-0: diff --git a/_build/default/arrayjit/lib/builtins_cuda_small.ml b/_build/default/arrayjit/lib/.formatted/builtins_cuda_small.ml index 94b807a..f69f9fd 100644 --- a/_build/default/arrayjit/lib/builtins_cuda_small.ml +++ b/_build/default/arrayjit/lib/.formatted/builtins_cuda_small.ml @@ -1,4 +1,5 @@ -let source = {| +let source = + {| typedef struct { uint32_t v[4]; } uint4x32_t; @@ -182,4 +183,4 @@ __device__ uint8x16_t uint4x32_to_u8_uniform_vec(uint4x32_t x) { } return result; } -|} \ No newline at end of file +|} File "arrayjit/lib/builtins_metal.ml", line 1, characters 0-0: diff --git a/_build/default/arrayjit/lib/builtins_metal.ml b/_build/default/arrayjit/lib/.formatted/builtins_metal.ml index ae0e1b1..e87f3a5 100644 --- a/_build/default/arrayjit/lib/builtins_metal.ml +++ b/_build/default/arrayjit/lib/.formatted/builtins_metal.ml @@ -1,4 +1,5 @@ -let source = {| +let source = + {| #include <metal_stdlib> using namespace metal; @@ -369,4 +370,4 @@ uint4 half_to_uint4x32(uint16_t x) { uint4 fp8_to_uint4x32(uint8_t x) { return uint4(uint32_t(x), 0, 0, 0); } -|} \ No newline at end of file +|} File "lib/tensor.mli", line 1, characters 0-0: diff --git a/_build/default/lib/tensor.mli b/_build/default/lib/.formatted/tensor.mli index 1efc66c..5453647 100644 --- a/_build/default/lib/tensor.mli +++ b/_build/default/lib/.formatted/tensor.mli @@ -8,10 +8,7 @@ type tn_set = Set.M(Ir.Tnode).t type asgns = Ir.Assignments.t type comp = Ir.Assignments.comp type fetch_op = Ir.Assignments.fetch_op -type projections = { - projections_debug : string; - projections : Ir.Indexing.projections Lazy.t; -} +type projections = { projections_debug : string; projections : Ir.Indexing.projections Lazy.t } type diff = { grad : tn; File "test/training/moons_demo.ml", line 1, characters 0-0: diff --git a/_build/default/test/training/moons_demo.ml b/_build/default/test/training/.formatted/moons_demo.ml index 06554bb..2a10c7a 100644 --- a/_build/default/test/training/moons_demo.ml +++ b/_build/default/test/training/.formatted/moons_demo.ml @@ -29,7 +29,7 @@ let main () = let step_n, bindings = IDX.get_static_symbol bindings in let moons_flat = TDSL.rebatch ~l:"moons_flat" moons_flat_ndarray () in let moons_classes = TDSL.rebatch ~l:"moons_classes" moons_classes_ndarray () in - let%op mlp x = ("w3" * relu ("b2" 16 + ("w2" * relu ("b1" 16 + ("w1" * x))))) in + let%op mlp x = "w3" * relu ("b2" 16 + ("w2" * relu ("b1" 16 + ("w1" * x)))) in (* Don't decay the learning rate too quickly, it behaves better than in the original. *) let%op moons_input = moons_flat @| batch_n in let%op moons_class = moons_classes @| batch_n in File "arrayjit/lib/assignments.ml", line 1, characters 0-0: diff --git a/_build/default/arrayjit/lib/assignments.ml b/_build/default/arrayjit/lib/.formatted/assignments.ml index c8d6476..ddfafe2 100644 --- a/_build/default/arrayjit/lib/assignments.ml +++ b/_build/default/arrayjit/lib/.formatted/assignments.ml @@ -111,10 +111,11 @@ let%debug3_sexp context_nodes ~(use_host_memory : 'a option) (asgns : t) : Tn.t_ | Seq (t1, t2) -> loop t1 + loop t2 | Block_comment (_, t) -> loop t | Accum_op { lhs; rhs; _ } -> - let rhses = match rhs with - | Unop { rhs; _ } -> [ of_node rhs ] - | Binop { rhs1; rhs2; _ } -> [ of_node rhs1; of_node rhs2 ] - | Ternop { rhs1; rhs2; rhs3; _ } -> [ of_node rhs1; of_node rhs2; of_node rhs3 ] + let rhses = + match rhs with + | Unop { rhs; _ } -> [ of_node rhs ] + | Binop { rhs1; rhs2; _ } -> [ of_node rhs1; of_node rhs2 ] + | Ternop { rhs1; rhs2; rhs3; _ } -> [ of_node rhs1; of_node rhs2; of_node rhs3 ] in Set.union_list (module Tn) (one lhs :: rhses) | Set_vec_unop { lhs; rhs; _ } -> Set.union (one lhs) (of_node rhs) @@ -136,10 +137,11 @@ let%debug3_sexp guess_output_nodes (asgns : t) : Tn.t_set = (i1 + i2, o1 + o2 - (i1 + i2)) | Block_comment (_, t) -> loop t | Accum_op { lhs; rhs; _ } -> - let inputs = match rhs with - | Unop { rhs; _ } -> of_node rhs - | Binop { rhs1; rhs2; _ } -> of_node rhs1 + of_node rhs2 - | Ternop { rhs1; rhs2; rhs3; _ } -> of_node rhs1 + of_node rhs2 + of_node rhs3 + let inputs = + match rhs with + | Unop { rhs; _ } -> of_node rhs + | Binop { rhs1; rhs2; _ } -> of_node rhs1 + of_node rhs2 + | Ternop { rhs1; rhs2; rhs3; _ } -> of_node rhs1 + of_node rhs2 + of_node rhs3 in (inputs, one lhs) | Set_vec_unop { lhs; rhs; _ } -> (of_node rhs, one lhs) @@ -250,10 +252,11 @@ let%track4_sexp to_low_level code = and loop (code : t) : Low_level.t = match code with | Accum_op { initialize_neutral; accum; lhs; rhs; projections; _ } -> - let op, rhses = match rhs with - | Unop { op; rhs } -> (Ops.Unop op, [| rhs |]) - | Binop { op; rhs1; rhs2 } -> (Ops.Binop op, [| rhs1; rhs2 |]) - | Ternop { op; rhs1; rhs2; rhs3 } -> (Ops.Ternop op, [| rhs1; rhs2; rhs3 |]) + let op, rhses = + match rhs with + | Unop { op; rhs } -> (Ops.Unop op, [| rhs |]) + | Binop { op; rhs1; rhs2 } -> (Ops.Binop op, [| rhs1; rhs2 |]) + | Ternop { op; rhs1; rhs2; rhs3 } -> (Ops.Ternop op, [| rhs1; rhs2; rhs3 |]) in loop_accum ~initialize_neutral ~accum ~op ~lhs ~rhses projections | Set_vec_unop { op; lhs; rhs; projections; _ } -> @@ -390,13 +393,15 @@ let get_ident_within_code ?no_dots c = loop c2 | Block_comment (_, c) -> loop c | Accum_op { lhs; rhs; _ } -> - let rhses = match rhs with - | Unop { rhs; _ } -> [ tn rhs ] - | Binop { rhs1; rhs2; _ } -> [ tn rhs1; tn rhs2 ] - | Ternop { rhs1; rhs2; rhs3; _ } -> [ tn rhs1; tn rhs2; tn rhs3 ] + let rhses = + match rhs with + | Unop { rhs; _ } -> [ tn rhs ] + | Binop { rhs1; rhs2; _ } -> [ tn rhs1; tn rhs2 ] + | Ternop { rhs1; rhs2; rhs3; _ } -> [ tn rhs1; tn rhs2; tn rhs3 ] in List.iter ~f:visit (lhs :: rhses) - | Set_vec_unop { op = _; lhs; rhs; projections = _; projections_debug = _ } -> List.iter ~f:visit [ lhs; tn rhs ] + | Set_vec_unop { op = _; lhs; rhs; projections = _; projections_debug = _ } -> + List.iter ~f:visit [ lhs; tn rhs ] | Fetch { array; fetch_op = _; dims = _ } -> visit array in loop c; @@ -437,9 +442,9 @@ let to_doc ?name ?static_indices () c = | Seq (c1, c2) -> doc_of_code c1 ^^ doc_of_code c2 | Block_comment (s, Noop) -> string ("# \"" ^ s ^ "\";") ^^ break 1 | Block_comment (s, c) -> string ("# \"" ^ s ^ "\";") ^^ break 1 ^^ doc_of_code c - | Accum_op { initialize_neutral; accum; lhs; rhs; projections_debug; _ } -> + | Accum_op { initialize_neutral; accum; lhs; rhs; projections_debug; _ } -> ( let proj_spec = projections_debug in - (match rhs with + match rhs with | Ternop { op; rhs1; rhs2; rhs3 } -> (* Uncurried syntax for ternary operations. *) string (ident lhs) @@ -485,8 +490,7 @@ let to_doc ?name ?static_indices () c = else empty) ^^ string ";" ^^ break 1) | Set_vec_unop { op; lhs; rhs; projections = _; projections_debug } -> - let proj_spec = projections_debug - in + let proj_spec = projections_debug in string (ident lhs) ^^ space ^^ string (Ops.assign_op_cd_syntax ~initialize_neutral:false Arg2) File "lib/train.ml", line 1, characters 0-0: diff --git a/_build/default/lib/train.ml b/_build/default/lib/.formatted/train.ml index 93053a1..6b779a1 100644 --- a/_build/default/lib/train.ml +++ b/_build/default/lib/.formatted/train.ml @@ -549,9 +549,7 @@ let%track3_sexp run_once ?(hosted = true) ?(skip_init = false) ?reinit_all if skip_init || Set.is_empty t.params then ctx else init_params (module Backend) ~ctx ~hosted ?reinit_all bindings t in - let routine = - Backend.(link ctx @@ compile ctx.optimize_ctx bindings update) - in + let routine = Backend.(link ctx @@ compile ctx.optimize_ctx bindings update) in Task.run routine.schedule; routine.context File "lib/ppx_cd.ml", line 1, characters 0-0: diff --git a/_build/default/lib/ppx_cd.ml b/_build/default/lib/.formatted/ppx_cd.ml index 9017d8a..774da25 100644 --- a/_build/default/lib/ppx_cd.ml +++ b/_build/default/lib/.formatted/ppx_cd.ml @@ -458,7 +458,8 @@ let translate (expr : expression) : result = let initialize_neutral = if initialize_neutral then [%expr true] else [%expr false] in let projections_lazy, projections_debug = match projections with - | Some prjs -> ([%expr [%e prjs].Tensor.projections], [%expr [%e prjs].Tensor.projections_debug]) + | Some prjs -> + ([%expr [%e prjs].Tensor.projections], [%expr [%e prjs].Tensor.projections_debug]) | None -> let lhs_dims = project_p_dims "LHS" lhs.pexp_loc setup_l.slot in let rhs1_dims = project_p_dims "RHS1" lhs.pexp_loc setup_r1.slot in @@ -468,27 +469,29 @@ let translate (expr : expression) : result = let project_rhs1 = project_p_slot "RHS1" rhs1.pexp_loc setup_r1.slot in let project_rhs2 = project_p_slot "RHS2" rhs2.pexp_loc setup_r2.slot in let project_rhs3 = project_p_slot "RHS3" rhs3.pexp_loc setup_r3.slot in - let proj_lazy = [%expr - lazy - (let p = Lazy.force projections.Tensor.projections in - Ir.Indexing. - { - product_space = p.product_space; - product_iterators = p.product_iterators; - lhs_dims = [%e lhs_dims]; - rhs_dims = [| [%e rhs1_dims]; [%e rhs2_dims]; [%e rhs3_dims] |]; - project_lhs = [%e project_lhs]; - project_rhs = [| [%e project_rhs1]; [%e project_rhs2]; [%e project_rhs3] |]; - debug_info = - { - p.debug_info with - trace = - ( "ppx_cd " ^ [%e expr2string_or_empty accu_op] ^ " " - ^ [%e expr2string_or_empty tern_op], - Ir.Indexing.unique_debug_id () ) - :: p.debug_info.trace; - }; - })] in + let proj_lazy = + [%expr + lazy + (let p = Lazy.force projections.Tensor.projections in + Ir.Indexing. + { + product_space = p.product_space; + product_iterators = p.product_iterators; + lhs_dims = [%e lhs_dims]; + rhs_dims = [| [%e rhs1_dims]; [%e rhs2_dims]; [%e rhs3_dims] |]; + project_lhs = [%e project_lhs]; + project_rhs = [| [%e project_rhs1]; [%e project_rhs2]; [%e project_rhs3] |]; + debug_info = + { + p.debug_info with + trace = + ( "ppx_cd " ^ [%e expr2string_or_empty accu_op] ^ " " + ^ [%e expr2string_or_empty tern_op], + Ir.Indexing.unique_debug_id () ) + :: p.debug_info.trace; + }; + })] + in (proj_lazy, [%expr projections.Tensor.projections_debug]) in (* FIXME: might be better to treat missing [rhs1, rhs2, rhs3] as zeros or errors rather than @@ -521,7 +524,8 @@ let translate (expr : expression) : result = let initialize_neutral = if initialize_neutral then [%expr true] else [%expr false] in let projections_lazy, projections_debug = match projections with - | Some prjs -> ([%expr [%e prjs].Tensor.projections], [%expr [%e prjs].Tensor.projections_debug]) + | Some prjs -> + ([%expr [%e prjs].Tensor.projections], [%expr [%e prjs].Tensor.projections_debug]) | None -> let lhs_dims = project_p_dims "LHS" lhs.pexp_loc setup_l.slot in let rhs1_dims = project_p_dims "RHS1" lhs.pexp_loc setup_r1.slot in @@ -529,27 +533,29 @@ let translate (expr : expression) : result = let project_lhs = project_p_slot "LHS" lhs.pexp_loc setup_l.slot in let project_rhs1 = project_p_slot "RHS1" rhs1.pexp_loc setup_r1.slot in let project_rhs2 = project_p_slot "RHS2" rhs2.pexp_loc setup_r2.slot in - let proj_lazy = [%expr - lazy - (let p = Lazy.force projections.Tensor.projections in - Ir.Indexing. - { - product_space = p.product_space; - product_iterators = p.product_iterators; - lhs_dims = [%e lhs_dims]; - rhs_dims = [| [%e rhs1_dims]; [%e rhs2_dims] |]; - project_lhs = [%e project_lhs]; - project_rhs = [| [%e project_rhs1]; [%e project_rhs2] |]; - debug_info = - { - p.debug_info with - trace = - ( "ppx_cd " ^ [%e expr2string_or_empty accu_op] ^ " " - ^ [%e expr2string_or_empty bin_op], - Ir.Indexing.unique_debug_id () ) - :: p.debug_info.trace; - }; - })] in + let proj_lazy = + [%expr + lazy + (let p = Lazy.force projections.Tensor.projections in + Ir.Indexing. + { + product_space = p.product_space; + product_iterators = p.product_iterators; + lhs_dims = [%e lhs_dims]; + rhs_dims = [| [%e rhs1_dims]; [%e rhs2_dims] |]; + project_lhs = [%e project_lhs]; + project_rhs = [| [%e project_rhs1]; [%e project_rhs2] |]; + debug_info = + { + p.debug_info with + trace = + ( "ppx_cd " ^ [%e expr2string_or_empty accu_op] ^ " " + ^ [%e expr2string_or_empty bin_op], + Ir.Indexing.unique_debug_id () ) + :: p.debug_info.trace; + }; + })] + in (proj_lazy, [%expr projections.Tensor.projections_debug]) in (* TODO: might be better to treat missing [rhs1, rhs2] as zeros or errors rather than eliding @@ -582,33 +588,36 @@ let translate (expr : expression) : result = let initialize_neutral = if initialize_neutral then [%expr true] else [%expr false] in let projections_lazy, projections_debug = match projections with - | Some prjs -> ([%expr [%e prjs].Tensor.projections], [%expr [%e prjs].Tensor.projections_debug]) + | Some prjs -> + ([%expr [%e prjs].Tensor.projections], [%expr [%e prjs].Tensor.projections_debug]) | None -> let lhs_dims = project_p_dims "LHS" lhs.pexp_loc setup_l.slot in let rhs1_dims = project_p_dims "RHS1" lhs.pexp_loc setup_r.slot in let project_lhs = project_p_slot "LHS" lhs.pexp_loc setup_l.slot in let project_rhs1 = project_p_slot "RHS1" rhs.pexp_loc setup_r.slot in - let proj_lazy = [%expr - lazy - (let p = Lazy.force projections.Tensor.projections in - Ir.Indexing. - { - product_space = p.product_space; - product_iterators = p.product_iterators; - lhs_dims = [%e lhs_dims]; - rhs_dims = [| [%e rhs1_dims] |]; - project_lhs = [%e project_lhs]; - project_rhs = [| [%e project_rhs1] |]; - debug_info = - { - p.debug_info with - trace = - ( "ppx_cd " ^ [%e string_expr ~loc accu_op] ^ " " - ^ [%e string_expr ~loc un_op], - Ir.Indexing.unique_debug_id () ) - :: p.debug_info.trace; - }; - })] in + let proj_lazy = + [%expr + lazy + (let p = Lazy.force projections.Tensor.projections in + Ir.Indexing. + { + product_space = p.product_space; + product_iterators = p.product_iterators; + lhs_dims = [%e lhs_dims]; + rhs_dims = [| [%e rhs1_dims] |]; + project_lhs = [%e project_lhs]; + project_rhs = [| [%e project_rhs1] |]; + debug_info = + { + p.debug_info with + trace = + ( "ppx_cd " ^ [%e string_expr ~loc accu_op] ^ " " + ^ [%e string_expr ~loc un_op], + Ir.Indexing.unique_debug_id () ) + :: p.debug_info.trace; + }; + })] + in (proj_lazy, [%expr projections.Tensor.projections_debug]) in (* TODO: might be better to treat missing [rhs] as zeros or errors rather than eliding the @@ -636,32 +645,35 @@ let translate (expr : expression) : result = let setup_r = setup_array ~punned ~bad_pun_hints ~is_lhs:false @@ loop ~proj_in_scope rhs in let projections_lazy, projections_debug = match projections with - | Some prjs -> ([%expr [%e prjs].Tensor.projections], [%expr [%e prjs].Tensor.projections_debug]) + | Some prjs -> + ([%expr [%e prjs].Tensor.projections], [%expr [%e prjs].Tensor.projections_debug]) | None -> let lhs_dims = project_p_dims "LHS" lhs.pexp_loc setup_l.slot in let rhs1_dims = project_p_dims "RHS1" lhs.pexp_loc setup_r.slot in let project_lhs = project_p_slot "LHS" lhs.pexp_loc setup_l.slot in let project_rhs1 = project_p_slot "RHS1" rhs.pexp_loc setup_r.slot in - let proj_lazy = [%expr - lazy - (let p = Lazy.force projections.Tensor.projections in - Ir.Indexing. - { - product_space = p.product_space; - product_iterators = p.product_iterators; - lhs_dims = [%e lhs_dims]; - rhs_dims = [| [%e rhs1_dims] |]; - project_lhs = [%e project_lhs]; - project_rhs = [| [%e project_rhs1] |]; - debug_info = - { - p.debug_info with - trace = - ( "ppx_cd vec " ^ [%e string_expr ~loc vec_un_op], - Ir.Indexing.unique_debug_id () ) - :: p.debug_info.trace; - }; - })] in + let proj_lazy = + [%expr + lazy + (let p = Lazy.force projections.Tensor.projections in + Ir.Indexing. + { + product_space = p.product_space; + product_iterators = p.product_iterators; + lhs_dims = [%e lhs_dims]; + rhs_dims = [| [%e rhs1_dims] |]; + project_lhs = [%e project_lhs]; + project_rhs = [| [%e project_rhs1] |]; + debug_info = + { + p.debug_info with + trace = + ( "ppx_cd vec " ^ [%e string_expr ~loc vec_un_op], + Ir.Indexing.unique_debug_id () ) + :: p.debug_info.trace; + }; + })] + in (proj_lazy, [%expr projections.Tensor.projections_debug]) in let body = @@ -669,7 +681,13 @@ let translate (expr : expression) : result = Option.value ~default:Ir.Assignments.Noop @@ Option.map2 [%e setup_l.array_opt] [%e setup_r.array_opt] ~f:(fun lhs rhs -> Ir.Assignments.Set_vec_unop - { lhs; op = [%e op]; rhs; projections = [%e projections_lazy]; projections_debug = [%e projections_debug] })] + { + lhs; + op = [%e op]; + rhs; + projections = [%e projections_lazy]; + projections_debug = [%e projections_debug]; + })] in assignment ~punned ~lhs:setup_l ~rhses:[ setup_r ] body in @@ -1208,7 +1226,9 @@ let translate (expr : expression) : result = let res1 = loop ~proj_in_scope expr1 in let res2 = loop ~proj_in_scope expr2 in let res3 = loop ~proj_in_scope expr3 in - let slot = List.hd_exn @@ List.sort [ res1.slot; res2.slot; res3.slot ] ~compare:compare_slots in + let slot = + List.hd_exn @@ List.sort [ res1.slot; res2.slot; res3.slot ] ~compare:compare_slots + in { vbs = reduce_vbss [ res1.vbs; res2.vbs; res3.vbs ]; typ = res1.typ; File "lib/tensor.ml", line 1, characters 0-0: diff --git a/_build/default/lib/tensor.ml b/_build/default/lib/.formatted/tensor.ml index 26064b1..4aaace3 100644 --- a/_build/default/lib/tensor.ml +++ b/_build/default/lib/.formatted/tensor.ml @@ -11,10 +11,7 @@ type tn_set = Set.M(Tn).t type asgns = Asgns.t type comp = Asgns.comp type fetch_op = Asgns.fetch_op -type projections = { - projections_debug : string; - projections : Ir.Indexing.projections Lazy.t; -} +type projections = { projections_debug : string; projections : Ir.Indexing.projections Lazy.t } let _get_local_debug_runtime = Utils.get_local_debug_runtime @@ -165,16 +162,23 @@ let raw_binop ~initialize_neutral ~accum ~(t : t) ~(lhs_is_grad : bool) ~op ~(t1 let local_shape_update = Shape.{ shape; logic = shape_logic; id = get_update_id () } in Shape.propagate_shapes local_shape_update; let projections_debug = Shape.logic_to_spec shape_logic in - let projections = { - projections_debug; - projections = lazy (Shape.derive_projections local_shape_update); - } in + let projections = + { projections_debug; projections = lazy (Shape.derive_projections local_shape_update) } + in let lhs = if lhs_is_grad then (Option.value_exn ~here:[%here] t.diff).grad else t.value in let rhs1 = if rhs1_is_grad then (Option.value_exn ~here:[%here] t1.diff).grad else t1.value in let rhs1 = if rhs1_is_merge then Asgns.Merge_buffer rhs1 else Node rhs1 in let rhs2 = if rhs2_is_grad then (Option.value_exn ~here:[%here] t2.diff).grad else t2.value in let rhs2 = if rhs2_is_merge then Asgns.Merge_buffer rhs2 else Node rhs2 in - Asgns.Accum_op { initialize_neutral; accum; lhs; rhs = Binop { op; rhs1; rhs2 }; projections = projections.projections; projections_debug = projections.projections_debug } + Asgns.Accum_op + { + initialize_neutral; + accum; + lhs; + rhs = Binop { op; rhs1; rhs2 }; + projections = projections.projections; + projections_debug = projections.projections_debug; + } let raw_ternop ~initialize_neutral ~accum ~(t : t) ~(lhs_is_grad : bool) ~op ~(t1 : t) ~(rhs1_is_grad : bool) ~(rhs1_is_merge : bool) ~(t2 : t) ~rhs2_is_grad ~rhs2_is_merge ~(t3 : t) @@ -184,10 +188,9 @@ let raw_ternop ~initialize_neutral ~accum ~(t : t) ~(lhs_is_grad : bool) ~op ~(t let local_shape_update = Shape.{ shape; logic = shape_logic; id = get_update_id () } in Shape.propagate_shapes local_shape_update; let projections_debug = Shape.logic_to_spec shape_logic in - let projections = { - projections_debug; - projections = lazy (Shape.derive_projections local_shape_update); - } in + let projections = + { projections_debug; projections = lazy (Shape.derive_projections local_shape_update) } + in let lhs = if lhs_is_grad then (Option.value_exn ~here:[%here] t.diff).grad else t.value in let rhs1 = if rhs1_is_grad then (Option.value_exn ~here:[%here] t1.diff).grad else t1.value in let rhs1 = if rhs1_is_merge then Asgns.Merge_buffer rhs1 else Node rhs1 in @@ -195,7 +198,15 @@ let raw_ternop ~initialize_neutral ~accum ~(t : t) ~(lhs_is_grad : bool) ~op ~(t let rhs2 = if rhs2_is_merge then Asgns.Merge_buffer rhs2 else Node rhs2 in let rhs3 = if rhs3_is_grad then (Option.value_exn ~here:[%here] t3.diff).grad else t3.value in let rhs3 = if rhs3_is_merge then Asgns.Merge_buffer rhs3 else Node rhs3 in - Asgns.Accum_op { initialize_neutral; accum; lhs; rhs = Ternop { op; rhs1; rhs2; rhs3 }; projections = projections.projections; projections_debug = projections.projections_debug } + Asgns.Accum_op + { + initialize_neutral; + accum; + lhs; + rhs = Ternop { op; rhs1; rhs2; rhs3 }; + projections = projections.projections; + projections_debug = projections.projections_debug; + } let raw_unop ~initialize_neutral ~accum ~(t : t) ~(lhs_is_grad : bool) ~op ~(t1 : t) ~(rhs_is_grad : bool) ~(rhs_is_merge : bool) ~logic = @@ -204,14 +215,21 @@ let raw_unop ~initialize_neutral ~accum ~(t : t) ~(lhs_is_grad : bool) ~op ~(t1 let local_shape_update = Shape.{ shape; logic = shape_logic; id = get_update_id () } in Shape.propagate_shapes local_shape_update; let projections_debug = Shape.logic_to_spec shape_logic in - let projections = { - projections_debug; - projections = lazy (Shape.derive_projections local_shape_update); - } in + let projections = + { projections_debug; projections = lazy (Shape.derive_projections local_shape_update) } + in let lhs = if lhs_is_grad then (Option.value_exn ~here:[%here] t.diff).grad else t.value in let rhs = if rhs_is_grad then (Option.value_exn ~here:[%here] t1.diff).grad else t1.value in let rhs = if rhs_is_merge then Asgns.Merge_buffer rhs else Node rhs in - Asgns.Accum_op { initialize_neutral; accum; lhs; rhs = Unop { op; rhs }; projections = projections.projections; projections_debug = projections.projections_debug } + Asgns.Accum_op + { + initialize_neutral; + accum; + lhs; + rhs = Unop { op; rhs }; + projections = projections.projections; + projections_debug = projections.projections_debug; + } type grad_spec = Require_grad | Prohibit_grad | If_needed [@@deriving sexp, equal, variants] @@ -281,10 +299,9 @@ let%track7_sexp op ~(label : string list) ?(ternary_op = Shape.Pointwise_tern) List.iter ~f:Shape.propagate_shapes local_shape_updates; let shape_update = List.hd_exn local_shape_updates in let projections_debug = Shape.logic_to_spec shape_update.logic in - let projections = { - projections_debug; - projections = lazy (Shape.derive_projections shape_update); - } in + let projections = + { projections_debug; projections = lazy (Shape.derive_projections shape_update) } + in let embedded_nodes = ref @@ Set.singleton (module Tn) v in let children = List.folding_map orig_ts 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 2 2025-08-06 13:45.07: Job failed: Failed: Build failed