Organisationsahrefsocannle89f04 ()(lint-fmt)

(lint-fmt)

Link Copied
Code Copied

Logs

2025-07-26 19:16.57: New job: test ahrefs/ocannl https://github.com/ahrefs/ocannl.git#refs/heads/master (e89f0484ebab01f6c987bc207739a6225e23af15) (linux-x86_64:(lint-fmt))
Base: ocaml/opam:debian-12-ocaml-4.08@sha256:4b3e5b2d1be26cada6c08f752ca0b48d3b0ba20fec23648d53395a83f1ae2517
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 e89f0484
cat > Dockerfile <<'END-OF-DOCKERFILE'
FROM ocaml/opam:debian-12-ocaml-4.08@sha256:4b3e5b2d1be26cada6c08f752ca0b48d3b0ba20fec23648d53395a83f1ae2517
USER 1000:1000
RUN cd ~/opam-repository && (git cat-file -e 0eea63ad71af2b1116c556023bedc6bf083e6125 || git fetch origin master) && git reset -q --hard 0eea63ad71af2b1116c556023bedc6bf083e6125 && 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-07-26 19:16.57: Using cache hint "ahrefs/ocannl-ocaml/opam:debian-12-ocaml-4.08@sha256:4b3e5b2d1be26cada6c08f752ca0b48d3b0ba20fec23648d53395a83f1ae2517-debian-12-4.08_opam-2.3-ocamlformat-0eea63ad71af2b1116c556023bedc6bf083e6125"
2025-07-26 19:16.57: Using OBuilder spec:
((from ocaml/opam:debian-12-ocaml-4.08@sha256:4b3e5b2d1be26cada6c08f752ca0b48d3b0ba20fec23648d53395a83f1ae2517)
(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 0eea63ad71af2b1116c556023bedc6bf083e6125 || git fetch origin master) && git reset -q --hard 0eea63ad71af2b1116c556023bedc6bf083e6125 && 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-07-26 19:16.57: Waiting for resource in pool OCluster
2025-07-26 19:16.57: Waiting for worker…
2025-07-26 19:16.57: Got resource from pool OCluster
Building on toxis.caelum.ci.dev
HEAD is now at c8d36d2c Second pass on adding vector-returning operations: cleanup and locating unfinished places
HEAD is now at e89f0484 Third pass on adding vector-returning operations, by Claude Opus: missing vector types and backend operation implementations


(from ocaml/opam:debian-12-ocaml-4.08@sha256:4b3e5b2d1be26cada6c08f752ca0b48d3b0ba20fec23648d53395a83f1ae2517)
2025-07-26 19:16.58 ---> using "6cffc1a1a52caf2843bd473effea9756e568737c821ae9874d1cb7264a14fd20" 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 0eea63ad71af2b1116c556023bedc6bf083e6125 || git fetch origin master) && git reset -q --hard 0eea63ad71af2b1116c556023bedc6bf083e6125 && git log --no-decorate -n1 --oneline && opam update -u"))
0eea63ad71 Merge pull request #27946 from mtelvers/opam-publish-ocaml-version.4.0.1


<><> 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-07-26 19:16.58 ---> using "302b09a07f3e63cf843954026241e2145dcd9d48aa46e6f73f5e6c2a8313c3c9" from cache


