Skip to content

Commit b6e2154

Browse files
committed
Formatting
1 parent 58c7187 commit b6e2154

17 files changed

+723
-561
lines changed

arrayjit/lib/backend_impl.ml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,11 @@ module No_device_buffer_and_copying () :
5050
Stdlib.Gc.finalise finalize ptr;
5151
ptr
5252

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

58-
let%track7_sexp alloc_zeros (prec : Ops.prec) ~(dims : int array) (() : unit) :
59-
buffer_ptr =
57+
let%track7_sexp alloc_zeros (prec : Ops.prec) ~(dims : int array) (() : unit) : buffer_ptr =
6058
let size_in_bytes = Array.fold dims ~init:1 ~f:( * ) * Ops.prec_in_bytes prec in
6159
let ptr = alloc_impl ~size_in_bytes in
6260
(* Zero-initialize the allocated memory *)

arrayjit/lib/backends.ml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -474,18 +474,17 @@ module Raise_backend (Device : Lowered_backend) : Backend = struct
474474
[%log (key : Tnode.t)];
475475
let default () =
476476
let dims = Lazy.force key.dims in
477-
(* Use alloc_array when zero initialization is not needed:
478-
- When copying from host immediately after allocation
479-
- When the node has explicit Zero_out operations in the lowered code *)
480-
let will_copy_from_host =
481-
Utils.settings.automatic_host_transfers && Tn.known_constant key &&
482-
match key.array with | (lazy (Some _)) -> true | _ -> false
477+
(* Use alloc_array when zero initialization is not needed: - When copying from host
478+
immediately after allocation - When the node has explicit Zero_out operations in the
479+
lowered code *)
480+
let will_copy_from_host =
481+
Utils.settings.automatic_host_transfers && Tn.known_constant key
482+
&& match key.array with (lazy (Some _)) -> true | _ -> false
483483
in
484-
let dst_ptr =
484+
let dst_ptr =
485485
if will_copy_from_host || node.Low_level.zero_initialized_by_code then
486486
alloc_array (Lazy.force key.prec) ~dims stream
487-
else
488-
alloc_zeros (Lazy.force key.prec) ~dims stream
487+
else alloc_zeros (Lazy.force key.prec) ~dims stream
489488
in
490489
(if will_copy_from_host then
491490
match key.array with

0 commit comments

Comments
 (0)