Skip to content

Commit

Permalink
Rename optimize_proc -> optimize, lower_proc -> lower
Browse files Browse the repository at this point in the history
  • Loading branch information
lukstafi committed Oct 20, 2024
1 parent 1f2a22b commit 3cb9936
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
### Added

- Interface files for `Backends` and `Low_level`.
- TODO: stream-to-stream synchronization functionality, with lazy per-tensor-node synchronization.
- Fixed #245: tracking of used memory.
- TODO: stream-to-stream synchronization functionality, with lazy per-tensor-node synchronization.

### Changed

Expand Down
4 changes: 2 additions & 2 deletions arrayjit/lib/assignments.ml
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ let fprint_hum ?name ?static_indices () ppf c =
loop c;
fprintf ppf "@]"

let lower_proc ~unoptim_ll_source ~ll_source ~cd_source ~name static_indices (proc : t) :
let lower ~unoptim_ll_source ~ll_source ~cd_source ~name static_indices (proc : t) :
Low_level.optimized =
let llc = to_low_level proc in
(* Generate the low-level code before outputting the assignments, to force projections. *)
Expand All @@ -387,4 +387,4 @@ let lower_proc ~unoptim_ll_source ~ll_source ~cd_source ~name static_indices (pr
| Some ppf ->
fprint_hum ~name ~static_indices () ppf proc;
Stdlib.Format.pp_print_flush ppf ());
Low_level.optimize_proc ~unoptim_ll_source ~ll_source ~name static_indices llc
Low_level.optimize ~unoptim_ll_source ~ll_source ~name static_indices llc
6 changes: 2 additions & 4 deletions arrayjit/lib/backends.ml
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ let lower_assignments ?name bindings asgns =
let ll_source = Utils.get_debug_formatter ~fname:(name ^ ".ll") in
let cd_source = Utils.get_debug_formatter ~fname:(name ^ ".cd") in
( name,
Assignments.lower_proc ~unoptim_ll_source ~ll_source ~cd_source ~name
Assignments.lower ~unoptim_ll_source ~ll_source ~cd_source ~name
(Indexing.bound_symbols bindings) asgns )

let lower_batch_assignments ?names ?occupancy bindings asgns_l =
Expand All @@ -526,9 +526,7 @@ let lower_batch_assignments ?names ?occupancy bindings asgns_l =
let asgns = asgns_l.(src_n) in
if occupancy ~name ~src_n then
( Some name,
Some
(Assignments.lower_proc ~unoptim_ll_source ~ll_source ~cd_source ~name bound asgns)
)
Some (Assignments.lower ~unoptim_ll_source ~ll_source ~cd_source ~name bound asgns) )
else (None, None))

let verify_prior_context ~get_array ~ctx_arrays ~is_in_context ~prior_context ~from_prior_context
Expand Down
2 changes: 1 addition & 1 deletion arrayjit/lib/low_level.ml
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ let fprint_hum ?name ?static_indices () ppf llc =
pp_ll ppf llc;
fprintf ppf "@]"

let%diagn2_sexp optimize_proc ~unoptim_ll_source ~ll_source ~(name : string)
let%diagn2_sexp optimize ~unoptim_ll_source ~ll_source ~(name : string)
(static_indices : Indexing.static_symbol list) (llc : t) : optimized =
Option.iter unoptim_ll_source ~f:(fun ppf ->
Stdlib.Format.fprintf ppf "%a%!" (fprint_hum ~name ~static_indices ()) llc);
Expand Down
2 changes: 1 addition & 1 deletion arrayjit/lib/low_level.mli
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ type traced_store = (Tnode.t, traced_array) Base.Hashtbl.t [@@deriving sexp_of]
type optimized = { traced_store : traced_store; llc : t; merge_node : Tnode.t option }
[@@deriving sexp_of]

val optimize_proc :
val optimize :
unoptim_ll_source:Stdlib.Format.formatter option ->
ll_source:Stdlib.Format.formatter option ->
name:string ->
Expand Down
2 changes: 1 addition & 1 deletion arrayjit/lib/writing_a_backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

## Design around compiling and running code, backend interfaces

Currently, OCANNL integrates new backends via code in [Backends](backends.ml), so it's the "sink" of backend module dependencies; [Backend_types](backend_types.ml) is the "source". `Backend_types.Types` introduces the context-specific `routine` type, for code executable on a backend. The interface `Backends.No_device_backend` has `compile` functions that take `Assignments.comp` as input, to allow full flexibility in backend implementations. There is a helper `Backends.lower_assignments` that wraps `Assignments.lower` and `Low_level.optimize_proc`, since currently all backends use the optimized C-like representation `Low_level.t`. `Backends.Backend` is the user-facing interface.
Currently, OCANNL integrates new backends via code in [Backends](backends.ml), so it's the "sink" of backend module dependencies; [Backend_types](backend_types.ml) is the "source". `Backend_types.Types` introduces the context-specific `routine` type, for code executable on a backend. The interface `Backends.No_device_backend` has `compile` functions that take `Assignments.comp` as input, to allow full flexibility in backend implementations. There is a helper `Backends.lower_assignments` that wraps `Assignments.lower` and `Low_level.optimize`, since currently all backends use the optimized C-like representation `Low_level.t`. `Backends.Backend` is the user-facing interface.

The functor `Multicore_backend` converts a `No_device_backend` typically targetting the CPU into a `Backend` whose devices are parallel threads (and ultimately the CPU cores).

Expand Down

0 comments on commit 3cb9936

Please sign in to comment.