/: (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-07-26 19:16.58 ---> using "cea7a1b4577ed221adf5a742377b6f150ff7832adb27838f80bf4faa7e02e12f" from cache


/: (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 cmdliner          1.3.0    [required by ocamlformat]
- install menhirLib         20240715 [required by ocamlformat-lib]
- install menhirCST         20240715 [required by menhir]
- install ocamlbuild        0.16.1   [required by fpath, astring, uuseg]
- install dune-build-info   3.19.1   [required by ocamlformat-lib]
- install menhirSdk         20240715 [required by ocamlformat-lib]
- install either            1.0.0    [required by ocamlformat-lib]
- install ocaml-version     4.0.1    [required by ocamlformat-lib]
- install camlp-streams     5.0.1    [required by ocamlformat-lib]
- install csexp             1.5.2    [required by ocamlformat]
- install seq               base     [required by re]
- install fix               20250428 [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.0.8    [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.0.8] 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 cmdliner.1.3.0
-> installed menhirCST.20240715
-> installed menhirLib.20240715
-> installed menhirSdk.20240715
-> 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 topkg.1.0.8
-> installed stdio.v0.14.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-07-26 19:16.58 ---> using "77996898021cad247d81d8eceeba4066a697607f4a9fdc67bee5a3313579cd44" from cache


/src: (copy (src .) (dst /src/))
2025-07-26 19:16.58 ---> saved as "64379829f2cc442d1c3a810e0f3ae404d76593cdb89e0e5f3d5a83d7004bb853"


/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 "arrayjit/lib/dune", line 1, characters 0-0:
diff --git a/_build/default/arrayjit/lib/dune b/_build/default/arrayjit/lib/.formatted/dune
index af3ed76..b4664ca 100644
--- a/_build/default/arrayjit/lib/dune
+++ b/_build/default/arrayjit/lib/.formatted/dune
@@ -90,7 +90,6 @@
ppx_variants_conv
ppx_minidebug)))


-
(library
(name backends)
(public_name arrayjit.backends)
File "arrayjit/lib/low_level.mli", line 1, characters 0-0:
diff --git a/_build/default/arrayjit/lib/low_level.mli b/_build/default/arrayjit/lib/.formatted/low_level.mli
index 62c5e4c..68b540e 100644
--- a/_build/default/arrayjit/lib/low_level.mli
+++ b/_build/default/arrayjit/lib/.formatted/low_level.mli
@@ -24,8 +24,20 @@ type t =
| Seq of t * t
| For_loop of { index : Indexing.symbol; from_ : int; to_ : int; body : t; trace_it : bool }
| Zero_out of Tnode.t
-  | Set of { tn : Tnode.t; idcs : Indexing.axis_index array; llsc : scalar_t; mutable debug : string }
-  | Set_from_vec of { tn : Tnode.t; idcs : Indexing.axis_index array; length : int; vec_unop : Ops.vec_unop; arg : scalar_t; mutable debug : string }
+  | Set of {
+      tn : Tnode.t;
+      idcs : Indexing.axis_index array;
+      llsc : scalar_t;
+      mutable debug : string;
+    }
+  | Set_from_vec of {
+      tn : Tnode.t;
+      idcs : Indexing.axis_index array;
+      length : int;
+      vec_unop : Ops.vec_unop;
+      arg : scalar_t;
+      mutable debug : string;
+    }
| Set_local of scope_id * scalar_t
[@@deriving sexp_of, equal]


File "bin/micrograd_demo_logging.ml", line 1, characters 0-0:
diff --git a/_build/default/bin/micrograd_demo_logging.ml b/_build/default/bin/.formatted/micrograd_demo_logging.ml
index 491ee09..26a32de 100644
--- a/_build/default/bin/micrograd_demo_logging.ml
+++ b/_build/default/bin/.formatted/micrograd_demo_logging.ml
@@ -33,8 +33,6 @@ let () =
let _suspended () =
Tensor.unsafe_reinitialize ();
let module Backend = (val Backends.fresh_backend ()) in
-
-
let%op c = "a" [ -4 ] + "b" [ 2 ] in
let%op d = (a *. b) + (b **. 3) in
let%op c = c + c + 1 in
File "arrayjit/lib/backend_impl.ml", line 1, characters 0-0:
diff --git a/_build/default/arrayjit/lib/backend_impl.ml b/_build/default/arrayjit/lib/.formatted/backend_impl.ml
index 933a900..8ca2891 100644
--- a/_build/default/arrayjit/lib/backend_impl.ml
+++ b/_build/default/arrayjit/lib/.formatted/backend_impl.ml
@@ -50,9 +50,7 @@ module No_device_buffer_and_copying () :


let%track7_sexp alloc_zero_init_array (prec : Ops.prec) ~(dims : int array) (() : unit) :
buffer_ptr =
-    let size_in_bytes =
-      (Array.fold dims ~init:1 ~f:( * )) * Ops.prec_in_bytes prec
-    in
+    let size_in_bytes = Array.fold dims ~init:1 ~f:( * ) * Ops.prec_in_bytes prec in
alloc_impl ~size_in_bytes


let%track7_sexp alloc_buffer ?(old_buffer : buffer_ptr Backend_intf.buffer option)
File "bin/einsum_trivia.ml", line 1, characters 0-0:
diff --git a/_build/default/bin/einsum_trivia.ml b/_build/default/bin/.formatted/einsum_trivia.ml
index e71ad80..41db8f1 100644
--- a/_build/default/bin/einsum_trivia.ml
+++ b/_build/default/bin/.formatted/einsum_trivia.ml
@@ -25,11 +25,10 @@ let _suspended () =
and type event = Backend.event
and type optimize_ctx = Backend.optimize_ctx)
in
-
-
+
let hey = TDSL.range_of_shape ~batch_dims:[ 2 ] ~input_dims:[ 3 ] ~output_dims:[ 4 ] () in
let%op _ho = hey ++ "b|i->o => o|b->i" in
-
+
let hey2 =
TDSL.range_of_shape ~batch_dims:[ 2; 3 ] ~input_dims:[ 4; 5 ] ~output_dims:[ 6; 7 ] ()
in
@@ -48,8 +47,7 @@ let () =
and type event = Backend.event
and type optimize_ctx = Backend.optimize_ctx)
in
-
-
+
let a = TDSL.range_of_shape ~batch_dims:[ 2 ] ~input_dims:[ 3 ] ~output_dims:[ 4 ] () in
let b = TDSL.range_of_shape ~batch_dims:[ 2 ] ~input_dims:[ 4 ] ~output_dims:[ 5 ] () in
let%op _ = a *+ "b|i->o; b|i->o => b|i->o" a in
File "bin/hello_world.ml", line 1, characters 0-0:
diff --git a/_build/default/bin/hello_world.ml b/_build/default/bin/.formatted/hello_world.ml
index 8dcf924..2973452 100644
--- a/_build/default/bin/hello_world.ml
+++ b/_build/default/bin/.formatted/hello_world.ml
@@ -10,8 +10,6 @@ module type Backend = Ir.Backend_intf.Backend


