Skip to content

Commit c94954d

Browse files
committed
Don't debug at log level 1
1 parent fc27558 commit c94954d

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

lib/row.ml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ let subst_row (env : environment) ({ dims; bcast; id } : t) : t =
530530
id;
531531
}))
532532

533-
let%debug_sexp rec unify_dim ~stage (eq : dim * dim) (env : environment) : constraint_ list * environment =
533+
let%debug5_sexp rec unify_dim ~stage (eq : dim * dim) (env : environment) : constraint_ list * environment =
534534
let dim1 : dim = subst_dim env @@ fst eq and dim2 : dim = subst_dim env @@ snd eq in
535535
match (dim1, dim2) with
536536
| Dim { label = Some l1; _ }, Dim { label = Some l2; _ } when not (String.equal l1 l2) ->
@@ -590,7 +590,7 @@ let drop_from_end l n = List.rev @@ List.drop (List.rev l) n
590590
let take_from_end (l : dim list) (n : int) : dim list = List.rev @@ List.take (List.rev l) n
591591

592592
(* Equate two rows, no broadcasting. Does not resolve inequalities. *)
593-
let%debug_sexp rec unify_row ~stage (eq : t * t) (env : environment) : constraint_ list * environment =
593+
let%debug5_sexp rec unify_row ~stage (eq : t * t) (env : environment) : constraint_ list * environment =
594594
let rec solve (ineqs, env) = function
595595
| Dim_eq { d1; d2 } ->
596596
let more_ineqs, env = unify_dim ~stage (d1, d2) env in
@@ -733,7 +733,7 @@ let%debug_sexp rec unify_row ~stage (eq : t * t) (env : environment) : constrain
733733
| Ok eqs ->
734734
List.fold ~init:([], env) ~f:(fun acc (d1, d2) -> solve acc (Dim_eq { d1; d2 })) eqs)
735735

