Skip to content

Commit 93b427d

Browse files
committed
Bump ocamlformat version, reformat
1 parent e85a09d commit 93b427d

22 files changed

+171
-104
lines changed

.ocamlformat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
profile = default
2-
version = 0.26.2
2+
version = 0.27.0
33
margin = 100
44
parse-docstrings = true
55
wrap-comments = true

arrayjit/lib/backend_impl.ml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ end
8484

8585
module Device
8686
(Device_types : Device_types)
87-
(Alloc_buffer : Alloc_buffer
88-
with type buffer_ptr := Device_types.buffer_ptr
89-
and type stream := Device_types.stream) =
87+
(Alloc_buffer :
88+
Alloc_buffer
89+
with type buffer_ptr := Device_types.buffer_ptr
90+
and type stream := Device_types.stream) =
9091
struct
9192
include Device_types
9293
include Alloc_buffer
@@ -138,7 +139,8 @@ module type Backend_impl_common = sig
138139
[use_host_memory] can only be true on unified memory devices, like CPU and Apple Metal. *)
139140
end
140141

141-
(** An interface to adding schedulers for stream-agnostic (typically CPU) backend implementations. *)
142+
(** An interface to adding schedulers for stream-agnostic (typically CPU) backend implementations.
143+
*)
142144
module type For_add_scheduler = sig
143145
include Backend_any_common
144146

arrayjit/lib/backend_intf.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ module type Backend_device_common = sig
269269
(** Global debug information; backend-specific and might evolve independently on the backends. *)
270270

271271
val get_debug_info : stream -> Sexp.t
272-
(** Per-stream debug information; backend-specific and might evolve independently on the backends *)
272+
(** Per-stream debug information; backend-specific and might evolve independently on the backends
273+
*)
273274

274275
val await : stream -> unit
275276
(** Blocks till the stream becomes idle, i.e. synchronizes the stream. *)
@@ -329,7 +330,8 @@ module type Backend = sig
329330
include Backend_device_common with type buffer_ptr := buffer_ptr
330331