let hello1 () =
let module Backend = (val Backends.fresh_backend ()) in
-
-
let open Operation.TDSL in
(* Hey is inferred to be a matrix. *)
let hey = range_of_shape ~batch_dims:[ 7 ] ~input_dims:[ 9; 10; 11 ] ~output_dims:[ 13; 14 ] () in
@@ -24,8 +22,6 @@ let hello1 () =


let hello2 () =
let module Backend = (val Backends.fresh_backend ()) in
-
-
(* Hey is inferred to be a matrix. *)
let%op y = ("hey" * 'q' 2.0) + 'p' 1.0 in
(* Punning for ["hey"] above introduced the [hey] identifier. *)
@@ -36,8 +32,6 @@ let hello2 () =


let hello3 () =
let module Backend = (val Backends.fresh_backend ()) in
-
-
(* Hey is inferred to be a matrix. *)
let hey = TDSL.param "hey" in
let zero_to_twenty = TDSL.range 20 in
@@ -63,8 +57,7 @@ let hello4 () =
and type event = Backend.event
and type optimize_ctx = Backend.optimize_ctx)
in
-
-
+
let ri = TDSL.range 3 in
let%op ti = ri ++ "i=>i0" in
(* Write position 2 of ti, otherwise shape inference concludes it's dim-1 and broadcasted. *)
@@ -95,8 +88,7 @@ let hello5 () =
and type event = Backend.event
and type optimize_ctx = Backend.optimize_ctx)
in
-
-
+
let hey = TDSL.range_of_shape ~batch_dims:[ 2 ] ~input_dims:[ 3 ] ~output_dims:[ 4 ] () in
let%op ho = hey ++ "...|1->... => ...|..." in
ignore (Train.forward_once backend ho);
@@ -112,8 +104,7 @@ let hello6 () =
and type event = Backend.event
and type optimize_ctx = Backend.optimize_ctx)
in
-
-
+
(* "Hey" is inferred to be a scalar. *)
let%op y = 2 *. "hey" in
ignore (Train.forward_once backend y);
File "arrayjit/lib/cc_backend.ml", line 1, characters 0-0:
diff --git a/_build/default/arrayjit/lib/cc_backend.ml b/_build/default/arrayjit/lib/.formatted/cc_backend.ml
index fdaaa7c..b584d56 100644
--- a/_build/default/arrayjit/lib/cc_backend.ml
+++ b/_build/default/arrayjit/lib/.formatted/cc_backend.ml
@@ -13,7 +13,8 @@ open Backend_intf
let name = "cc"


