Organisationsahrefsocannl3dffac ()(lint-fmt)

(lint-fmt)

Link Copied
Code Copied

Logs

2025-09-23 21:00.41: New job: test ahrefs/ocannl https://github.com/ahrefs/ocannl.git#refs/heads/master (3dffac6b92f69cc815e539256f8b7c75a2694def) (linux-x86_64:(lint-fmt))
Base: ocaml/opam:debian-13-ocaml-4.08@sha256:b9828be178417e3bc607ef229c00d658316b130c027775f6069f6a7c473de176
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 3dffac6b
cat > Dockerfile <<'END-OF-DOCKERFILE'
FROM ocaml/opam:debian-13-ocaml-4.08@sha256:b9828be178417e3bc607ef229c00d658316b130c027775f6069f6a7c473de176
USER 1000:1000
RUN cd ~/opam-repository && (git cat-file -e 1c9b44165f73bd3366a4af940f28503f26d3267e || git fetch origin master) && git reset -q --hard 1c9b44165f73bd3366a4af940f28503f26d3267e && 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-09-23 21:00.41: Using cache hint "ahrefs/ocannl-ocaml/opam:debian-13-ocaml-4.08@sha256:b9828be178417e3bc607ef229c00d658316b130c027775f6069f6a7c473de176-debian-13-4.08_opam-2.4-ocamlformat-1c9b44165f73bd3366a4af940f28503f26d3267e"
2025-09-23 21:00.41: Using OBuilder spec:
((from ocaml/opam:debian-13-ocaml-4.08@sha256:b9828be178417e3bc607ef229c00d658316b130c027775f6069f6a7c473de176)
(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 1c9b44165f73bd3366a4af940f28503f26d3267e || git fetch origin master) && git reset -q --hard 1c9b44165f73bd3366a4af940f28503f26d3267e && 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-09-23 21:00.41: Waiting for resource in pool OCluster
2025-09-23 21:00.41: Waiting for worker…
2025-09-23 21:00.42: Got resource from pool OCluster
Building on doris.caelum.ci.dev
All commits already cached
HEAD is now at 3dffac6b Random distribution test, by Claude Opus


(from ocaml/opam:debian-13-ocaml-4.08@sha256:b9828be178417e3bc607ef229c00d658316b130c027775f6069f6a7c473de176)
2025-09-23 21:00.43 ---> using "4f143e25e7620fadf6d4819085e998cd063e4132d1bf4b7e768f2c9645e2385a" 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 1c9b44165f73bd3366a4af940f28503f26d3267e || git fetch origin master) && git reset -q --hard 1c9b44165f73bd3366a4af940f28503f26d3267e && git log --no-decorate -n1 --oneline && opam update -u"))
From https://github.com/ocaml/opam-repository
* branch                  master     -> FETCH_HEAD
bcac5d1731..3f21ebe342  master     -> origin/master
1c9b44165f Merge pull request #28508 from fpottier/opam-publish-menhir.20250912


<><> 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-09-23 21:00.43 ---> using "5a7a210fbfa3dd4f9a1dcb8b72ce6fbe8b47598feb3860d5bad81de0478ddbc5" 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.20.2


<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[dune.3.20.2] found in cache