736-
let%debug_sexp solve_dim_ineq ~(stage : stage) ~(cur : dim) ~(subr : dim) (env : environment) :
736+
let%debug5_sexp solve_dim_ineq ~(stage : stage) ~(cur : dim) ~(subr : dim) (env : environment) :
737737
constraint_ list * environment =
738738
let nonredundant ?(more = []) v vs =
739739
Utils.sorted_diff ~compare:compare_dim_var
@@ -911,7 +911,7 @@ let%debug_sexp solve_dim_ineq ~(stage : stage) ~(cur : dim) ~(subr : dim) (env :
911911

912912
let global_template_cache = Hashtbl.Poly.create ()
913913

914-
let%debug_sexp solve_row_ineq ~(stage : stage) ~(cur : t) ~(subr : t) (env : environment) :
914+
let%debug5_sexp solve_row_ineq ~(stage : stage) ~(cur : t) ~(subr : t) (env : environment) :
915915
constraint_ list * environment =
916916
let nonredundant ?(more = []) v vs =
917917
Utils.sorted_diff ~compare:compare_row_var
@@ -1145,7 +1145,7 @@ let%debug_sexp solve_row_ineq ~(stage : stage) ~(cur : t) ~(subr : t) (env : env
11451145
| { bcast = Row_var _ | Broadcastable; _ }, { bcast = Row_var _ | Broadcastable; _ } ->
11461146
(Row_ineq { cur; subr } :: ineqs, env)
11471147

1148-
let%debug_sexp close_dim_terminal ~(stage : stage) (env : environment) (dim : dim) : constraint_ list =
1148+
let%debug5_sexp close_dim_terminal ~(stage : stage) (env : environment) (dim : dim) : constraint_ list =
11491149
match dim with
11501150
| Dim _ -> []
11511151
| Var v -> (
@@ -1160,7 +1160,7 @@ let%debug_sexp close_dim_terminal ~(stage : stage) (env : environment) (dim : di
11601160

11611161
let last_dim_is dims d2 = match List.last dims with Some (Dim { d; _ }) -> d = d2 | _ -> false
11621162

1163-
let%debug_sexp rec eliminate_row_constraint ~lub (r : row) (constr : row_constraint) env : constraint_ list =
1163+
let%debug5_sexp rec eliminate_row_constraint ~lub (r : row) (constr : row_constraint) env : constraint_ list =
11641164
match r with
11651165
| { bcast = Broadcastable; _ } ->
11661166
(* The environment is unchanged, as apply_row_constraint would update only the constr. *)
@@ -1223,7 +1223,7 @@ let close_row_terminal ~(stage : stage) (env : environment) ({ dims; bcast; id }
12231223
| _ when is_stage5_up stage -> []
12241224
| _ -> Terminal_row r1 :: term_dims ())
12251225

1226-
let%debug_sexp eliminate_dim_entry v ~lub constr =
1226+
let%debug5_sexp eliminate_dim_entry v ~lub constr =
12271227
match (lub, constr) with
12281228
| _, Unconstrained_dim | _, At_least_dim 1 -> None
12291229
| Some (Dim { d; _ } as lub), At_least_dim d2 when d2 > d ->
@@ -1234,7 +1234,7 @@ let%debug_sexp eliminate_dim_entry v ~lub constr =
12341234
| Some lub, At_least_dim _ -> Some (Dim_eq { d1 = Var v; d2 = lub })
12351235
| None, At_least_dim d -> Some (Dim_eq { d1 = Var v; d2 = get_dim ~d () })
12361236

1237-
let%debug_sexp eliminate_variables (env : environment) ({ dims; bcast; id } as _r : row) : constraint_ list =
1237+
let%debug5_sexp eliminate_variables (env : environment) ({ dims; bcast; id } as _r : row) : constraint_ list =
12381238
let f = function
12391239
| Var v as d1 ->
12401240
Some
@@ -1259,7 +1259,7 @@ let%debug_sexp eliminate_variables (env : environment) ({ dims; bcast; id } as _
12591259

12601260
let empty_env = { dim_env = Map.empty (module Dim_var); row_env = Map.empty (module Row_var) }
12611261

1262-
let%debug_sexp solve_inequalities ~(stage : stage) (ineqs : constraint_ list) (env : environment) :
1262+
let%debug4_sexp solve_inequalities ~(stage : stage) (ineqs : constraint_ list) (env : environment) :
12631263
constraint_ list * environment =
12641264
let rec solve (ineqs : constraint_ list) (env : environment) : constraint_ list * environment =
12651265
let f (ineqs, env) (ineq : constraint_) =
@@ -1410,7 +1410,7 @@ type proj_equation =
14101410
e.g. for broadcasted-to axes of a tensor assigned a constant. *)
14111411
[@@deriving compare, equal, sexp]
14121412

1413-
let%debug_sexp get_proj_equations (inequalities : constraint_ list) proj_axis_env (env : environment) :
1413+
let%debug4_sexp get_proj_equations (inequalities : constraint_ list) proj_axis_env (env : environment) :
14141414
proj_equation list =
14151415
let to_proj : dim -> proj = function
14161416
| Var v when Map.mem proj_axis_env v -> Solved (Map.find_exn proj_axis_env v)
@@ -1460,7 +1460,7 @@ let%debug_sexp get_proj_equations (inequalities : constraint_ list) proj_axis_en
14601460
in
14611461
List.concat_map inequalities ~f
14621462

1463-
let%debug_sexp solve_proj_equations (eqs : proj_equation list) : proj_env =
1463+
let%debug4_sexp solve_proj_equations (eqs : proj_equation list) : proj_env =
14641464
let v_env = dim_hashtbl () in
14651465
let p_solved = ref [] in
14661466
let p_dims = ref [] in

lib/shape.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ let einsum_slot_spec_to_dims_bio ~generative ~sh_id ~row_var_env ~dim_var_env la
336336

337337
type proj_axis_env = Arrayjit.Indexing.axis_index Row.dim_map [@@deriving sexp]
338338

339-
let%debug_sexp get_inequalities ({ shape = cur_sh; logic; id = _ } as _upd : update_step) :
339+
let%debug4_sexp get_inequalities ({ shape = cur_sh; logic; id = _ } as _upd : update_step) :
340340
proj_axis_env * Row.constraint_ list =
341341
let generative =
342342
[
@@ -599,7 +599,7 @@ let apply_env_update ~eliminate_variables env update_step =
599599
List.concat_map ~f:(Row.eliminate_variables env) @@ all_rows update_step
600600
else []
601601

602-
let%debug_sexp propagate_shapes (update_step : update_step) : unit =
602+
let%debug4_sexp propagate_shapes (update_step : update_step) : unit =
603603
(* Allow the derivation of constraints to depend on the shapes (currently, only Batch_slice
604604
does). *)
605605
ignore (apply_env_update ~eliminate_variables:false !state update_step);
@@ -611,7 +611,7 @@ let%debug_sexp propagate_shapes (update_step : update_step) : unit =
611611
ignore (apply_env_update ~eliminate_variables:false env update_step);
612612
state := env
613613

614-
let%debug_sexp finish_inference (() : unit) : unit =
614+
let%debug4_sexp finish_inference (() : unit) : unit =
615615
(* TODO: optimize to keep all needed information in unsolved, rather than starting with all
616616
constraints. *)
617617
let unsolved, env = Row.solve_inequalities ~stage:Stage2 !active_constraints !state in
@@ -894,7 +894,7 @@ let axis_keys_to_idcs (sh : t) : int axis_map =
894894
Array.rev_inplace idcs;
895895
Map.of_alist_exn (module AxisKey) @@ Array.to_list @@ Array.mapi idcs ~f:(fun i key -> (key, i))
896896

897-
let%debug_sexp default_display_indices (sh: t): int array =
897+
let%debug5_sexp default_display_indices (sh: t): int array =
898898
let axes = axis_keys_to_idcs sh |> Map.map ~f:(fun _ -> 0) in
899899
let occupied = Array.create ~len:5 false in
900900
let set_occu prio =

todo.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
ppx_cd: reduce code duplication
44
ppx_cd: get rid of binary_op and use binary_ops table instead {cm:2025-01-28}
5-
Tensor.print_tree should never force memory modes
5+
Tensor.print_tree should never force memory modes
6+
get C compiler from `ocamlc -config`

0 commit comments

Comments
 (0)