(* Header declarations for arrayjit builtins *)
-let builtins_header = {|
+let builtins_header =
+  {|
/* ArrayJIT builtins declarations */
#include <stdint.h>


@@ -111,15 +112,15 @@ let%track7_sexp c_compile_and_load ~f_name =
let libname = base_name ^ "_run_id_" ^ run_id ^ if Sys.win32 then ".dll" else ".so" in
(try Stdlib.Sys.remove log_fname with _ -> ());
(try Stdlib.Sys.remove libname with _ -> ());
-  let kernel_link_flags =
+  let kernel_link_flags =
match Sys.os_type with
-    | "Unix" ->
+    | "Unix" ->
if Stdlib.Sys.command "uname -s | grep -q Darwin" = 0 then
"-bundle -undefined dynamic_lookup"
-        else
-          "-shared -fPIC"
+        else "-shared -fPIC"
| "Win32" | "Cygwin" -> "-shared"
-    | _ -> "-shared -fPIC" in
+    | _ -> "-shared -fPIC"
+  in
let cmdline : string =
Printf.sprintf "%s %s -O%d -o %s %s >> %s 2>&1" (compiler_command ()) f_name
(optimization_level ()) libname kernel_link_flags log_fname
File "bin/micrograd_demo.ml", line 1, characters 0-0:
diff --git a/_build/default/bin/micrograd_demo.ml b/_build/default/bin/.formatted/micrograd_demo.ml
index 1da5078..03fea8a 100644
--- a/_build/default/bin/micrograd_demo.ml
+++ b/_build/default/bin/.formatted/micrograd_demo.ml
@@ -68,9 +68,9 @@ let experiment seed ~no_batch_shape_inference ~use_builtin_weight_decay () =
let module Backend = (val Backends.fresh_backend ~backend_name:"multicore_cc" ()) in
let ctx = Train.init_params (module Backend) ~hosted:true IDX.empty scalar_loss in
let routine = Train.to_routine (module Backend) ctx bindings (Asgns.sequence [ update; sgd ]) in
-  (* Stdio.print_endline "\n******** scalar_loss **********"; Train.printf_tree ~with_grad:false ~depth:9 scalar_loss; Stdio.print_endline "\n******** learning_rate
-     **********"; Train.printf_tree ~with_grad:false ~depth:9 learning_rate;
-     Stdio.printf "\n********\n%!"; *)
+  (* Stdio.print_endline "\n******** scalar_loss **********"; Train.printf_tree ~with_grad:false
+     ~depth:9 scalar_loss; Stdio.print_endline "\n******** learning_rate **********";
+     Train.printf_tree ~with_grad:false ~depth:9 learning_rate; Stdio.printf "\n********\n%!"; *)
let open Operation.At in
let epoch_loss = ref 0. in
let step_ref = IDX.find_exn routine.bindings step_n in
File "bin/hello_world_op.ml", line 1, characters 0-0:
diff --git a/_build/default/bin/hello_world_op.ml b/_build/default/bin/.formatted/hello_world_op.ml
index 064c122..fc296a6 100644
--- a/_build/default/bin/hello_world_op.ml
+++ b/_build/default/bin/.formatted/hello_world_op.ml
@@ -23,8 +23,7 @@ let%track2_sexp _Pointwise_multiplication_dims_1 (() : unit) : unit =
and type event = Backend.event
and type optimize_ctx = Backend.optimize_ctx)
in
-
-
+
(* "Hey" is inferred to be a scalar. *)
let%op ya = 2 *. "hey" 7.0 in
ignore (Train.forward_once backend ya);
@@ -41,8 +40,7 @@ let%track2_sexp _Matrix_multiplication_dims_1x1 (() : unit) : unit =
and type event = Backend.event
and type optimize_ctx = Backend.optimize_ctx)
in
-
-
+
(* Hey is inferred to be a matrix because of matrix multiplication [*]. *)
let%op yb = ("hey" 7.0 * 'q' 2.0) + 'p' 1.0 in
ignore (Train.forward_once backend yb);
@@ -60,7 +58,7 @@ let%track2_sexp _Print_constant_tensor_too_early (() : unit) : unit =
Tensor.print ~here:[%here] ~with_code:false ~with_grad:false `Inline a;
Tensor.print ~here:[%here] ~with_code:false ~with_grad:false `Inline b;
let%op c = a *. b in
-
+
ignore (Train.forward_once (module Backend) c);
Train.printf ~here:[%here] c


