Organisationsahrefsocannla9eef0 ()(lint-fmt)

(lint-fmt)

Link Copied
Code Copied

Logs

2025-08-15 09:09.48: New job: test ahrefs/ocannl https://github.com/ahrefs/ocannl.git#refs/heads/master (a9eef0b4b5177264a32f50f52e86b4193b3f4c2b) (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 a9eef0b4
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-15 09:09.48: 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-15 09:09.48: 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-15 09:09.48: Waiting for resource in pool OCluster
2025-08-15 09:09.48: Waiting for worker…
2025-08-15 09:09.48: Got resource from pool OCluster
Building on eumache
HEAD is now at 8923c9bf Fix the most recent changes to lowering accumulations
HEAD is now at a9eef0b4 Audit and augment some cross-backend context code for exception debug info


(from ocaml/opam:debian-12-ocaml-4.08@sha256:474656ea1593a299054f8966c700443fa0944c9534de3da94ca6dfab4a44c47a)
2025-08-15 09:09.49 ---> using "1d0024db739bd078f91b2384c47919652a4b72a425e3e24ce24cfd1f6debdfbc" 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 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-15 09:09.49 ---> using "76d9d96bb26da3c78200d383fd35f876d80571baf05962331a1fff5f47db0e2e" 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-08-15 09:09.49 ---> using "da0888a20a067de19f6183f0b497dcc2d1ea7f7036861cc50f633c662efdce4f" 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 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 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 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-15 09:09.49 ---> using "86ec8dcb8046a1e5dacfb1841e8c026d30cfead67649bcb6d6a8f9ddd6fb153d" from cache


/src: (copy (src .) (dst /src/))
2025-08-15 09:09.49 ---> saved as "6e6f2ecaa6d164e1c31c698114e7b0e6926ba7e8694d5c61ab09318b81d829ca"