<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed dune.3.20.2
Done.
# Run eval $(opam env) to update the current shell environment
2025-09-23 21:00.43 ---> using "19888bb997ffa39249f136da813c0df955c136fc626993c4fc1d3e59d6870a9c" 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 ocamlbuild        0.16.1   [required by fpath, astring, uuseg]
- install cmdliner          1.3.0    [required by ocamlformat]
- install either            1.0.0    [required by ocamlformat-lib]
- install menhirLib         20250912 [required by ocamlformat-lib]
- install csexp             1.5.2    [required by ocamlformat]
- install camlp-streams     5.0.1    [required by ocamlformat-lib]
- install seq               base     [required by re]
- install menhirSdk         20250912 [required by ocamlformat-lib]
- install menhirCST         20250912 [required by menhir]
- 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 dune-build-info   3.20.2   [required by ocamlformat-lib]
- install dune-configurator 3.20.2   [required by base]
- install re                1.11.0   [required by ocamlformat]
- install menhir            20250912 [required by ocamlformat-lib]
- install topkg             1.1.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.20.2] found in cache
[dune-configurator.3.20.2] found in cache
[either.1.0.0] found in cache
[fix.20250428] found in cache
[fpath.0.7.3] found in cache
[menhir.20250912] found in cache
[menhirCST.20250912] found in cache
[menhirLib.20250912] found in cache
[menhirSdk.20250912] found in cache
[ocaml-version.4.0.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 cmdliner.1.3.0
-> installed csexp.1.5.2
-> installed either.1.0.0
-> installed fix.20250428
-> installed menhirCST.20250912
-> installed menhirLib.20250912
-> installed menhirSdk.20250912
-> installed ocaml-version.4.0.1
-> installed sexplib0.v0.14.0
-> installed re.1.11.0
-> installed dune-build-info.3.20.2
-> installed ocamlfind.1.9.8
-> installed base-bytes.base
-> installed dune-configurator.3.20.2
-> installed ocamlbuild.0.16.1
-> installed ocp-indent.1.8.1
-> installed topkg.1.1.0
-> installed base.v0.14.3
-> installed astring.0.8.5
-> installed uutf.1.0.4
-> installed stdio.v0.14.0
-> installed menhir.20250912
-> installed fpath.0.7.3
-> 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-09-23 21:00.43 ---> using "3e45bd23b74679154062230de86758cc36883f569c2fc30c29ad248cfd3154dc" from cache


/src: (copy (src .) (dst /src/))
2025-09-23 21:00.43 ---> saved as "0b592c3127d0bd07680575ab3af2cbb3f273ac958f1cd6a29fd1fd8f0da7aaa4"


/src: (run (shell "opam exec -- dune build @fmt --ignore-promoted-rules || (echo \"dune build @fmt failed\"; exit 2)"))
File "test/operations/test_random_histograms.ml", line 1, characters 0-0:
diff --git a/_build/default/test/operations/test_random_histograms.ml b/_build/default/test/operations/.formatted/test_random_histograms.ml
index 7d0e22d..558b282 100644
--- a/_build/default/test/operations/test_random_histograms.ml
+++ b/_build/default/test/operations/.formatted/test_random_histograms.ml
@@ -18,16 +18,15 @@ let print_histogram bins ~title ~max_width =
let max_count = Array.max_elt bins ~compare:Int.compare |> Option.value ~default:0 in
let total = Array.fold bins ~init:0 ~f:( + ) in
Array.iteri bins ~f:(fun i count ->
-      let bar_width = (count * max_width) / max_count in
+      let bar_width = count * max_width / max_count in
let bar = String.make bar_width '#' in
-      let percentage = (Float.of_int count /. Float.of_int total) *. 100.0 in
+      let percentage = Float.of_int count /. Float.of_int total *. 100.0 in
printf "Bin %2d: %s %4d (%.1f%%)\n" i bar count percentage)


let test_uniform_at_histogram () =
Tensor.unsafe_reinitialize ();
let ctx = Context.auto () in
let module O = TDSL.O in
-
(* Generate a large batch of random numbers using uniform_at *)
(* Note: uniform_at produces 4 values per counter input (from uint4x32) *)
let num_counters = 2500 in
@@ -42,8 +41,8 @@ let test_uniform_at_histogram () =
ignore (Ocannl.Train.forward_once ctx uniform_values);
let result = Ir.Tnode.get_values uniform_values.value in


-  printf "Generated %d values from %d counters (%.1fx expansion)\n"
-    (Array.length result) num_counters
+  printf "Generated %d values from %d counters (%.1fx expansion)\n" (Array.length result)
+    num_counters
(Float.of_int (Array.length result) /. Float.of_int num_counters);


(* Create and print histogram *)
@@ -52,10 +51,9 @@ let test_uniform_at_histogram () =
print_histogram bins ~title:"Uniform Distribution [0, 1) Histogram" ~max_width:40;


(* Statistical tests *)
-  let mean = Array.fold result ~init:0.0 ~f:(+.) /. Float.of_int (Array.length result) in
+  let mean = Array.fold result ~init:0.0 ~f:( +. ) /. Float.of_int (Array.length result) in
let variance =
-    Array.fold result ~init:0.0 ~f:(fun acc x ->
-        acc +. ((x -. mean) *. (x -. mean)))
+    Array.fold result ~init:0.0 ~f:(fun acc x -> acc +. ((x -. mean) *. (x -. mean)))
/. Float.of_int (Array.length result)
in
let std_dev = Float.sqrt variance in
@@ -73,8 +71,8 @@ let test_uniform_at_histogram () =
let diff = Float.of_int observed -. expected_per_bin in
acc +. (diff *. diff /. expected_per_bin))
in
-  printf "  Chi-square statistic: %.2f (df=%d, critical value at 0.05: ~%.2f)\n"
-    chi_square (num_bins - 1) 30.14;
+  printf "  Chi-square statistic: %.2f (df=%d, critical value at 0.05: ~%.2f)\n" chi_square
+    (num_bins - 1) 30.14;


