@@ -30,6 +30,8 @@ module Backend_buffer = struct
3030 end )
3131end
3232
33+ let unified_memory = false
34+
3335module Device_config = struct
3436 include Backend_buffer
3537
@@ -261,11 +263,6 @@ let%diagn2_sexp cuda_to_ptx ~name cu_src =
261263 Stdio.Out_channel. close oc);
262264 ptx
263265
264- let is_in_context node =
265- (* FIXME: shouldn't we use Tnode.is_in_context_force? *)
266- Tnode. default_to_most_local node.Low_level. tn 33 ;
267- match node.tn.memory_mode with Some ((Virtual | Local ), _ ) -> false | _ -> true
268-
269266module C_syntax_config (Input : sig
270267 val for_lowereds : Low_level .optimized array
271268end ) =
@@ -276,7 +273,7 @@ struct
276273
277274 let opt_ctx_arrays = None
278275 let hardcoded_context_ptr = None
279- let is_in_context = is_in_context
276+ let unified_memory = unified_memory
280277 let host_ptrs_for_readonly = false
281278 (* GPUs cannot access host memory pointers directly. *)
282279
@@ -449,39 +446,6 @@ let link_proc ~prior_context ~name ~(params : (string * param_source) list) ~ctx
449446 work;
450447 }
451448
452- let % track3_sexp alloc_if_needed ctx stream ~key ~data: node ctx_arrays =
453- if is_in_context node && not (Map. mem ctx_arrays key) then (
454- [% log2 Tn. debug_name key, " read_only" , (node.read_only : bool )];
455- [% log3 (key : Tn.t )];
456- let default () : buffer_ptr =
457- set_ctx ctx;
458- Cu.Deviceptr. mem_alloc ~size_in_bytes: (Tn. size_in_bytes key)
459- in
460- let add_new () = Map. add_exn ctx_arrays ~key ~data: (default () ) in
461- let device = stream.device in
462- if node.read_only then
463- if Tn. known_non_cross_stream key then add_new ()
464- else (
465- if Hashtbl. mem device.cross_stream_candidates key then
466- Tn. update_memory_sharing key Tn. Shared_cross_stream 40 ;
467- let data = Hashtbl. find_or_add device.cross_stream_candidates key ~default in
468- Map. add_exn ctx_arrays ~key ~data )
469- else if Tn. known_shared_cross_stream key then (
470- if Hashtbl. mem device.owner_streams key then
471- if not (stream.stream_id = Hashtbl. find_exn device.owner_streams key) then
472- raise
473- @@ Utils. User_error
474- (" Cuda_backend.alloc_if_needed: node " ^ Tn. debug_name key
475- ^ " assumed to be cross-stream-shared but then written to on multiple devices" )
476- else Hashtbl. add_exn device.owner_streams ~key ~data: stream.stream_id;
477- let data = Hashtbl. find_exn device.cross_stream_candidates key in
478- Map. add_exn ctx_arrays ~key ~data )
479- else (
480- Tn. update_memory_sharing key Tn. Per_stream 41 ;
481- Hashtbl. remove device.cross_stream_candidates key;
482- add_new () ))
483- else ctx_arrays
484-
485449let run_options () =
486450 if Utils. with_runtime_debug () then
487451 Cu.Module. [ GENERATE_DEBUG_INFO true ; GENERATE_LINE_INFO true ]
0 commit comments