@@ -75,8 +73,7 @@ let%track2_sexp _Print_constant_tensor (() : unit) : unit =
and type event = Backend.event
and type optimize_ctx = Backend.optimize_ctx)
in
-
-
+
let%op hey = [ (1, 2, 3); (4, 5, 6) ] in
ignore (Train.forward_once backend hey);
Train.printf ~here:[%here] ~with_code:false ~with_grad:false @@ hey;
@@ -171,8 +168,7 @@ let%track2_sexp _Matrix_multiplication_dims_2x3 (() : unit) : unit =
and type event = Backend.event
and type optimize_ctx = Backend.optimize_ctx)
in
-
-
+
(* Hey is inferred to be a matrix. *)
let%op yc = ("hey" 7.0 * [ 2; 3 ]) + [ 4; 5; 6 ] in
ignore (Train.forward_once backend yc);
@@ -190,8 +186,7 @@ let%track2_sexp _Big_matrix (() : unit) : unit =
and type event = Backend.event
and type optimize_ctx = Backend.optimize_ctx)
in
-
-
+
(* Hey is inferred to be a matrix. *)
let hey = TDSL.param ~value:0.5 "hey" in
let zero_to_twenty = TDSL.range 20 in
@@ -211,8 +206,7 @@ let%track2_sexp _Very_big_tensor (() : unit) : unit =
and type event = Backend.event
and type optimize_ctx = Backend.optimize_ctx)
in
-
-
+
let hey = TDSL.range_of_shape ~batch_dims:[ 6 ] ~input_dims:[ 7; 8 ] ~output_dims:[ 9 ] () in
let%op ye = (hey * (1 + 1)) - 10 in
ignore (Train.forward_once backend ye);
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 eecd279..c717470 100644
--- a/_build/default/arrayjit/lib/assignments.ml
+++ b/_build/default/arrayjit/lib/.formatted/assignments.ml
@@ -167,19 +167,21 @@ let%diagn2_sexp to_low_level code =
let open Indexing in
let get buffer idcs =
let tn = match buffer with Node tn -> tn | Merge_buffer tn -> tn in
-    let idcs = (match (idcs, Lazy.force tn.Tn.dims) with
-    | [||], [|1|] -> [| Fixed_idx 0 |]
-    | [| Fixed_idx 0 |], [||] -> idcs
-    | idcs, dims when Array.length idcs = Array.length dims -> idcs
-    | _ ->
-        [%log
-          "get a=",
-          (tn : Tn.t),
-          ":",
-          Tn.label tn,
-          (idcs : Indexing.axis_index array),
-          (Lazy.force tn.dims : int array)];
-        assert false) in
+    let idcs =
+      match (idcs, Lazy.force tn.Tn.dims) with
+      | [||], [| 1 |] -> [| Fixed_idx 0 |]
+      | [| Fixed_idx 0 |], [||] -> idcs
+      | idcs, dims when Array.length idcs = Array.length dims -> idcs
+      | _ ->
+          [%log
+            "get a=",
+            (tn : Tn.t),
+            ":",
+            Tn.label tn,
+            (idcs : Indexing.axis_index array),
+            (Lazy.force tn.dims : int array)];
+          assert false
+    in
match buffer with
| Node tn -> Low_level.Get (tn, idcs)
| Merge_buffer tn ->
@@ -277,8 +279,7 @@ let%diagn2_sexp to_low_level code =
| Indexing.Fixed_idx _ as idx -> idx
| Indexing.Iterator s as idx -> Option.value ~default:idx (Map.find subst_map s)
| Indexing.Affine { symbols; offset } ->
-                (* FIXME: we need to substitute in the affine index, reuse code from
-                   loop_accum *)
+                (* FIXME: we need to substitute in the affine index, reuse code from loop_accum *)
Indexing.Affine { symbols; offset }
in
let lhs_idcs = Array.map projections.project_lhs ~f:subst_index in
@@ -286,19 +287,22 @@ let%diagn2_sexp to_low_level code =
let open Low_level in
let rhs_ll = get rhs rhs_idcs in
(* For now, we know the only vec_unop is Uint4x32_to_prec_uniform *)
-          let length = match op with
-            | Ops.Uint4x32_to_prec_uniform ->
-                (* Calculate length based on precision - how many values we can extract from 128 bits *)
+          let length =
+            match op with
+            | Ops.Uint4x32_to_prec_uniform -> (
+                (* Calculate length based on precision - how many values we can extract from 128
+                   bits *)
let target_prec = Lazy.force lhs.prec in
match target_prec with
-                | Ops.Byte_prec _ | Ops.Fp8_prec _ -> 16  (* 8-bit values *)
-                | Ops.Uint16_prec _ | Ops.Half_prec _ | Ops.Bfloat16_prec _ -> 8  (* 16-bit values *)
-                | Ops.Int32_prec _ | Ops.Single_prec _ -> 4  (* 32-bit values *)
-                | Ops.Double_prec _ -> 2  (* 64-bit values *)
-                | Ops.Uint4x32_prec _ -> 1  (* 128-bit value *)
-                | Ops.Void_prec -> failwith "Cannot use vector operation with void precision"
+                | Ops.Byte_prec _ | Ops.Fp8_prec _ -> 16 (* 8-bit values *)
+                | Ops.Uint16_prec _ | Ops.Half_prec _ | Ops.Bfloat16_prec _ -> 8 (* 16-bit values *)
+                | Ops.Int32_prec _ | Ops.Single_prec _ -> 4 (* 32-bit values *)
+                | Ops.Double_prec _ -> 2 (* 64-bit values *)
+                | Ops.Uint4x32_prec _ -> 1 (* 128-bit value *)
+                | Ops.Void_prec -> failwith "Cannot use vector operation with void precision")
in
-          Set_from_vec { tn = lhs; idcs = lhs_idcs; length; vec_unop = op; arg = rhs_ll; debug = "" }
+          Set_from_vec
+            { tn = lhs; idcs = lhs_idcs; length; vec_unop = op; arg = rhs_ll; debug = "" }
in
let rec for_loop rev_iters = function
| [] -> basecase rev_iters
@@ -391,8 +395,7 @@ let get_ident_within_code ?no_dots c =
List.iter ~f:visit [ lhs; tn rhs1; tn rhs2 ]
| Accum_unop { initialize_neutral = _; accum = _; op = _; lhs; rhs; projections = _ } ->
List.iter ~f:visit [ lhs; tn rhs ]
-    | Set_vec_unop { op = _; lhs; rhs; projections = _ } ->
-        List.iter ~f:visit [ lhs; tn rhs ]
+    | Set_vec_unop { op = _; lhs; rhs; projections = _ } -> List.iter ~f:visit [ lhs; tn rhs ]
| Fetch { array; fetch_op = _; dims = _ } -> visit array
in
loop c;
@@ -493,9 +496,12 @@ let to_doc ?name ?static_indices () c =
if Lazy.is_val projections then (Lazy.force projections).debug_info.spec
else "<not-in-yet>"
in
-        string (ident lhs) ^^ space
-        ^^ string (Ops.assign_op_cd_syntax ~initialize_neutral:false Arg2) ^^ space
-        ^^ string (Ops.vec_unop_cd_syntax op) ^^ space
+        string (ident lhs)
+        ^^ space
+        ^^ string (Ops.assign_op_cd_syntax ~initialize_neutral:false Arg2)
+        ^^ space
+        ^^ string (Ops.vec_unop_cd_syntax op)
+        ^^ space
^^ string (buffer_ident rhs)
^^ (if not (String.equal proj_spec ".") then string (" ~logic:\"" ^ proj_spec ^ "\"")
else empty)
File "lib/ppx_shared.ml", line 1, characters 0-0:
diff --git a/_build/default/lib/ppx_shared.ml b/_build/default/lib/.formatted/ppx_shared.ml
index d0b7a5e..aff2ada 100644
--- a/_build/default/lib/ppx_shared.ml
+++ b/_build/default/lib/.formatted/ppx_shared.ml
@@ -197,8 +197,7 @@ let vec_unary_ops =
(module String)
[
( "uint4x32_to_prec_uniform",
-        fun loc -> ([%expr Shape.Uint4x32_to_prec], [%expr Ir.Ops.Uint4x32_to_prec_uniform])
-      );
+        fun loc -> ([%expr Shape.Uint4x32_to_prec], [%expr Ir.Ops.Uint4x32_to_prec_uniform]) );
]