331332
val link : context -> code -> context routine
332-
(** Returns the routine for the code's procedure, in a new context derived from the given context. *)
333+
(** Returns the routine for the code's procedure, in a new context derived from the given context.
334+
*)
333335

334336
val link_batch : context -> code_batch -> context * context routine option array
335337
(** Returns the routines for the procedures included in the code batch. The returned context is

arrayjit/lib/backends.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ module Raise_backend (Device : Lowered_backend) : Backend = struct
356356
in
357357
{ from_prior_context; name; lowered; code; expected_merge_node = lowered.Low_level.merge_node }
358358

359-
let%debug3_sexp compile_batch ?shared ?names ?occupancy bindings (comps : Assignments.comp array) :
360-
code_batch =
359+
let%debug3_sexp compile_batch ?shared ?names ?occupancy bindings (comps : Assignments.comp array)
360+
: code_batch =
361361
let names, lowereds =
362362
lower_batch_assignments ?names ?occupancy bindings
363363
@@ Array.map comps ~f:(fun c -> c.Assignments.asgns)

arrayjit/lib/cc_backend.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ let%track3_sexp link_compiled ~merge_buffer ~runner_label ctx_arrays (code : pro
150150
[%log_level
151151
0;
152152
let rec link :
153-
'a 'b 'idcs.
154-
'idcs Indexing.bindings ->
155-
param_source list ->
156-
('a -> 'b) Ctypes.fn ->
157-
('a -> 'b, 'idcs, 'p1, 'p2) Indexing.variadic =
153+
'a 'b 'idcs.
154+
'idcs Indexing.bindings ->
155+
param_source list ->
156+
('a -> 'b) Ctypes.fn ->
157+
('a -> 'b, 'idcs, 'p1, 'p2) Indexing.variadic =
158158
fun (type a b idcs) (binds : idcs Indexing.bindings) params (cs : (a -> b) Ctypes.fn) ->
159159
match (binds, params) with
160160
| Empty, [] -> Indexing.Result (Foreign.foreign ~from:code.result.lib name cs)

arrayjit/lib/cuda_backend.cudajit.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ let to_host ~src_ptr ~src hosted =
193193

194194
let device_to_device tn ~into_merge_buffer ~dst_ptr ~dst ~src_ptr ~src =
195195
(* Stdio.printf "run: device_to_device %s dst backend:0:%d src backend:0:%d\n" (Tn.debug_name tn)
196-
dst.stream.stream_id src.stream.stream_id; *)
196+
dst.stream.stream_id src.stream.stream_id; *)
197197
let dev = dst.stream.device in
198198
let same_device = dev.ordinal = src.stream.device.ordinal in
199199
let size_in_bytes = Tn.size_in_bytes tn in

arrayjit/lib/gcc_backend.gccjit.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -654,11 +654,11 @@ let%track3_sexp link_compiled ~merge_buffer ~runner_label ctx_arrays (code : pro
654654
[%log_level
655655
0;
656656
let rec link :
657-
'a 'b 'idcs.
658-
'idcs Indexing.bindings ->
659-
param_source list ->
660-
('a -> 'b) Ctypes.fn ->
661-
('a -> 'b, 'idcs, 'p1, 'p2) Indexing.variadic =
657+
'a 'b 'idcs.
658+
'idcs Indexing.bindings ->
659+
param_source list ->
660+
('a -> 'b) Ctypes.fn ->
661+
('a -> 'b, 'idcs, 'p1, 'p2) Indexing.variadic =
662662
fun (type a b idcs) (binds : idcs Indexing.bindings) params (cs : (a -> b) Ctypes.fn) ->
663663
match (binds, params) with
664664
| Empty, [] -> Indexing.Result (Gccjit.Result.code code.result name cs)

arrayjit/lib/indexing.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ type projections = {
121121
(** The product space dimensions that an operation should parallelize (map-reduce) over. *)
122122
lhs_dims : int array; (** The dimensions of the LHS array. *)
123123
rhs_dims : int array array;
124-
(** The dimensions of the RHS arrays, needed for deriving projections from other projections. *)
124+
(** The dimensions of the RHS arrays, needed for deriving projections from other projections.
125+
*)
125126
product_iterators : symbol array;
126127
(** The product space iterators (concatentation of the relevant batch, output, input axes) for
127128
iterating over the [product_space] axes, where same axes are at same array indices. *)

arrayjit/lib/low_level.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ let%diagn_sexp check_and_store_virtual traced static_indices top_llc =
291291
if not @@ Set.mem env_dom s then
292292
[%log2
293293
"INFO: Inlining candidate has an escaping variable",
294-
(_idx : Indexing.axis_index),
295-
(top_llc : t)];
294+
(_idx : Indexing.axis_index),
295+
(top_llc : t)];
296296
raise @@ Non_virtual 7
297297
| _ -> ());
298298
loop_float ~env_dom llv
@@ -311,8 +311,8 @@ let%diagn_sexp check_and_store_virtual traced static_indices top_llc =
311311
if not @@ Set.mem env_dom s then (
312312
[%log2
313313
"Inlining candidate has an escaping variable",
314-
(s : Indexing.symbol),
315-
(top_llc : t)];
314+
(s : Indexing.symbol),
315+
(top_llc : t)];
316316
raise @@ Non_virtual 9)
317317
| _ -> ())
318318
| Local_scope { body; _ } -> loop_proc ~env_dom body

arrayjit/lib/ndarray.ml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -426,21 +426,22 @@ let log_debug_info ~from_log_level:_level _nd =
426426
"Ndarray " ^ Sexp.to_string_hum (sexp_of_t _nd);
427427
[%log
428428
"value-at-0:",
429-
(get_as_float _nd (Array.map (dims _nd) ~f:(fun _ -> 0)) : float),
430-
"has nan:",
431-
(fold_as_float _nd ~init:false ~f:(fun has_nan _ v -> has_nan || Float.is_nan v) : bool),
432-
"has +inf:",
433-
(fold_as_float _nd ~init:false ~f:(fun has_inf _ v -> has_inf || Float.(v = infinity))
434-
: bool),
435-
"has -inf:",
436-
(fold_as_float _nd ~init:false ~f:(fun has_neg_inf _ v ->
437-
has_neg_inf || Float.(v = neg_infinity))
438-
: bool)]]]]
429+
(get_as_float _nd (Array.map (dims _nd) ~f:(fun _ -> 0)) : float),
430+
"has nan:",
431+
(fold_as_float _nd ~init:false ~f:(fun has_nan _ v -> has_nan || Float.is_nan v) : bool),
432+
"has +inf:",
433+
(fold_as_float _nd ~init:false ~f:(fun has_inf _ v -> has_inf || Float.(v = infinity))
434+
: bool),
435+
"has -inf:",
436+
(fold_as_float _nd ~init:false ~f:(fun has_neg_inf _ v ->
437+
has_neg_inf || Float.(v = neg_infinity))
438+
: bool)]]]]
439439

440440
let concise_float ~prec v =
441441
Printf.sprintf "%.*e" prec v
442-
|> (* The C99 standard requires at least two digits for the exponent, but the leading zero is a
443-
waste of space. *)
442+
|>
443+
(* The C99 standard requires at least two digits for the exponent, but the leading zero is a waste
444+
of space. *)
444445
String.substr_replace_first ~pattern:"e+0" ~with_:"e+"
445446
|> String.substr_replace_first ~pattern:"e-0" ~with_:"e-"
446447

0 commit comments

Comments
 (0)