(* Check if all values are in range *)
let all_in_range = Array.for_all result ~f:(fun x -> Float.(x >= 0.0 && x < 1.0)) in
@@ -84,7 +82,6 @@ let test_normal_at_histogram () =
Tensor.unsafe_reinitialize ();
let ctx = Context.auto () in
let module O = TDSL.O in
-
(* Generate a large batch of random numbers using normal_at *)
(* Note: normal_at also produces 4 values per counter input *)
let num_counters = 2500 in
@@ -100,10 +97,9 @@ let test_normal_at_histogram () =
let result = Ir.Tnode.get_values normal_values.value in


(* Calculate statistics *)
-  let mean = Array.fold result ~init:0.0 ~f:(+.) /. Float.of_int (Array.length result) in
+  let mean = Array.fold result ~init:0.0 ~f:( +. ) /. Float.of_int (Array.length result) in
let variance =
-    Array.fold result ~init:0.0 ~f:(fun acc x ->
-        acc +. ((x -. mean) *. (x -. mean)))
+    Array.fold result ~init:0.0 ~f:(fun acc x -> acc +. ((x -. mean) *. (x -. mean)))
/. Float.of_int (Array.length result)
in
let std_dev = Float.sqrt variance in
@@ -124,15 +120,9 @@ let test_normal_at_histogram () =
printf "  Max: %.4f\n" max_val;


(* Check what percentage falls within standard deviations *)
-  let within_1_std =
-    Array.count result ~f:(fun x -> Float.(abs x <= 1.0))
-  in
-  let within_2_std =
-    Array.count result ~f:(fun x -> Float.(abs x <= 2.0))
-  in
-  let within_3_std =
-    Array.count result ~f:(fun x -> Float.(abs x <= 3.0))
-  in
+  let within_1_std = Array.count result ~f:(fun x -> Float.(abs x <= 1.0)) in
+  let within_2_std = Array.count result ~f:(fun x -> Float.(abs x <= 2.0)) in
+  let within_3_std = Array.count result ~f:(fun x -> Float.(abs x <= 3.0)) in


printf "  Within 1 std dev: %.1f%% (expected: ~68.3%%)\n"
(Float.of_int within_1_std /. Float.of_int (Array.length result) *. 100.0);
@@ -143,20 +133,23 @@ let test_normal_at_histogram () =


(* Normality test using skewness and kurtosis *)
let skewness =
-    let sum_cubed = Array.fold result ~init:0.0 ~f:(fun acc x ->
-        let diff = x -. mean in
-        acc +. (diff *. diff *. diff))
+    let sum_cubed =
+      Array.fold result ~init:0.0 ~f:(fun acc x ->
+          let diff = x -. mean in
+          acc +. (diff *. diff *. diff))
in
sum_cubed /. (Float.of_int (Array.length result) *. std_dev *. std_dev *. std_dev)
in


let kurtosis =
-    let sum_fourth = Array.fold result ~init:0.0 ~f:(fun acc x ->
-        let diff = x -. mean in
-        let diff2 = diff *. diff in
-        acc +. (diff2 *. diff2))
+    let sum_fourth =
+      Array.fold result ~init:0.0 ~f:(fun acc x ->
+          let diff = x -. mean in
+          let diff2 = diff *. diff in
+          acc +. (diff2 *. diff2))
in
-    (sum_fourth /. (Float.of_int (Array.length result) *. std_dev *. std_dev *. std_dev *. std_dev)) -. 3.0
+    (sum_fourth /. (Float.of_int (Array.length result) *. std_dev *. std_dev *. std_dev *. std_dev))
+    -. 3.0
in


printf "  Skewness: %.4f (expected: ~0.0)\n" skewness;
@@ -166,7 +159,6 @@ let test_batched_generation_consistency () =
Tensor.unsafe_reinitialize ();
let ctx = Context.auto () in
let module O = TDSL.O in
-
(* Test that batched generation gives consistent results *)
let batch_size = 100 in
let num_batches = 10 in
@@ -205,9 +197,8 @@ let test_batched_generation_consistency () =
Array.sort sorted ~compare:Float.compare;
let unique = ref 1 in
for i = 1 to Array.length sorted - 1 do
-      let diff = Float.abs (sorted.(i) -. sorted.(i-1)) in
-      if Float.(diff > 1e-7) then
-        unique := !unique + 1
+      let diff = Float.abs (sorted.(i) -. sorted.(i - 1)) in
+      if Float.(diff > 1e-7) then unique := !unique + 1
done;
!unique
in
@@ -217,11 +208,9 @@ let test_batched_generation_consistency () =
let unique_normal = count_unique !all_normal_values in


