2025-05-13 09:20.24: New job: test ahrefs/ocannl https://github.com/ahrefs/ocannl.git#refs/heads/master (3718ebe9309e6ac813c55f036a309225294304ef) (linux-x86_64:(lint-fmt)) Base: ocaml/opam:debian-12-ocaml-4.08@sha256:23c85daf4eb9a91d154cf2f9fed47f4f9b9fa788adc9c1fc7f0802e3dc06d7c4 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 3718ebe9 cat > Dockerfile <<'END-OF-DOCKERFILE' FROM ocaml/opam:debian-12-ocaml-4.08@sha256:23c85daf4eb9a91d154cf2f9fed47f4f9b9fa788adc9c1fc7f0802e3dc06d7c4 USER 1000:1000 RUN cd ~/opam-repository && (git cat-file -e 35eb2f107a989a2d623b0bbe170696398fcb9b1e || git fetch origin master) && git reset -q --hard 35eb2f107a989a2d623b0bbe170696398fcb9b1e && 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-05-13 09:20.24: Using cache hint "ahrefs/ocannl-ocaml/opam:debian-12-ocaml-4.08@sha256:23c85daf4eb9a91d154cf2f9fed47f4f9b9fa788adc9c1fc7f0802e3dc06d7c4-debian-12-4.08_opam-2.3-ocamlformat-35eb2f107a989a2d623b0bbe170696398fcb9b1e" 2025-05-13 09:20.24: Using OBuilder spec: ((from ocaml/opam:debian-12-ocaml-4.08@sha256:23c85daf4eb9a91d154cf2f9fed47f4f9b9fa788adc9c1fc7f0802e3dc06d7c4) (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 35eb2f107a989a2d623b0bbe170696398fcb9b1e || git fetch origin master) && git reset -q --hard 35eb2f107a989a2d623b0bbe170696398fcb9b1e && 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-05-13 09:20.24: Waiting for resource in pool OCluster 2025-05-13 09:20.24: Waiting for worker… 2025-05-13 09:20.25: Got resource from pool OCluster Building on toxis.caelum.ci.dev All commits already cached HEAD is now at 3718ebe9 Bug fix pp_array_offset (AI slop) (from ocaml/opam:debian-12-ocaml-4.08@sha256:23c85daf4eb9a91d154cf2f9fed47f4f9b9fa788adc9c1fc7f0802e3dc06d7c4) Unable to find image 'ocaml/opam:debian-12-ocaml-4.08@sha256:23c85daf4eb9a91d154cf2f9fed47f4f9b9fa788adc9c1fc7f0802e3dc06d7c4' locally docker.io/ocaml/opam@sha256:23c85daf4eb9a91d154cf2f9fed47f4f9b9fa788adc9c1fc7f0802e3dc06d7c4: Pulling from ocaml/opam 031dfd3a3b8c: Pulling fs layer 031dfd3a3b8c: Verifying Checksum 031dfd3a3b8c: Download complete 031dfd3a3b8c: Pull complete Digest: sha256:23c85daf4eb9a91d154cf2f9fed47f4f9b9fa788adc9c1fc7f0802e3dc06d7c4 Status: Downloaded newer image for ocaml/opam@sha256:23c85daf4eb9a91d154cf2f9fed47f4f9b9fa788adc9c1fc7f0802e3dc06d7c4 2025-05-13 09:20.26 ---> using "44ab722c6d76cc4aa083f99994b6eb04bd97004720a37e6316ca14ec9a9ee4aa" 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 35eb2f107a989a2d623b0bbe170696398fcb9b1e || git fetch origin master) && git reset -q --hard 35eb2f107a989a2d623b0bbe170696398fcb9b1e && git log --no-decorate -n1 --oneline && opam update -u")) From https://github.com/ocaml/opam-repository * branch master -> FETCH_HEAD 34a3fc46c3..0d013e603b master -> origin/master 35eb2f107a Merge pull request #27838 from maiste/release-dune-3.18.2 <><> 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-05-13 09:20.26 ---> using "8a2b678372cb76274657846aacca16e344d09d207c000e54fe6a3cb5f32925a9" 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.18.2 <><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><> [dune.3.18.2] found in cache <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed dune.3.18.2 Done. # Run eval $(opam env) to update the current shell environment 2025-05-13 09:20.26 ---> using "ca4730752cb261820956ae7402247a43b93561a57eb7e5bb22bc071a5a15bede" 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 dune-build-info 3.18.2 [required by ocamlformat-lib] - 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 menhirSdk 20240715 [required by ocamlformat-lib] - install either 1.0.0 [required by ocamlformat-lib] - install ocaml-version 4.0.0 [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.18.2 [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.18.2] found in cache [dune-configurator.3.18.2] 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.0] 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 menhirCST.20240715 -> installed cmdliner.1.3.0 -> installed menhirLib.20240715 -> installed menhirSdk.20240715 -> installed ocaml-version.4.0.0 -> installed re.1.11.0 -> installed sexplib0.v0.14.0 -> installed dune-build-info.3.18.2 -> installed dune-configurator.3.18.2 -> 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-05-13 09:20.26 ---> using "83e16d5a57bfaaa8e1037f6314ce463533bdda8c0080b90cc5ef6a19f2a66666" from cache /src: (copy (src .) (dst /src/)) 2025-05-13 09:20.26 ---> saved as "865c67ac63bf7186803c81fe7faea40f04d4988664a6b8b0ad015fd95c61a35f" /src: (run (shell "opam exec -- dune build @fmt --ignore-promoted-rules || (echo \"dune build @fmt failed\"; exit 2)")) File "test/micrograd_demo_logging.ml", line 1, characters 0-0: diff --git a/_build/default/test/micrograd_demo_logging.ml b/_build/default/test/.formatted/micrograd_demo_logging.ml index 605bd66..3e800b1 100644 --- a/_build/default/test/micrograd_demo_logging.ml +++ b/_build/default/test/.formatted/micrograd_demo_logging.ml @@ -35,4 +35,4 @@ let () = Train.run step; Tensor.print ~with_code:false ~with_grad:false `Default g; Tensor.print ~with_code:false ~with_grad:true `Default a; - Tensor.print ~with_code:false ~with_grad:true `Default b \ No newline at end of file + Tensor.print ~with_code:false ~with_grad:true `Default b 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 605bd66..3e800b1 100644 --- a/_build/default/bin/micrograd_demo_logging.ml +++ b/_build/default/bin/.formatted/micrograd_demo_logging.ml @@ -35,4 +35,4 @@ let () = Train.run step; Tensor.print ~with_code:false ~with_grad:false `Default g; Tensor.print ~with_code:false ~with_grad:true `Default a; - Tensor.print ~with_code:false ~with_grad:true `Default b \ No newline at end of file + Tensor.print ~with_code:false ~with_grad:true `Default b File "arrayjit/lib/lowered_backend_missing.ml", line 1, characters 0-0: diff --git a/_build/default/arrayjit/lib/lowered_backend_missing.ml b/_build/default/arrayjit/lib/.formatted/lowered_backend_missing.ml index cb9affa..a5b0e8c 100644 --- a/_build/default/arrayjit/lib/lowered_backend_missing.ml +++ b/_build/default/arrayjit/lib/.formatted/lowered_backend_missing.ml @@ -95,13 +95,15 @@ struct failwith @@ "Backend " ^ Config.name ^ " missing -- install the corresponding library" let static_properties = - Sexp.List [ - Sexp.Atom (Config.name ^ "_missing"); - Sexp.List [ - Sexp.Atom "error"; - Sexp.Atom ("Backend " ^ Config.name ^ " missing -- install the corresponding library") + Sexp.List + [ + Sexp.Atom (Config.name ^ "_missing"); + Sexp.List + [ + Sexp.Atom "error"; + Sexp.Atom ("Backend " ^ Config.name ^ " missing -- install the corresponding library"); + ]; ] - ] let get_debug_info _stream = failwith @@ "Backend " ^ Config.name ^ " missing -- install the corresponding library" 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 db3cad4..8a48b6d 100644 --- a/_build/default/arrayjit/lib/cc_backend.ml +++ b/_build/default/arrayjit/lib/.formatted/cc_backend.ml @@ -99,8 +99,8 @@ let%diagn_sexp compile ~(name : string) bindings (lowered : Low_level.optimized) (* Use ribbon = 1.0 for usual code formatting, width 110 *) PPrint.ToChannel.pretty 1.0 110 build_file.oc final_doc; build_file.finalize (); - (* let result = c_compile_and_load ~f_name:pp_file.f_name in *) + (* let result = c_compile_and_load ~f_name:pp_file.f_name in *) let result_library = c_compile_and_load ~f_name:build_file.f_name in { result = result_library; params; bindings; name } @@ -121,26 +121,20 @@ let%diagn_sexp compile_batch ~names bindings (lowereds : Low_level.optimized opt in let build_file = Utils.open_build_file ~base_name ~extension:".c" in let declarations_doc = Syntax.print_declarations () in - let params_and_docs = + let params_and_docs = Array.map2_exn names lowereds ~f:(fun name_opt lowered_opt -> Option.map2 name_opt lowered_opt ~f:(fun name lowered -> Syntax.compile_proc ~name idx_params lowered)) in - let all_proc_docs = - List.filter_map (Array.to_list params_and_docs) ~f:(Option.map ~f:snd) - in + let all_proc_docs = List.filter_map (Array.to_list params_and_docs) ~f:(Option.map ~f:snd) in let final_doc = PPrint.(declarations_doc ^^ separate hardline all_proc_docs) in PPrint.ToChannel.pretty 1.0 110 build_file.oc final_doc; build_file.finalize (); let result_library = c_compile_and_load ~f_name:build_file.f_name in (* Note: for simplicity, we share ctx_arrays across all contexts. *) Array.mapi params_and_docs ~f:(fun i opt_params_and_doc -> - Option.bind opt_params_and_doc ~f:(fun (params, _doc) -> - Option.map names.(i) ~f:(fun name -> - { result = result_library; params; bindings; name } - ) - ) - ) + Option.bind opt_params_and_doc ~f:(fun (params, _doc) -> + Option.map names.(i) ~f:(fun name -> { result = result_library; params; bindings; name }))) let%track3_sexp link_compiled ~merge_buffer ~runner_label ctx_arrays (code : procedure) = let name : string = code.name in File "arrayjit/lib/schedulers.ml", line 1, characters 0-0: diff --git a/_build/default/arrayjit/lib/schedulers.ml b/_build/default/arrayjit/lib/.formatted/schedulers.ml index 16e2085..cce297c 100644 --- a/_build/default/arrayjit/lib/schedulers.ml +++ b/_build/default/arrayjit/lib/.formatted/schedulers.ml @@ -188,17 +188,21 @@ module Multicore (Backend : For_add_scheduler) : let suggested_num_streams _device = Domain.recommended_domain_count () - 1 let static_properties = - Sexp.List [ - Sexp.Atom "multicore_devices"; - Sexp.List [ - Sexp.Atom "device"; - Sexp.List [ - Sexp.List [Sexp.Atom "device_name"; Sexp.Atom "CPU"]; - Sexp.List [Sexp.Atom "device_ordinal"; [%sexp_of: int] 0]; - Sexp.List [Sexp.Atom "num_domains"; [%sexp_of: int] (Domain.recommended_domain_count ())]; - ] + Sexp.List + [ + Sexp.Atom "multicore_devices"; + Sexp.List + [ + Sexp.Atom "device"; + Sexp.List + [ + Sexp.List [ Sexp.Atom "device_name"; Sexp.Atom "CPU" ]; + Sexp.List [ Sexp.Atom "device_ordinal"; [%sexp_of: int] 0 ]; + Sexp.List + [ Sexp.Atom "num_domains"; [%sexp_of: int] (Domain.recommended_domain_count ()) ]; + ]; + ]; ] - ] let%track7_sexp cleanup_stream (stream : stream) : unit = (* Allow running in parallel. *) @@ -274,17 +278,20 @@ module Sync (Backend : For_add_scheduler) = struct let await _stream = () let static_properties = - Sexp.List [ - Sexp.Atom "sync_devices"; - Sexp.List [ - Sexp.Atom "device"; - Sexp.List [ - Sexp.List [Sexp.Atom "device_name"; Sexp.Atom "CPU"]; - Sexp.List [Sexp.Atom "device_ordinal"; Sexp.Atom "0"]; - Sexp.List [Sexp.Atom "threads"; Sexp.Atom "1"]; - ] + Sexp.List + [ + Sexp.Atom "sync_devices"; + Sexp.List + [ + Sexp.Atom "device"; + Sexp.List + [ + Sexp.List [ Sexp.Atom "device_name"; Sexp.Atom "CPU" ]; + Sexp.List [ Sexp.Atom "device_ordinal"; Sexp.Atom "0" ]; + Sexp.List [ Sexp.Atom "threads"; Sexp.Atom "1" ]; + ]; + ]; ] - ] (* let global_run_no = ref 0 *) let schedule_task _stream task = Ir.Task.run task 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 e18b678..1b2cd06 100644 --- a/_build/default/arrayjit/lib/indexing.ml +++ b/_build/default/arrayjit/lib/.formatted/indexing.ml @@ -233,5 +233,6 @@ module Doc_helpers = struct let pp_axis_index idx = match idx with Iterator sym -> pp_symbol sym | Fixed_idx i -> PPrint.OCaml.int i - let pp_indices idcs = PPrint.separate (pp_comma ()) (Array.to_list idcs |> List.map ~f:pp_axis_index) + let pp_indices idcs = + PPrint.separate (pp_comma ()) (Array.to_list idcs |> List.map ~f:pp_axis_index) end 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 f161bc7..c1cdde8 100644 --- a/_build/default/arrayjit/lib/cuda_backend.ml +++ b/_build/default/arrayjit/lib/.formatted/cuda_backend.ml @@ -231,7 +231,8 @@ end) : Ir.Backend_impl.Lowered_backend = struct let name_cu = name ^ ".cu" in if Utils.settings.output_debug_files_in_build_directory then ( let build_file = Utils.open_build_file ~base_name:name ~extension:".cu" in - Stdio.Out_channel.output_string build_file.oc cu_src; (* Keep direct string output for source *) + Stdio.Out_channel.output_string build_file.oc cu_src; + (* Keep direct string output for source *) build_file.finalize ()); [%log "compiling to PTX"]; let with_debug = @@ -283,7 +284,9 @@ end) : Ir.Backend_impl.Lowered_backend = struct let binop_syntax prec v = let open PPrint in - let f op_str v1 v2 = group (lparen ^^ v1 ^^ space ^^ string op_str ^^ space ^^ v2 ^^ rparen) in + let f op_str v1 v2 = + group (lparen ^^ v1 ^^ space ^^ string op_str ^^ space ^^ v2 ^^ rparen) + in let func fn v1 v2 = group (string fn ^^ parens (separate comma_sep [ v1; v2 ])) in match (v, prec) with | Ops.Arg1, _ -> invalid_arg "Cuda_backend.binop_syntax: Arg1 is not an operator" @@ -302,17 +305,45 @@ end) : Ir.Backend_impl.Lowered_backend = struct | ToPowOf, Half_prec _ -> C_syntax.binop_adapter ("hexp2(hlog2(", "),", ")") | ToPowOf, Byte_prec _ -> invalid_arg "Cuda_backend.binop_syntax: ToPowOf not supported for byte/integer precisions" - | Relu_gate, Byte_prec _ -> fun v1 v2 -> group (parens (v1 ^^ string " > 0") ^^ string " ? " ^^ v2 ^^ string " : 0") - | Relu_gate, Half_prec _ -> fun v1 v2 -> group (parens (string "__hgt(" ^^ v1 ^^ comma ^^ string " __ushort_as_half((unsigned short)0x0000U))") ^^ string " ? " ^^ v2 ^^ string " : __ushort_as_half((unsigned short)0x0000U)") - | Relu_gate, _ -> fun v1 v2 -> group (parens (v1 ^^ string " > 0.0") ^^ string " ? " ^^ v2 ^^ string " : 0.0") - | Satur01_gate, Byte_prec _ -> fun v1 v2 -> - parens (parens (string "(float)" ^^ v1 ^^ string " > 0.0f && (float)" ^^ v1 ^^ string " < 1.0f") ^^ string " ? " ^^ v2 ^^ string " : (unsigned char)0") - | Satur01_gate, Half_prec _ -> fun v1 v2 -> - parens (parens (string "__hgt(" ^^ v1 ^^ comma ^^ string " __ushort_as_half((unsigned short)0x0000U)) && __hlt(" ^^ v1 ^^ comma ^^ string " __ushort_as_half((unsigned short)0x3C00U)))") ^^ string " ? " ^^ v2 ^^ string " : __ushort_as_half((unsigned short)0x0000U)") - | Satur01_gate, Single_prec _ -> fun v1 v2 -> - parens (parens (v1 ^^ string " > 0.0f && " ^^ v1 ^^ string " < 1.0f") ^^ string " ? " ^^ v2 ^^ string " : 0.0f") - | Satur01_gate, Double_prec _ -> fun v1 v2 -> - parens (parens (v1 ^^ string " > 0.0 && " ^^ v1 ^^ string " < 1.0") ^^ string " ? " ^^ v2 ^^ string " : 0.0") + | Relu_gate, Byte_prec _ -> + fun v1 v2 -> group (parens (v1 ^^ string " > 0") ^^ string " ? " ^^ v2 ^^ string " : 0") + | Relu_gate, Half_prec _ -> + fun v1 v2 -> + group + (parens + (string "__hgt(" ^^ v1 ^^ comma + ^^ string " __ushort_as_half((unsigned short)0x0000U))") + ^^ string " ? " ^^ v2 + ^^ string " : __ushort_as_half((unsigned short)0x0000U)") + | Relu_gate, _ -> + fun v1 v2 -> + group (parens (v1 ^^ string " > 0.0") ^^ string " ? " ^^ v2 ^^ string " : 0.0") + | Satur01_gate, Byte_prec _ -> + fun v1 v2 -> + parens + (parens + (string "(float)" ^^ v1 ^^ string " > 0.0f && (float)" ^^ v1 ^^ string " < 1.0f") + ^^ string " ? " ^^ v2 ^^ string " : (unsigned char)0") + | Satur01_gate, Half_prec _ -> + fun v1 v2 -> + parens + (parens + (string "__hgt(" ^^ v1 ^^ comma + ^^ string " __ushort_as_half((unsigned short)0x0000U)) && __hlt(" + ^^ v1 ^^ comma + ^^ string " __ushort_as_half((unsigned short)0x3C00U)))") + ^^ string " ? " ^^ v2 + ^^ string " : __ushort_as_half((unsigned short)0x0000U)") + | Satur01_gate, Single_prec _ -> + fun v1 v2 -> + parens + (parens (v1 ^^ string " > 0.0f && " ^^ v1 ^^ string " < 1.0f") + ^^ string " ? " ^^ v2 ^^ string " : 0.0f") + | Satur01_gate, Double_prec _ -> + fun v1 v2 -> + parens + (parens (v1 ^^ string " > 0.0 && " ^^ v1 ^^ string " < 1.0") + ^^ string " ? " ^^ v2 ^^ string " : 0.0") | Max, Byte_prec _ -> func "max" | Max, Half_prec _ -> func "__hmax" | Max, Double_prec _ -> func "fmax" @@ -379,7 +410,9 @@ end) : Ir.Backend_impl.Lowered_backend = struct | Recip_sqrt, Double_prec _ -> f "(1.0 / sqrt(" "))" | Recip_sqrt, _ -> f "(1.0 / sqrtf(" "))" | Neg, _ -> f "(-(" "))" - | Tanh_approx, Byte_prec _ -> invalid_arg "Cuda_backend.unop_syntax: Tanh_approx not supported for byte/integer precisions" + | Tanh_approx, Byte_prec _ -> + invalid_arg + "Cuda_backend.unop_syntax: Tanh_approx not supported for byte/integer precisions" | Tanh_approx, Half_prec _ -> func "htanh_approx" | Tanh_approx, Single_prec _ -> func "__tanhf" | Tanh_approx, _ -> func "tanh" @@ -421,7 +454,8 @@ end) : Ir.Backend_impl.Lowered_backend = struct let declarations_doc = Syntax.print_declarations () in let params, proc_doc = Syntax.compile_proc ~name idx_params lowered in let final_doc = PPrint.(declarations_doc ^^ proc_doc) in - PPrint.ToBuffer.pretty 1.0 110 b final_doc; (* Use ToBuffer *) + PPrint.ToBuffer.pretty 1.0 110 b final_doc; + (* Use ToBuffer *) let ptx = cuda_to_ptx ~name (Buffer.contents b) in { traced_store; ptx; params; bindings; name } @@ -432,11 +466,11 @@ end) : Ir.Backend_impl.Lowered_backend = struct let idx_params = Indexing.bound_symbols bindings in let b = Buffer.create 4096 in let declarations_doc = Syntax.print_declarations () in - let params_and_docs = + let params_and_docs = Array.map2_exn names lowereds ~f: (Option.map2 ~f:(fun name lowered -> - let params, doc = Syntax.compile_proc ~name idx_params lowered in + let params, doc = Syntax.compile_proc ~name idx_params lowered in ((params, name), doc))) in let all_proc_docs = List.filter_map (Array.to_list params_and_docs) ~f:(Option.map ~f:snd) in @@ -568,27 +602,28 @@ end) : Ir.Backend_impl.Lowered_backend = struct [ ("live_streams", [%sexp_of: int] @@ Cu.Stream.get_total_live_streams ()) ] let static_properties = - let device_properties = + let device_properties = Array.init (num_devices ()) ~f:(fun ordinal -> - let dev = Cu.Device.get ~ordinal in - let attributes = Cu.Device.get_attributes dev in - let props = [ - ("device_name", Sexp.Atom (Cu.Device.get_name dev)); - ("device_ordinal", [%sexp_of: int] ordinal); - ("multiprocessor_count", [%sexp_of: int] attributes.multiprocessor_count); - ("total_global_memory", [%sexp_of: int] (Cu.Device.get_total_memory dev)); - ("clock_rate", [%sexp_of: int] attributes.clock_rate); - ("async_engine_count", [%sexp_of: int] attributes.async_engine_count); - ("compute_capability_major", [%sexp_of: int] attributes.compute_capability_major); - ("compute_capability_minor", [%sexp_of: int] attributes.compute_capability_minor); - ("max_threads_per_block", [%sexp_of: int] attributes.max_threads_per_block); - ("unified_addressing", [%sexp_of: bool] attributes.unified_addressing); - ] in - Sexp.List [Sexp.Atom "device"; Sexp.List props] - ) + let dev = Cu.Device.get ~ordinal in + let attributes = Cu.Device.get_attributes dev in + let props = + [ + ("device_name", Sexp.Atom (Cu.Device.get_name dev)); + ("device_ordinal", [%sexp_of: int] ordinal); + ("multiprocessor_count", [%sexp_of: int] attributes.multiprocessor_count); + ("total_global_memory", [%sexp_of: int] (Cu.Device.get_total_memory dev)); + ("clock_rate", [%sexp_of: int] attributes.clock_rate); + ("async_engine_count", [%sexp_of: int] attributes.async_engine_count); + ("compute_capability_major", [%sexp_of: int] attributes.compute_capability_major); + ("compute_capability_minor", [%sexp_of: int] attributes.compute_capability_minor); + ("max_threads_per_block", [%sexp_of: int] attributes.max_threads_per_block); + ("unified_addressing", [%sexp_of: bool] attributes.unified_addressing); + ] + in + Sexp.List [ Sexp.Atom "device"; Sexp.List props ]) in Sexp.List (Sexp.Atom "cuda_devices" :: device_properties) - + let get_debug_info (stream : stream) = let tot, unr, unf = Cu.Stream.total_unreleased_unfinished_delimited_events stream.runner in let i2s = [%sexp_of: int] in File "arrayjit/lib/utils.ml", line 1, characters 0-0: diff --git a/_build/default/arrayjit/lib/utils.ml b/_build/default/arrayjit/lib/.formatted/utils.ml index 5af6ba6..7e12d75 100644 --- a/_build/default/arrayjit/lib/utils.ml +++ b/_build/default/arrayjit/lib/.formatted/utils.ml @@ -573,8 +573,7 @@ let tl_exn = function type build_file_channel = { f_name : string; oc : Stdlib.out_channel; finalize : unit -> unit } -let open_build_file ~base_name ~extension : - build_file_channel = +let open_build_file ~base_name ~extension : build_file_channel = let f_name = if settings.output_debug_files_in_build_directory then build_file @@ base_name ^ extension else Stdlib.Filename.temp_file (base_name ^ "_") extension 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-05-13 09:20.27: Job failed: Failed: Build failed