(** Ternary primitive ops. *)
File "arrayjit/lib/ops.ml", line 1, characters 0-0:
diff --git a/_build/default/arrayjit/lib/ops.ml b/_build/default/arrayjit/lib/.formatted/ops.ml
index 6d3bb49..3c91aad 100644
--- a/_build/default/arrayjit/lib/ops.ml
+++ b/_build/default/arrayjit/lib/.formatted/ops.ml
@@ -234,16 +234,16 @@ let c_typ_of_prec = function
| Void_prec -> "void"


let c_vec_typ_of_prec ~length prec =
-  match prec, length with
+  match (prec, length) with
| Single_prec _, 4 -> "float4_t"
| Double_prec _, 2 -> "double2_t"
| Int32_prec _, 4 -> "int32x4_t"
| (Byte_prec _ | Fp8_prec _), 16 -> "int8x16_t"
| (Uint16_prec _ | Bfloat16_prec _), 8 -> "uint16x8_t"
| Half_prec _, 8 -> "half8_t"
-  | _ ->
-    (* Fallback for other combinations *)
-    c_typ_of_prec prec ^ "[" ^ Int.to_string length ^ "]"
+  | _ ->
+      (* Fallback for other combinations *)
+      c_typ_of_prec prec ^ "[" ^ Int.to_string length ^ "]"


