@@ -105,7 +105,7 @@ namespace detail {
105105 *
106106 * @return Pointer to the static cuda_memory_resource used as the initial, default resource
107107 */
108- RMM_EXPORT inline device_memory_resource * initial_resource ()
108+ RMM_EXPORT inline cuda_memory_resource * initial_resource ()
109109{
110110 static cuda_memory_resource mr{};
111111 return &mr;
@@ -198,7 +198,7 @@ inline device_async_resource_ref set_per_device_resource_ref_unsafe(
198198 // Note: because resource_ref is not default-constructible, we can't use std::map::operator[]
199199 if (old_itr == map.end ()) {
200200 map.insert ({device_id.value (), new_resource_ref});
201- return device_async_resource_ref{detail::initial_resource ()};
201+ return device_async_resource_ref{* detail::initial_resource ()};
202202 }
203203
204204 auto old_resource_ref = old_itr->second ;
@@ -244,7 +244,7 @@ inline device_memory_resource* set_per_device_resource(cuda_device_id device_id,
244244 // state consistent with the resource pointer state. This is necessary because the
245245 // Python API still uses the raw pointer API. Once the Python API is updated to use
246246 // resource_ref, this call can be removed.
247- detail::set_per_device_resource_ref_unsafe (device_id, new_mr);
247+ if (new_mr != nullptr ) { detail::set_per_device_resource_ref_unsafe (device_id, * new_mr); }
248248
249249 auto & map = detail::get_map ();
250250 auto const old_itr = map.find (device_id.value ());
@@ -338,7 +338,7 @@ inline device_async_resource_ref get_per_device_resource_ref(cuda_device_id devi
338338 // If a resource was never set for `id`, set to the initial resource
339339 auto const found = map.find (device_id.value ());
340340 if (found == map.end ()) {
341- auto item = map.insert ({device_id.value (), detail::initial_resource ()});
341+ auto item = map.insert ({device_id.value (), * detail::initial_resource ()});
342342 return item.first ->second ;
343343 }
344344 return found->second ;
@@ -447,7 +447,7 @@ inline device_async_resource_ref set_current_device_resource_ref(
447447 */
448448inline device_async_resource_ref reset_per_device_resource_ref (cuda_device_id device_id)
449449{
450- return set_per_device_resource_ref (device_id, detail::initial_resource ());
450+ return set_per_device_resource_ref (device_id, * detail::initial_resource ());
451451}
452452
453453/* *
0 commit comments