-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
cudaMallocAsync
logic non-optional as we require CUDA 11.2+ (#…
…1667) We can remove the optimizations around `CUDA_STATIC_RUNTIME` and instead see if the function is already in the process space so that RMM doesn't need to have any build context to run properly Fixes #1679 Authors: - Robert Maynard (https://github.com/robertmaynard) Approvers: - Mark Harris (https://github.com/harrism) - Vyas Ramasubramani (https://github.com/vyasr) URL: #1667
- Loading branch information
1 parent
c7fc017
commit 929a595
Showing
16 changed files
with
131 additions
and
359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright (c) 2022-2024, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#pragma once | ||
|
||
#include <rmm/cuda_device.hpp> | ||
#include <rmm/detail/export.hpp> | ||
|
||
#include <cuda_runtime_api.h> | ||
|
||
#include <dlfcn.h> | ||
|
||
#include <memory> | ||
#include <optional> | ||
|
||
namespace RMM_NAMESPACE { | ||
namespace detail { | ||
|
||
/** | ||
* @brief Determine at runtime if the CUDA driver supports the stream-ordered | ||
* memory allocator functions. | ||
* | ||
* This allows RMM users to compile/link against CUDA 11.2+ and run with | ||
* older drivers. | ||
*/ | ||
|
||
struct runtime_async_alloc { | ||
static bool is_supported() | ||
{ | ||
static auto driver_supports_pool{[] { | ||
int cuda_pool_supported{}; | ||
auto result = cudaDeviceGetAttribute(&cuda_pool_supported, | ||
cudaDevAttrMemoryPoolsSupported, | ||
rmm::get_current_cuda_device().value()); | ||
return result == cudaSuccess and cuda_pool_supported == 1; | ||
}()}; | ||
return driver_supports_pool; | ||
} | ||
|
||
/** | ||
* @brief Check whether the specified `cudaMemAllocationHandleType` is supported on the present | ||
* CUDA driver/runtime version. | ||
* | ||
* @param handle_type An IPC export handle type to check for support. | ||
* @return true if supported | ||
* @return false if unsupported | ||
*/ | ||
static bool is_export_handle_type_supported(cudaMemAllocationHandleType handle_type) | ||
{ | ||
int supported_handle_types_bitmask{}; | ||
if (cudaMemHandleTypeNone != handle_type) { | ||
auto const result = cudaDeviceGetAttribute(&supported_handle_types_bitmask, | ||
cudaDevAttrMemoryPoolSupportedHandleTypes, | ||
rmm::get_current_cuda_device().value()); | ||
|
||
// Don't throw on cudaErrorInvalidValue | ||
auto const unsupported_runtime = (result == cudaErrorInvalidValue); | ||
if (unsupported_runtime) return false; | ||
// throw any other error that may have occurred | ||
RMM_CUDA_TRY(result); | ||
} | ||
return (supported_handle_types_bitmask & handle_type) == handle_type; | ||
} | ||
}; | ||
|
||
} // namespace detail | ||
} // namespace RMM_NAMESPACE |
Oops, something went wrong.