@@ -123,6 +123,8 @@ module type Device_config = sig
123123 (* * An event tracks if a stream finished computing past a particular point in its schedue. These
124124 values are used internally for scheduling across streams of the backend, and can be used for
125125 explicit scheduling. *)
126+
127+ val name : string
126128end
127129
128130type ('buffer_ptr, 'dev, 'event) device = {
@@ -148,7 +150,9 @@ type ('buffer_ptr, 'dev, 'runner, 'event) stream = {
148150 merge_buffer : ('buffer_ptr * Tnode .t ) option ref ;
149151 stream_id : int ;
150152 mutable allocated_buffer : 'buffer_ptr buffer option ;
151- queried_work_for : 'event option Hashtbl .M (Tnode ).t; (* The completion event for updating the node via this stream. Only populated after the first time {!} *)
153+ queried_work_for : 'event option Hashtbl .M (Tnode ).t;
154+ (* The completion event for updating the node via this stream. Only populated after the first
155+ time {!} *)
152156}
153157[@@ deriving sexp_of ]
154158
@@ -174,6 +178,7 @@ module type Device = sig
174178
175179 val make_device : dev -> ordinal :int -> device
176180 val make_stream : device -> runner -> stream_id :int -> stream
181+ val get_name : stream -> string
177182end
178183
179184module Device_types (Device_config : Device_config ) = struct
@@ -211,6 +216,8 @@ struct
211216 allocated_buffer = None ;
212217 queried_work_for = Hashtbl. create (module Tnode );
213218 }
219+
220+ let get_name stream = [% string " %{name}:%{stream.device.ordinal#Int}:%{stream.stream_id#Int}" ]
214221end
215222
216223(* * Parts shared by both assignments-level and lowered-level backend interfaces. *)
@@ -224,8 +231,6 @@ module type Backend_any_common = sig
224231 (* * For backends derived via {!No_device_backend}, this is usually the backend name concatenated
225232 with the device or stream number. For {!Backend}, [init_info = stream]. *)
226233
227- val name : string
228-
229234 val initialize : config -> unit
230235 (* * Initializes a backend before first use. Typically does nothing if the backend is already
231236 initialized, but some backends can do some safe cleanups. *)
@@ -286,6 +291,8 @@ module type No_device_backend = sig
286291 include Backend_common with type init_info := string and type stream := unit
287292 include Backend_impl_common with type context := context and type buffer_ptr := buffer_ptr
288293
294+ val name : string
295+
289296 val link : merge_buffer :(buffer_ptr * Tnode .t ) option ref -> context -> code -> context routine
290297 (* * Returns the routine for the code's procedure, in a new context derived from the given context. *)
291298
@@ -350,9 +357,6 @@ module type Backend_device_common = sig
350357
351358 val new_stream : device -> stream
352359 val get_ctx_stream : context -> stream
353- val get_stream_device : stream -> device
354- val to_ordinal : device -> int
355- val get_name : stream -> string
356360end
357361
358362module type With_buffer_retrieval_and_syncing = sig
@@ -427,6 +431,8 @@ module type Lowered_no_device_backend = sig
427431 and type init_info := string
428432 and type buffer_ptr := buffer_ptr
429433
434+ val name : string
435+
430436 type procedure [@@deriving sexp_of]
431437
432438 val compile :
0 commit comments