@@ -201,6 +201,65 @@ end) : Ir.Backend_impl.Lowered_backend = struct
201201 | Only_devices_parallel | For_parallel_copying | Most_parallel_streams -> 1
202202
203203 let get_used_memory _device = Atomic. get allocated_memory
204+
205+ let static_properties =
206+ let device_properties =
207+ Array. mapi metal_devices ~f: (fun ordinal device ->
208+ let attributes = Me.Device. get_attributes device in
209+ Sexp. List
210+ [
211+ Sexp. Atom " device" ;
212+ Sexp. List
213+ [
214+ Sexp. List [ Sexp. Atom " device_name" ; Sexp. Atom attributes.name ];
215+ Sexp. List [ Sexp. Atom " device_ordinal" ; Sexp. Atom (Int. to_string ordinal) ];
216+ Sexp. List
217+ [
218+ Sexp. Atom " registry_id" ;
219+ Sexp. Atom (Unsigned.ULLong. to_string attributes.registry_id);
220+ ];
221+ Sexp. List
222+ [
223+ Sexp. Atom " max_buffer_length" ;
224+ Sexp. Atom (Unsigned.ULong. to_string attributes.max_buffer_length);
225+ ];
226+ Sexp. List
227+ [
228+ Sexp. Atom " max_threadgroup_memory_length" ;
229+ Sexp. Atom (Unsigned.ULong. to_string attributes.max_threadgroup_memory_length);
230+ ];
231+ Sexp. List
232+ [
233+ Sexp. Atom " recommended_max_working_set_size" ;
234+ Sexp. Atom
235+ (Unsigned.ULLong. to_string attributes.recommended_max_working_set_size);
236+ ];
237+ Sexp. List
238+ [ Sexp. Atom " is_low_power" ; Sexp. Atom (Bool. to_string attributes.is_low_power) ];
239+ Sexp. List
240+ [ Sexp. Atom " is_headless" ; Sexp. Atom (Bool. to_string attributes.is_headless) ];
241+ Sexp. List
242+ [
243+ Sexp. Atom " has_unified_memory" ;
244+ Sexp. Atom (Bool. to_string attributes.has_unified_memory);
245+ ];
246+ Sexp. List
247+ [
248+ Sexp. Atom " total_memory" ;
249+ Sexp. Atom (Int. to_string (Atomic. get allocated_memory));
250+ ];
251+ Sexp. List
252+ [
253+ Sexp. Atom " supported_gpu_families" ;
254+ Sexp. List
255+ (List. map attributes.supported_gpu_families ~f: (fun gpu_family ->
256+ Me.Device.GPUFamily. sexp_of_t gpu_family));
257+ ];
258+ ];
259+ ])
260+ in
261+ Sexp. List (Sexp. Atom " metal_devices" :: Array. to_list device_properties)
262+
204263 let get_global_debug_info () = Sexp. Atom " Metal global debug info NYI"
205264
206265 let get_debug_info stream =
@@ -414,7 +473,7 @@ end) : Ir.Backend_impl.Lowered_backend = struct
414473
415474 let % diagn_sexp compile_metal_source ~name ~source ~device =
416475 let options = Me.CompileOptions. init () in
417- Me.CompileOptions. set_language_version options Me.CompileOptions.LanguageVersion. version_3_1 ;
476+ Me.CompileOptions. set_language_version options Me.CompileOptions.LanguageVersion. version_3_0 ;
418477 if Utils. debug_log_from_routines () then Me.CompileOptions. set_enable_logging options true ;
419478
420479 if Utils. with_runtime_debug () then (
0 commit comments