Skip to content

Commit e0b7c6d

Browse files
committed
Update to support ppx_minidebug 2.2.0: local runtimes only
Signed-off-by: Lukasz Stafiniak <lukstafi@gmail.com>
1 parent 71390f1 commit e0b7c6d

29 files changed

+60
-83
lines changed

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## [0.6.0] -- current
1+
## [0.5.2] -- 2025-03-2?
22

33
### Changed
44

arrayjit.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ depends: [
3232
"ppx_string"
3333
"ppx_variants_conv"
3434
"ppx_expect"
35-
"ppx_minidebug" {>= "2.1.0" & < "2.2.0"}
35+
"ppx_minidebug" {>= "2.2.0"}
3636
"odoc" {with-doc}
3737
]
3838
depopts: [

arrayjit/lib/assignments.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ open Base
33

44
module Lazy = Utils.Lazy
55
module Tn = Tnode
6-
module Debug_runtime = Utils.Debug_runtime
76

8-
let _get_local_debug_runtime = Utils._get_local_debug_runtime
7+
let _get_local_debug_runtime = Utils.get_local_debug_runtime
98

109
[%%global_debug_log_level 9]
1110
[%%global_debug_log_level_from_env_var "OCANNL_LOG_LEVEL"]

arrayjit/lib/backend_impl.ml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
open Base
66
module Lazy = Utils.Lazy
7-
module Debug_runtime = Utils.Debug_runtime
87

9-
let _get_local_debug_runtime = Utils._get_local_debug_runtime
8+
let _get_local_debug_runtime = Utils.get_local_debug_runtime
109

1110
[%%global_debug_log_level 9]
1211
[%%global_debug_log_level_from_env_var "OCANNL_LOG_LEVEL"]
@@ -40,23 +39,23 @@ module No_device_buffer_and_copying () :
4039
let used_memory = Atomic.make 0
4140
let get_used_memory () = Atomic.get used_memory
4241

43-
let%track7_l_sexp alloc_impl ~(size_in_bytes : int) : buffer_ptr =
44-
let%track7_l_sexp finalize (_ptr : buffer_ptr) : unit =
42+
let%track7_sexp alloc_impl ~(size_in_bytes : int) : buffer_ptr =
43+
let%track7_sexp finalize (_ptr : buffer_ptr) : unit =
4544
ignore (Atomic.fetch_and_add used_memory ~-size_in_bytes : int)
4645
in
4746
let ptr = Ctypes.(to_voidp @@ allocate_n int8_t ~count:size_in_bytes) in
4847
let _ : int = Atomic.fetch_and_add used_memory size_in_bytes in
4948
Stdlib.Gc.finalise finalize ptr;
5049
ptr
5150

52-
let%track7_l_sexp alloc_zero_init_array (prec : Ops.prec) ~(dims : int array) (() : unit) :
51+
let%track7_sexp alloc_zero_init_array (prec : Ops.prec) ~(dims : int array) (() : unit) :
5352
buffer_ptr =
5453
let size_in_bytes =
5554
(if Array.length dims = 0 then 0 else Array.reduce_exn dims ~f:( * )) * Ops.prec_in_bytes prec
5655
in
5756
alloc_impl ~size_in_bytes
5857

59-
let%track7_l_sexp alloc_buffer ?(old_buffer : buffer_ptr Backend_intf.buffer option)
58+
let%track7_sexp alloc_buffer ?(old_buffer : buffer_ptr Backend_intf.buffer option)
6059
~(size_in_bytes : int) (() : unit) : buffer =
6160
match old_buffer with
6261
| Some ({ size_in_bytes = old_size; _ } as buffer) when size_in_bytes <= old_size -> buffer
@@ -69,7 +68,7 @@ module No_device_buffer_and_copying () :
6968
let sexp_of_void_buffer_ptr (p : void_buffer_ptr) =
7069
Sexp.Atom (Ctypes_value_printing_stubs.string_of_pointer p)
7170

72-
let%track7_l_sexp memcpy ~(dst : void_buffer_ptr) ~(src : void_buffer_ptr) ~(size_in_bytes : int)
71+
let%track7_sexp memcpy ~(dst : void_buffer_ptr) ~(src : void_buffer_ptr) ~(size_in_bytes : int)
7372
: unit =
7473
if Ctypes_ptr.Fat.compare dst src <> 0 then
7574
Ctypes_memory_stubs.memcpy ~dst ~src ~size:size_in_bytes

arrayjit/lib/backends.ml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
open Base
2-
module Debug_runtime = Utils.Debug_runtime
32
module Tn = Tnode
43
open Backend_intf
54
open Backend_impl
65

7-
let _get_local_debug_runtime = Utils._get_local_debug_runtime
6+
let _get_local_debug_runtime = Utils.get_local_debug_runtime
87

98
[%%global_debug_log_level 9]
109
[%%global_debug_log_level_from_env_var "OCANNL_LOG_LEVEL"]
@@ -39,7 +38,7 @@ module Add_buffer_retrieval_and_syncing (Backend : No_buffer_retrieval_or_syncin
3938
|> Option.iter ~f:(fun upd_e ->
4039
if not (equal_stream s d || Backend.is_done upd_e) then Backend.will_wait_for dst upd_e)
4140

42-
let%track2_l_sexp to_host (ctx : Backend.context) (tn : Tn.t) =
41+
let%track2_sexp to_host (ctx : Backend.context) (tn : Tn.t) =
4342
match (tn, Map.find ctx.ctx_arrays tn) with
4443
| { Tn.array = (lazy (Some hosted)); _ }, Some src ->
4544
if Tn.potentially_cross_stream tn then
@@ -86,7 +85,7 @@ module Add_buffer_retrieval_and_syncing (Backend : No_buffer_retrieval_or_syncin
8685
(* Note: the previous event does not need to be done! *)
8786
s.updating_for_merge_buffer <- Some (tn, Some e)
8887

89-
let%track2_l_sexp from_host (ctx : Backend.context) tn =
88+
let%track2_sexp from_host (ctx : Backend.context) tn =
9089
match (tn, Map.find ctx.ctx_arrays tn) with
9190
| { Tn.array = (lazy (Some hosted)); _ }, Some dst ->
9291
wait_for_all ctx ctx.stream.reader_streams tn;
@@ -98,7 +97,7 @@ module Add_buffer_retrieval_and_syncing (Backend : No_buffer_retrieval_or_syncin
9897
true
9998
| _ -> false
10099

101-
let%diagn2_l_sexp device_to_device (tn : Tn.t) ~into_merge_buffer ~(dst : Backend.context)
100+
let%diagn2_sexp device_to_device (tn : Tn.t) ~into_merge_buffer ~(dst : Backend.context)
102101
~(src : Backend.context) =
103102
let ordinal_of ctx = ctx.stream.device.ordinal in
104103
let name_of ctx = Backend.(get_name ctx.stream) in
@@ -139,7 +138,7 @@ module Add_buffer_retrieval_and_syncing (Backend : No_buffer_retrieval_or_syncin
139138

140139
type r = Backend.context routine [@@deriving sexp_of]
141140

142-
let%track2_l_sexp sync_routine (r : r) : r =
141+
let%track2_sexp sync_routine (r : r) : r =
143142
let s = r.context.stream in
144143
let hosted_inputs = Set.filter r.inputs ~f:(fun tn -> Tn.is_hosted_force tn 47) in
145144
let pre () =

arrayjit/lib/c_syntax.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
open Base
22
module Lazy = Utils.Lazy
3-
module Debug_runtime = Utils.Debug_runtime
43
open Backend_intf
54

6-
let _get_local_debug_runtime = Utils._get_local_debug_runtime
5+
let _get_local_debug_runtime = Utils.get_local_debug_runtime
76

87
[%%global_debug_log_level 9]
98
[%%global_debug_log_level_from_env_var "OCANNL_LOG_LEVEL"]

arrayjit/lib/cc_backend.ml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
open Base
22
module Lazy = Utils.Lazy
3-
module Debug_runtime = Utils.Debug_runtime
43

5-
let _get_local_debug_runtime = Utils._get_local_debug_runtime
4+
let _get_local_debug_runtime = Utils.get_local_debug_runtime
65

76
[%%global_debug_log_level 9]
87
[%%global_debug_log_level_from_env_var "OCANNL_LOG_LEVEL"]
@@ -83,7 +82,7 @@ let%track7_sexp c_compile_and_load ~f_name =
8382
invalid_arg errors);
8483
(* Note: RTLD_DEEPBIND not available on MacOS. *)
8584
let result = { lib = Dl.dlopen ~filename:libname ~flags:[ RTLD_NOW ]; libname } in
86-
let%track7_l_sexp finalize (lib : library) : unit = Dl.dlclose ~handle:lib.lib in
85+
let%track7_sexp finalize (lib : library) : unit = Dl.dlclose ~handle:lib.lib in
8786
Stdlib.Gc.finalise finalize result;
8887
result
8988

@@ -189,7 +188,7 @@ let%track3_sexp link_compiled ~merge_buffer ~runner_label ctx_arrays (code : pro
189188
let params = List.rev_map code.params ~f:(fun (_, p) -> p) in
190189
link code.bindings params Ctypes.(void @-> returning void)]
191190
in
192-
let%diagn_l_sexp work () : unit =
191+
let%diagn_sexp work () : unit =
193192
[%log_result name];
194193
(* Stdio.printf "launching %s\n" name; *)
195194
Indexing.apply run_variadic ();

arrayjit/lib/cuda_backend.cudajit.ml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ open Base
22
module Tn = Tnode
33
module Lazy = Utils.Lazy
44
module Cu = Cudajit
5-
module Debug_runtime = Utils.Debug_runtime
65
open Backend_intf
76

8-
let _get_local_debug_runtime = Utils._get_local_debug_runtime
7+
let _get_local_debug_runtime = Utils.get_local_debug_runtime
98

109
[%%global_debug_log_level 9]
1110
[%%global_debug_log_level_from_env_var "OCANNL_LOG_LEVEL"]
@@ -14,7 +13,7 @@ let () =
1413
Cu.cuda_call_hook :=
1514
Some
1615
(fun ~message:_message ~status:_status ->
17-
[%debug_l_sexp
16+
[%debug_sexp
1817
[%log5_block
1918
_message;
2019
if not @@ Cu.is_success _status then [%log (_status : Cu.result)]]])
@@ -112,7 +111,7 @@ module Fresh () = struct
112111
Option.iter !(stream.merge_buffer) ~f:(fun buffer -> Cu.Deviceptr.mem_free buffer.ptr);
113112
stream.merge_buffer := Some { ptr = Cu.Deviceptr.mem_alloc ~size_in_bytes; size_in_bytes })
114113

115-
let%track4_l_sexp finalize_device (device : device) =
114+
let%track4_sexp finalize_device (device : device) =
116115
Cu.Context.set_current device.dev.primary_context;
117116
Cu.Context.synchronize ();
118117
Option.iter !Utils.advance_captured_logs ~f:(fun callback -> callback ());
@@ -457,7 +456,7 @@ module Fresh () = struct
457456
let func = Cu.Module.get_function run_module ~name in
458457
let stream = prior_context.stream in
459458
let runner_label = get_name stream in
460-
let%diagn3_l_sexp work () : unit =
459+
let%diagn3_sexp work () : unit =
461460
let log_id = get_global_run_id () in
462461
let log_id_prefix = Int.to_string log_id ^ ": " in
463462
[%log_result

arrayjit/lib/gcc_backend.gccjit.ml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
open Base
22
module Lazy = Utils.Lazy
3-
module Debug_runtime = Utils.Debug_runtime
43

5-
let _get_local_debug_runtime = Utils._get_local_debug_runtime
4+
let _get_local_debug_runtime = Utils.get_local_debug_runtime
65

76
[%%global_debug_log_level 9]
87
[%%global_debug_log_level_from_env_var "OCANNL_LOG_LEVEL"]
@@ -700,7 +699,7 @@ let compile ~(name : string) bindings (lowered : Low_level.optimized) =
700699
(if Utils.settings.output_debug_files_in_build_directory then
701700
let f_name = Utils.build_file @@ name ^ "-gccjit-debug.c" in
702701
Context.dump_to_file ctx ~update_locs:true f_name);
703-
let%track7_l_sexp finalize result = Result.release result in
702+
let%track7_sexp finalize result = Result.release result in
704703
let result = Context.compile ctx in
705704
Stdlib.Gc.finalise finalize result;
706705
Context.release ctx;
@@ -789,7 +788,7 @@ let%track3_sexp link_compiled ~merge_buffer ~runner_label ctx_arrays (code : pro
789788
indices. *)
790789
link code.bindings (List.rev code.params) Ctypes.(void @-> returning void)]
791790
in
792-
let%diagn_l_sexp work () : unit =
791+
let%diagn_sexp work () : unit =
793792
[%log_result name];
794793
Indexing.apply run_variadic ();
795794
if Utils.debug_log_from_routines () then (

arrayjit/lib/low_level.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ open Base
22
module Lazy = Utils.Lazy
33
module Nd = Ndarray
44
module Tn = Tnode
5-
module Debug_runtime = Utils.Debug_runtime
65

7-
let _get_local_debug_runtime = Utils._get_local_debug_runtime
6+
let _get_local_debug_runtime = Utils.get_local_debug_runtime
87

98
[%%global_debug_log_level 9]
109
[%%global_debug_log_level_from_env_var "OCANNL_LOG_LEVEL"]

0 commit comments

Comments
 (0)