printf "Generated %d values in %d batches of %d\n" total_values num_batches batch_size;
-  printf "Uniform values: %d unique out of %d (%.1f%%)\n"
-    unique_uniform total_values
+  printf "Uniform values: %d unique out of %d (%.1f%%)\n" unique_uniform total_values
(Float.of_int unique_uniform /. Float.of_int total_values *. 100.0);
-  printf "Normal values: %d unique out of %d (%.1f%%)\n"
-    unique_normal total_values
+  printf "Normal values: %d unique out of %d (%.1f%%)\n" unique_normal total_values
(Float.of_int unique_normal /. Float.of_int total_values *. 100.0);


(* Verify batch consistency of statistical properties *)
@@ -234,40 +223,44 @@ let test_batched_generation_consistency () =
let normal_batch = Array.sub !all_normal_values ~pos:start_idx ~len:batch_size in


batch_means_uniform.(batch) <-
-      Array.fold uniform_batch ~init:0.0 ~f:(+.) /. Float.of_int batch_size;
+      Array.fold uniform_batch ~init:0.0 ~f:( +. ) /. Float.of_int batch_size;
batch_means_normal.(batch) <-
-      Array.fold normal_batch ~init:0.0 ~f:(+.) /. Float.of_int batch_size
+      Array.fold normal_batch ~init:0.0 ~f:( +. ) /. Float.of_int batch_size
done;


let mean_of_means_uniform =
-    Array.fold batch_means_uniform ~init:0.0 ~f:(+.) /. Float.of_int num_batches
+    Array.fold batch_means_uniform ~init:0.0 ~f:( +. ) /. Float.of_int num_batches
in
let mean_of_means_normal =
-    Array.fold batch_means_normal ~init:0.0 ~f:(+.) /. Float.of_int num_batches
+    Array.fold batch_means_normal ~init:0.0 ~f:( +. ) /. Float.of_int num_batches
in


let std_of_means_uniform =
-    let diff_sum = Array.fold batch_means_uniform ~init:0.0 ~f:(fun acc x ->
-        let diff = x -. mean_of_means_uniform in
-        acc +. (diff *. diff)) in
+    let diff_sum =
+      Array.fold batch_means_uniform ~init:0.0 ~f:(fun acc x ->
+          let diff = x -. mean_of_means_uniform in
+          acc +. (diff *. diff))
+    in
Float.sqrt (diff_sum /. Float.of_int num_batches)
in
let std_of_means_normal =
-    let diff_sum = Array.fold batch_means_normal ~init:0.0 ~f:(fun acc x ->
-        let diff = x -. mean_of_means_normal in
-        acc +. (diff *. diff)) in
+    let diff_sum =
+      Array.fold batch_means_normal ~init:0.0 ~f:(fun acc x ->
+          let diff = x -. mean_of_means_normal in
+          acc +. (diff *. diff))
+    in
Float.sqrt (diff_sum /. Float.of_int num_batches)
in


printf "\nBatch means consistency:\n";
-  printf "  Uniform: mean of batch means = %.4f, std = %.4f\n"
-    mean_of_means_uniform std_of_means_uniform;
-  printf "  Normal: mean of batch means = %.4f, std = %.4f\n"
-    mean_of_means_normal std_of_means_normal
+  printf "  Uniform: mean of batch means = %.4f, std = %.4f\n" mean_of_means_uniform
+    std_of_means_uniform;
+  printf "  Normal: mean of batch means = %.4f, std = %.4f\n" mean_of_means_normal
+    std_of_means_normal


let () =
test_uniform_at_histogram ();
printf "\n";
test_normal_at_histogram ();
printf "\n";
-  test_batched_generation_consistency ()
\ No newline at end of file
+  test_batched_generation_consistency ()
Warning: Invalid documentation comment:
File "tensor/shape.ml", line 24, characters 0-0:
End of text is not allowed in '[...]' (code).
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-09-23 21:00.44: Job failed: Failed: Build failed