/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 "test/einsum/surjectivity.ml", line 1, characters 0-0:
diff --git a/_build/default/test/einsum/surjectivity.ml b/_build/default/test/einsum/.formatted/surjectivity.ml
index e1cdc46..d5a8079 100644
--- a/_build/default/test/einsum/surjectivity.ml
+++ b/_build/default/test/einsum/.formatted/surjectivity.ml
@@ -22,14 +22,15 @@ let%expect_test "diagonal_tensor_initialization" =
(* Create a diagonal tensor using einsum: i->ii *)
let input = TDSL.range 5 in
let%op diagonal = input ++ "i=>ii" in
-
+
(* Ensure the diagonal tensor is hosted *)
Train.set_hosted diagonal.value;
ignore (Train.forward_once backend diagonal);
-
+
(* Print the diagonal tensor *)
Train.printf ~here:[%here] ~with_code:false ~with_grad:false diagonal;
-  [%expect {|
+  [%expect
+    {|
HERE: test/einsum/surjectivity.ml:31:21
┌──────────────────────────────────────┐
│[1]: =>_diagonal shape 0:6,1:6        │
@@ -60,12 +61,13 @@ let%expect_test "sparse_assignment_with_fixed_indices" =
(* Create a sparse tensor using fixed indices: i->i0j *)
let input = TDSL.range 4 in
let%op sparse = input ++ "i=>i0j" in
-
+
Train.set_hosted sparse.value;
ignore (Train.forward_once backend sparse);
-
+
Train.printf ~here:[%here] ~with_code:false ~with_grad:false sparse;
-  [%expect {|
+  [%expect
+    {|
HERE: test/einsum/surjectivity.ml:67:21
┌─────────────────────────────────┐
│[1]: =>_sparse shape 0:5,1:1,2:1 │
@@ -103,14 +105,15 @@ let%expect_test "multiple_sparse_axes" =
in


(* Test with multiple fixed indices: ij->i1j2 *)
-  let input = TDSL.range_of_shape ~output_dims:[3; 4] () in
+  let input = TDSL.range_of_shape ~output_dims:[ 3; 4 ] () in
let%op sparse_multi = input ++ "ij=>i1j2" in
-
+
Train.set_hosted sparse_multi.value;
ignore (Train.forward_once backend sparse_multi);
-
+
Train.printf ~here:[%here] ~with_code:false ~with_grad:false sparse_multi;
-  [%expect {|
+  [%expect
+    {|
HERE: test/einsum/surjectivity.ml:112:21
┌───────────────────────────────────────────┐
│[1]: =>_sparse_multi shape 0:3,1:2,2:4,3:3 │
@@ -156,4 +159,4 @@ let%expect_test "multiple_sparse_axes" =
││      │ 0.00  0.00  1.10e+1 │             │
│└──────┴─────────────────────┘             │
└───────────────────────────────────────────┘
-    |}]
\ No newline at end of file
+    |}]
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 2b853fb..c867f49 100644
--- a/_build/default/arrayjit/lib/backend_impl.ml
+++ b/_build/default/arrayjit/lib/.formatted/backend_impl.ml
@@ -54,11 +54,11 @@ module No_device_buffer_and_copying () :
(* FIXME(#344, #355): This is not efficient, but it won't be used for long. *)
let ptr = alloc_impl ~size_in_bytes in
(* Zero-initialize the allocated memory *)
-    if size_in_bytes > 0 then (
-      let arr = Ctypes.from_voidp Ctypes.uint8_t ptr in
-      for i = 0 to size_in_bytes - 1 do
-        Ctypes.(arr +@ i <-@ Unsigned.UInt8.zero)
-      done);
+    (if size_in_bytes > 0 then
+       let arr = Ctypes.from_voidp Ctypes.uint8_t ptr in
+       for i = 0 to size_in_bytes - 1 do
+         Ctypes.(arr +@ i <-@ Unsigned.UInt8.zero)
+       done);
ptr


let%track7_sexp alloc_buffer ?(old_buffer : buffer_ptr Backend_intf.buffer option)
File "test/einsum/test_surjectivity.ml", line 1, characters 0-0:
diff --git a/_build/default/test/einsum/test_surjectivity.ml b/_build/default/test/einsum/.formatted/test_surjectivity.ml
index 0c225ed..1bb021e 100644
--- a/_build/default/test/einsum/test_surjectivity.ml
+++ b/_build/default/test/einsum/.formatted/test_surjectivity.ml
@@ -11,15 +11,14 @@ let test_diagonal_tensor () =
Stdio.printf "\nTesting diagonal tensor initialization:\n";
Tensor.unsafe_reinitialize ();
let module Backend = (val Backends.fresh_backend ()) in
-
(* Create a diagonal tensor using einsum: i->ii *)
let input = TDSL.range 5 in
let%op diagonal = input ++ "i=>ii" in
-
+
(* Ensure the diagonal tensor is hosted *)
Train.set_hosted diagonal.value;
ignore (Train.forward_once (module Backend) diagonal);
-
+
(* Print the diagonal tensor *)
Train.printf ~here:[%here] ~with_code:false ~with_grad:false diagonal;
Stdio.printf "\n"
@@ -28,14 +27,13 @@ let test_sparse_fixed_index () =
Stdio.printf "\nTesting sparse assignment with fixed index:\n";
Tensor.unsafe_reinitialize ();
let module Backend = (val Backends.fresh_backend ()) in
-
(* Create a sparse tensor using fixed indices: i->i0j *)
let input = TDSL.range 4 in
let%op sparse = input ++ "i=>i0" in
-
+
Train.set_hosted sparse.value;
ignore (Train.forward_once (module Backend) sparse);
-
+
Train.printf ~here:[%here] ~with_code:false ~with_grad:false sparse;
Stdio.printf "\n"


@@ -43,31 +41,29 @@ let test_multi_sparse () =
Stdio.printf "\nTesting multiple sparse axes:\n";
Tensor.unsafe_reinitialize ();
let module Backend = (val Backends.fresh_backend ()) in
-
(* Create tensor with multiple dims and test sparse assignment *)
-  let input = TDSL.range_of_shape ~output_dims:[3; 4] () in
+  let input = TDSL.range_of_shape ~output_dims:[ 3; 4 ] () in
let%op result = input ++ "ij=>i1j" in
-
+
Train.set_hosted result.value;
ignore (Train.forward_once (module Backend) result);
-
+
Train.printf ~here:[%here] ~with_code:false ~with_grad:false result;
Stdio.printf "\n"


-  let _test_stride_gap () =
-    Stdio.printf "\nTesting stride gap:\n";
-    Tensor.unsafe_reinitialize ();
-    let module Backend = (val Backends.fresh_backend ()) in
-
-    (* Create tensor with multiple dims and test sparse assignment *)
-    let input = TDSL.range_of_shape ~output_dims:[2; 5] () in
-    let%op result = input ++ "ij=>i+3*j" in
-
-    Train.set_hosted result.value;
-    ignore (Train.forward_once (module Backend) result);
-
-    Train.printf ~here:[%here] ~with_code:false ~with_grad:false result;
-    Stdio.printf "\n"
+let _test_stride_gap () =
+  Stdio.printf "\nTesting stride gap:\n";
+  Tensor.unsafe_reinitialize ();
+  let module Backend = (val Backends.fresh_backend ()) in
+  (* Create tensor with multiple dims and test sparse assignment *)
+  let input = TDSL.range_of_shape ~output_dims:[ 2; 5 ] () in
+  let%op result = input ++ "ij=>i+3*j" in
+
+  Train.set_hosted result.value;
+  ignore (Train.forward_once (module Backend) result);
+
+  Train.printf ~here:[%here] ~with_code:false ~with_grad:false result;
+  Stdio.printf "\n"


let () =
test_diagonal_tensor ();
@@ -75,4 +71,4 @@ let () =
test_multi_sparse ();
(* FIXME(#354): Projections inference for convolution-style expressions not implemented yet. *)
(* test_stride_gap (); *)
-  Stdio.printf "All surjectivity tests completed.\n"
\ No newline at end of file
+  Stdio.printf "All surjectivity tests completed.\n"
File "test/einsum/test_accumulation_semantics.ml", line 1, characters 0-0:
diff --git a/_build/default/test/einsum/test_accumulation_semantics.ml b/_build/default/test/einsum/.formatted/test_accumulation_semantics.ml
index 54307b7..6925d41 100644
--- a/_build/default/test/einsum/test_accumulation_semantics.ml
+++ b/_build/default/test/einsum/.formatted/test_accumulation_semantics.ml
@@ -12,28 +12,26 @@ let test_einsum_reduction () =
Stdio.printf "\n=== Testing einsum reduction (surjective but not injective) ===\n";
Tensor.unsafe_reinitialize ();
let module Backend = (val Backends.fresh_backend ()) in
-
(* Create input tensor with shape [batch=2, input=3, output=4] *)
let input = TDSL.range_of_shape ~batch_dims:[ 2 ] ~input_dims:[ 3 ] ~output_dims:[ 4 ] () in
-
-  (* The einsum "b|i->o => b|i" reduces over the output dimension
-     This projection is:
-     - Surjective: all positions in result tensor get written
-     - NOT injective: multiple source positions map to same target (needs accumulation) *)
+
+  (* The einsum "b|i->o => b|i" reduces over the output dimension This projection is: - Surjective:
+     all positions in result tensor get written - NOT injective: multiple source positions map to
+     same target (needs accumulation) *)
let%op result = input ++ "b|i->o => b|i" in
-
+
Train.set_hosted input.value;
Train.set_hosted result.value;
Train.every_non_literal_on_host result;
-
+
ignore (Train.forward_once (module Backend) result);
-
+
Stdio.printf "Input tensor (shape: batch=2, input=3, output=4):\n";
Train.printf ~here:[%here] ~with_code:false ~with_grad:false input;
-
+
Stdio.printf "\nResult after reduction 'b|i->o => b|i' (should sum over output dimension):\n";
Train.printf ~here:[%here] ~with_code:false ~with_grad:false result;
-
+
(* Verify the accumulation is correct *)
Stdio.printf "\nExpected values (summing over output dimension):\n";
Stdio.printf "  Batch 0: [0+3+6+9=18, 1+4+7+10=22, 2+5+8+11=26]\n";
@@ -44,23 +42,21 @@ let test_diagonal_tensor () =
Stdio.printf "\n=== Testing diagonal tensor (not surjective) ===\n";
Tensor.unsafe_reinitialize ();
let module Backend = (val Backends.fresh_backend ()) in
-
-  (* Create a diagonal tensor using einsum: i=>ii
-     This projection is:
-     - NOT surjective: off-diagonal positions never get written (need Zero_out)
-     - Injective: each source position maps to exactly one target *)
+  (* Create a diagonal tensor using einsum: i=>ii This projection is: - NOT surjective: off-diagonal
+     positions never get written (need Zero_out) - Injective: each source position maps to exactly
+     one target *)
let input = TDSL.range 5 in
let%op diagonal = input ++ "i=>ii" in
-
+
Train.set_hosted diagonal.value;
ignore (Train.forward_once (module Backend) diagonal);
-
+
Stdio.printf "Input (1D tensor of size 5):\n";
Train.printf ~here:[%here] ~with_code:false ~with_grad:false input;
-
+
Stdio.printf "\nDiagonal tensor 'i=>ii' (5x5 with zeros off-diagonal):\n";
Train.printf ~here:[%here] ~with_code:false ~with_grad:false diagonal;
-
+
Stdio.printf "\nNote: Off-diagonal elements should be zero (initialized by Zero_out)\n"


(** Test fixed index projection (not surjective) *)
@@ -68,24 +64,22 @@ let test_fixed_index_projection () =
Stdio.printf "\n=== Testing fixed index projection (not surjective) ===\n";
Tensor.unsafe_reinitialize ();
let module Backend = (val Backends.fresh_backend ()) in
-
-  (* Create a sparse tensor using fixed index: i=>i0
-     This projection is:
-     - NOT surjective: only column 0 gets written (need Zero_out for other columns)
-     - Injective: each source position maps to exactly one target *)
+  (* Create a sparse tensor using fixed index: i=>i0 This projection is: - NOT surjective: only
+     column 0 gets written (need Zero_out for other columns) - Injective: each source position maps
+     to exactly one target *)
let input = TDSL.range 4 in
let%op sparse = input ++ "i=>i0" in
let%op _ = sparse ++ "i2=>i" in
-
+
Train.set_hosted sparse.value;
ignore (Train.forward_once (module Backend) sparse);
-
+
Stdio.printf "Input (1D tensor of size 4):\n";
Train.printf ~here:[%here] ~with_code:false ~with_grad:false input;
-
+
Stdio.printf "\nSparse tensor 'i=>i0' (only first column populated):\n";
Train.printf ~here:[%here] ~with_code:false ~with_grad:false sparse;
-
+
Stdio.printf "\nNote: Only column 0 should have values, others should be zero\n"


(** Test bijective mapping (no initialization or accumulation needed) *)
@@ -93,24 +87,21 @@ let test_bijective_transpose () =
Stdio.printf "\n=== Testing bijective transpose (optimization case) ===\n";
Tensor.unsafe_reinitialize ();
let module Backend = (val Backends.fresh_backend ()) in
-
-  (* Simple transpose: ij=>ji
-     This projection is:
-     - Surjective: all target positions get written
-     - Injective: each source maps to exactly one target
-     - Therefore BIJECTIVE: can skip both Zero_out and accumulation *)
-  let input = TDSL.range_of_shape ~output_dims:[3; 4] () in
+  (* Simple transpose: ij=>ji This projection is: - Surjective: all target positions get written -
+     Injective: each source maps to exactly one target - Therefore BIJECTIVE: can skip both Zero_out
+     and accumulation *)
+  let input = TDSL.range_of_shape ~output_dims:[ 3; 4 ] () in
let%op transposed = input ++ "ij=>ji" in
-
+
Train.set_hosted transposed.value;
ignore (Train.forward_once (module Backend) transposed);
-
+
Stdio.printf "Input (3x4 matrix):\n";
Train.printf ~here:[%here] ~with_code:false ~with_grad:false input;
-
+
Stdio.printf "\nTransposed 'ij=>ji' (4x3 matrix):\n";
Train.printf ~here:[%here] ~with_code:false ~with_grad:false transposed;
-
+
Stdio.printf "\nNote: Simple bijective mapping - no initialization or accumulation needed\n"


let () =
@@ -118,4 +109,4 @@ let () =
test_diagonal_tensor ();
test_fixed_index_projection ();
test_bijective_transpose ();
-  Stdio.printf "\n=== All accumulation semantics tests completed ===\n"
\ No newline at end of file
+  Stdio.printf "\n=== All accumulation semantics tests completed ===\n"
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.ml
index 38c40f2..9917ec5 100644
--- a/_build/default/arrayjit/lib/indexing.ml
+++ b/_build/default/arrayjit/lib/.formatted/indexing.ml
@@ -218,7 +218,7 @@ let is_surjective proj =


let is_injective proj =
let product_iterator_set = Set.of_array (module Symbol) proj.product_iterators in
-
+
(* Check each LHS index for injectivity *)
let lhs_symbols, is_injective_mapping =
Array.fold proj.project_lhs ~init:([], true) ~f:(fun (syms, still_injective) idx ->
@@ -229,19 +229,17 @@ let is_injective proj =
| Fixed_idx _ -> (syms, true)
| Affine { symbols; _ } ->
(* Filter for symbols that are product iterators *)
-              let product_symbols =
-                List.filter symbols ~f:(fun (_coeff, s) ->
-                  Set.mem product_iterator_set s)
+              let product_symbols =
+                List.filter symbols ~f:(fun (_coeff, s) -> Set.mem product_iterator_set s)
in
(* If more than one product iterator in this Affine index, not injective *)
-              if List.length product_symbols > 1 then
-                (syms, false)
+              if List.length product_symbols > 1 then (syms, false)
else
(* (coefficients don't matter for injectivity) *)
(List.map product_symbols ~f:snd @ syms, true)
| Sub_axis -> (syms, true))
in
-
+
if not is_injective_mapping then false
else
let lhs_symbol_set = Set.of_list (module Symbol) lhs_symbols in
File "lib/ppx_op.ml", line 1, characters 0-0:
diff --git a/_build/default/lib/ppx_op.ml b/_build/default/lib/.formatted/ppx_op.ml
index 59f0690..32726dc 100644
--- a/_build/default/lib/ppx_op.ml
+++ b/_build/default/lib/.formatted/ppx_op.ml
@@ -89,10 +89,7 @@ let rec translate ~num_configs ~is_toplevel ~has_config ?label expr =
let axis =
Ast_helper.Exp.constant ~loc:pexp_loc (Pconst_string (String.of_char ch, pexp_loc, None))
in
-      ( no_vbs,
-        [%expr
-          TDSL.bits ?label:[%e opt_expr ~loc label] ~axis_label:[%e axis] [%e i]]
-      )
+      (no_vbs, [%expr TDSL.bits ?label:[%e opt_expr ~loc label] ~axis_label:[%e axis] [%e i]])
| [%expr
[%e? { pexp_desc = Pexp_constant (Pconst_char ch); pexp_loc; _ }]
[%e? { pexp_desc = Pexp_constant (Pconst_integer _); _ } as i]] ->
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 77ab907..85d166f 100644
--- a/_build/default/arrayjit/lib/assignments.ml
+++ b/_build/default/arrayjit/lib/.formatted/assignments.ml
@@ -247,14 +247,12 @@ let%track4_sexp to_low_level code =
}
in
let for_loops = for_loop [] (Array.to_list projections.product_space) in
-    (* Need initialization if:
-       - initialize_neutral is true AND
-       - (not surjective OR not injective)
-       Not surjective: some positions never written (need init to avoid garbage)
-       Not injective: accumulation needed (need init for first += operation) *)
-    let needs_init =
-      initialize_neutral &&
-      not (Indexing.is_surjective projections && Indexing.is_injective projections)
+    (* Need initialization if: - initialize_neutral is true AND - (not surjective OR not injective)
+       Not surjective: some positions never written (need init to avoid garbage) Not injective:
+       accumulation needed (need init for first += operation) *)
+    let needs_init =
+      initialize_neutral
+      && not (Indexing.is_surjective projections && Indexing.is_injective projections)
in
if needs_init then
let dims = lazy projections.lhs_dims in
@@ -341,7 +339,8 @@ let%track4_sexp to_low_level code =
| Fetch { array; fetch_op = Constant c; dims } ->
Low_level.loop_over_dims (Lazy.force dims) ~body:(fun idcs -> set array idcs @@ Constant c)
| Fetch { array; fetch_op = Constant_bits i; dims } ->
-        Low_level.loop_over_dims (Lazy.force dims) ~body:(fun idcs -> set array idcs @@ Constant_bits i)
+        Low_level.loop_over_dims (Lazy.force dims) ~body:(fun idcs ->
+            set array idcs @@ Constant_bits i)
| Fetch { array; fetch_op = Slice { batch_idx = { static_symbol = idx; _ }; sliced }; dims } ->
(* TODO: doublecheck this always gets optimized away. *)
Low_level.loop_over_dims (Lazy.force dims) ~body:(fun idcs ->
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.ml
index 8bb7f29..ecf24e8 100644
--- a/_build/default/arrayjit/lib/backends.ml
+++ b/_build/default/arrayjit/lib/.formatted/backends.ml
@@ -494,7 +494,8 @@ module Raise_backend (Device : Lowered_backend) : Backend = struct
let hash_find_exn ~message tbl =
try Hashtbl.find_exn tbl key
with exn ->
-          [%log "Backends.alloc_if_needed: failed to find node in hash table", message, (key : Tnode.t)];
+          [%log
+            "Backends.alloc_if_needed: failed to find node in hash table", message, (key : Tnode.t)];
raise exn
in
let device = stream.device in
@@ -518,16 +519,19 @@ module Raise_backend (Device : Lowered_backend) : Backend = struct
in
if Hashtbl.mem device.cross_stream_candidates key then
Tn.update_memory_sharing key Tn.Shared_cross_streams 39;
-         add_old_exn buffer)
+          add_old_exn buffer)
else if Tn.known_shared_cross_streams key then (
if Hashtbl.mem device.owner_stream key then (
-          if not (equal_stream stream (hash_find_exn ~message:"owner_stream" device.owner_stream)) then
+          if not (equal_stream stream (hash_find_exn ~message:"owner_stream" device.owner_stream))
+          then
raise
@@ Utils.User_error
("Backends.alloc_if_needed: node " ^ Tn.debug_name key
^ " assumed to be cross-stream-shared but then written to on multiple devices"))
else Hashtbl.add_exn device.owner_stream ~key ~data:stream;
-        let buffer = hash_find_exn ~message:"cross_stream_candidates" device.cross_stream_candidates in
+        let buffer =
+          hash_find_exn ~message:"cross_stream_candidates" device.cross_stream_candidates
+        in
add_old_exn buffer)
else (
Tn.update_memory_sharing key Tn.Per_stream 410;
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 b4df5d4..79ee104 100644
--- a/_build/default/lib/tensor.ml
+++ b/_build/default/lib/.formatted/tensor.ml
@@ -477,8 +477,8 @@ let%track7_sexp term ?init_data ?fetch_op ?grad_spec ?(label = []) ?(top_down_pr
match fetch_op with
| None -> Asgns.empty_comp
| Some
-        (( Constant _ | Constant_bits _ | Slice _ | Embed_symbol _ | Embed_self_id | Range_over_offsets
-         | Constant_fill _ ) as fetch_op) ->
+        (( Constant _ | Constant_bits _ | Slice _ | Embed_symbol _ | Embed_self_id
+         | Range_over_offsets | Constant_fill _ ) as fetch_op) ->
Asgns.to_comp @@ Fetch { array = v; fetch_op; dims }
in
let grad_asn ~t:_ ~g:_ ~projections:_ = Asgns.empty_comp in
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.ml
index 1c0186f..73f1618 100644
--- a/_build/default/arrayjit/lib/c_syntax.ml
+++ b/_build/default/arrayjit/lib/.formatted/c_syntax.ml
@@ -1042,8 +1042,7 @@ module C_syntax (B : C_syntax_config) = struct
^^ hardline
^^ separate_map hardline
(fun ident ->
-               Option.value_exn ~here:[%here] B.local_heap_dealloc ~ident_doc:(string ident)
-               ^^ semi)
+               Option.value_exn ~here:[%here] B.local_heap_dealloc ~ident_doc:(string ident) ^^ semi)
!heap_allocated
^^ hardline;


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 a626193..72d9c69 100644
--- a/_build/default/arrayjit/lib/cuda_backend.ml
+++ b/_build/default/arrayjit/lib/.formatted/cuda_backend.ml
@@ -351,7 +351,9 @@ end) : Ir.Backend_impl.Lowered_backend = struct
(string "hexp2(hlog2(" ^^ v1 ^^ string "),"
^^ ifflat (space ^^ v2) (nest 2 (break 1 ^^ v2))
^^ string ")")
-      | ToPowOf, (Byte_prec _ | Uint16_prec _ | Int32_prec _ | Int64_prec _ | Fp8_prec _ | Uint4x32_prec _) ->
+      | ( ToPowOf,
+          (Byte_prec _ | Uint16_prec _ | Int32_prec _ | Int64_prec _ | Fp8_prec _ | Uint4x32_prec _)
+        ) ->
invalid_arg "Cuda_backend.binop_syntax: ToPowOf not supported for integer precisions"
| ToPowOf, Bfloat16_prec _ ->
fun v1 v2 ->
@@ -666,7 +668,7 @@ end) : Ir.Backend_impl.Lowered_backend = struct
let vec_unop_syntax prec op v =
let open PPrint in
match (op, prec) with
-      | Ops.Uint4x32_to_prec_uniform, _ ->
+      | Ops.Uint4x32_to_prec_uniform, _ ->
group (string ("uint4x32_to_" ^ Ops.prec_string prec ^ "_uniform_vec(") ^^ v ^^ rparen)


let ternop_syntax prec v =
@@ -698,7 +700,7 @@ end) : Ir.Backend_impl.Lowered_backend = struct
| Single_prec _, Half_prec _ -> ("__float2half(", ")")
| Byte_prec _, Half_prec _ -> ("__ushort2half_rn((unsigned short int)", ")")
| Double_prec _, Uint4x32_prec _ -> ("{(unsigned int)(", "), 0, 0, 0}")
-      | Single_prec _, Uint4x32_prec _ -> ("{(unsigned int)(", "), 0, 0, 0}")
+      | Single_prec _, Uint4x32_prec _ -> ("{(unsigned int)(", "), 0, 0, 0}")
| Int32_prec _, Uint4x32_prec _ -> ("{(unsigned int)(", "), 0, 0, 0}")
| Int64_prec _, Uint4x32_prec _ -> ("int64_to_uint4x32(", ")")
| Uint4x32_prec _, _ -> ("", ".v[0]")
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-15 09:09.50: Job failed: Failed: Build failed