let hum_typ_of_prec = function
| Byte_prec _ -> "byte"
@@ -595,7 +595,8 @@ let unop_c_syntax prec op =
| Not, _ -> ("(", " == 0.0 ? 1.0 : 0.0)")


let vec_unop_c_syntax prec op =
-  match op with Uint4x32_to_prec_uniform -> ("uint4x32_to_" ^ prec_string prec ^ "_uniform_vec(", ")")
+  match op with
+  | Uint4x32_to_prec_uniform -> ("uint4x32_to_" ^ prec_string prec ^ "_uniform_vec(", ")")


(** In the %cd syntax, we use uncurried notation for ternary ops. *)
let ternop_cd_syntax = function Where -> "where" | FMA -> "fma"
File "lib/operation.ml", line 1, characters 0-0:
diff --git a/_build/default/lib/operation.ml b/_build/default/lib/.formatted/operation.ml
index 5934385..0942d45 100644
--- a/_build/default/lib/operation.ml
+++ b/_build/default/lib/.formatted/operation.ml
@@ -273,8 +273,9 @@ let uint4x32_to_prec_uniform ?(label = []) =
Tn.update_prec t1.Tensor.value Ir.Ops.uint4x32;
Tensor.unop
~label:("uint4x32_to_prec_uniform" :: label)
-      (* A placeholder that will be replaced by the actual precision by Tensor.op. *)
-      ~transpose_op:(Uint4x32_to_prec (lazy (assert false))) ~op_asn ~grad_asn ?grad_spec t1
+        (* A placeholder that will be replaced by the actual precision by Tensor.op. *)
+      ~transpose_op:(Uint4x32_to_prec (lazy (assert false)))
+      ~op_asn ~grad_asn ?grad_spec t1


let lt ?(label = []) =
let module NTDSL = Initial_NTDSL in
File "arrayjit/lib/metal_backend.ml", line 1, characters 0-0:
diff --git a/_build/default/arrayjit/lib/metal_backend.ml b/_build/default/arrayjit/lib/.formatted/metal_backend.ml
index e17264d..57ce3b4 100644
--- a/_build/default/arrayjit/lib/metal_backend.ml
+++ b/_build/default/arrayjit/lib/.formatted/metal_backend.ml
@@ -452,16 +452,16 @@ end) : Ir.Backend_impl.Lowered_backend = struct
| Ops.Void_prec -> "void"


let vec_typ_of_prec ~length prec =
-      match prec, length with
+      match (prec, length) with
| Ops.Single_prec _, 4 -> "float4_t"
-      | Ops.Double_prec _, 2 -> "float2_t"  (* Metal uses float2 since it lacks double *)
+      | Ops.Double_prec _, 2 -> "float2_t" (* Metal uses float2 since it lacks double *)
| Ops.Int32_prec _, 4 -> "int32x4_t"
| (Ops.Byte_prec _ | Ops.Fp8_prec _), 16 -> "int8x16_t"
| (Ops.Uint16_prec _ | Ops.Bfloat16_prec _), 8 -> "uint16x8_t"
| Ops.Half_prec _, 8 -> "half8_t"
-      | _ ->
-        (* Fallback for other combinations *)
-        typ_of_prec prec ^ "[" ^ Int.to_string length ^ "]"
+      | _ ->
+          (* Fallback for other combinations *)
+          typ_of_prec prec ^ "[" ^ Int.to_string length ^ "]"


let metal_prec_suffix_float = function
| Ops.Byte_prec _ -> ""
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 8f5509d..ec4c209 100644
--- a/_build/default/lib/tensor.ml
+++ b/_build/default/lib/.formatted/tensor.ml
@@ -224,7 +224,7 @@ let op ~(label : string list) ?(ternary_op = Shape.Pointwise_tern)
| Some (Data init_data) -> Terminal (Data init_data)
in
let dims = lazy_to_dims shape in
-   let padding = lazy (Shape.to_padding shape) in
+  let padding = lazy (Shape.to_padding shape) in
let v =
match terminal_op with
| Some (Shape.Data (Asgns.Reshape data)) ->
@@ -238,8 +238,7 @@ let op ~(label : string list) ?(ternary_op = Shape.Pointwise_tern)
in
let transpose_op =
match transpose_op with
-    |  (Uint4x32_to_prec _) ->
-         (Shape.Uint4x32_to_prec v.Tn.prec)
+    | Uint4x32_to_prec _ -> Shape.Uint4x32_to_prec v.Tn.prec
| _ -> transpose_op
in
let rec shape_logics = function
File "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.ml
index 23f4496..f280ea4 100644
--- a/_build/default/arrayjit/lib/cuda_backend.ml
+++ b/_build/default/arrayjit/lib/.formatted/cuda_backend.ml
@@ -323,16 +323,16 @@ end) : Ir.Backend_impl.Lowered_backend = struct
| Ops.Void_prec -> "void"


let vec_typ_of_prec ~length prec =
-      match prec, length with
+      match (prec, length) with
| Ops.Single_prec _, 4 -> "float4_t"
| Ops.Double_prec _, 2 -> "double2_t"
| Ops.Int32_prec _, 4 -> "int32x4_t"
| (Ops.Byte_prec _ | Ops.Fp8_prec _), 16 -> "int8x16_t"
| (Ops.Uint16_prec _ | Ops.Bfloat16_prec _), 8 -> "uint16x8_t"
| Ops.Half_prec _, 8 -> "half8_t"
-      | _ ->
-        (* Fallback for other combinations *)
-        typ_of_prec prec ^ "[" ^ Int.to_string length ^ "]"
+      | _ ->
+          (* Fallback for other combinations *)
+          typ_of_prec prec ^ "[" ^ Int.to_string length ^ "]"


let binop_syntax prec v =
(* TODO: consider using binop_syntax inherited from Pure_C_config and overriding only where
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-07-26 19:17.00: Job failed: Failed: Build failed