Skip to content

Commit

Permalink
Properly handle cudaMemHandleTypeNone and cudaErrorInvalidValue in is…
Browse files Browse the repository at this point in the history
…_export_handle_type_supported (#1055)

- [x] Intercept `cudaErrorInvalidValue` returned from `cudaDeviceGetAttribute` to return `false` from `is_export_handle_type_supported ` 
- [x]  Return true from is_export_handle_type_supported for `cudaMemHandleTypeNone`

Co-authored-by: @jrhemstad 
Co-authored-by: @harrism 

Closes #1054

Signed-off-by: Gera Shegalov <[email protected]>

Authors:
  - Gera Shegalov (https://github.com/gerashegalov)

Approvers:
  - Rong Ou (https://github.com/rongou)
  - Mark Harris (https://github.com/harrism)

URL: #1055
  • Loading branch information
gerashegalov authored Jun 6, 2022
1 parent 270b35b commit 89713b2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions include/rmm/detail/dynamic_load_runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,18 @@ struct async_alloc {
{
int supported_handle_types_bitmask{};
#if CUDART_VERSION >= 11030 // 11.3 introduced cudaDevAttrMemoryPoolSupportedHandleTypes
RMM_CUDA_TRY(cudaDeviceGetAttribute(&supported_handle_types_bitmask,
cudaDevAttrMemoryPoolSupportedHandleTypes,
rmm::detail::current_device().value()));
if (cudaMemHandleTypeNone != handle_type) {
auto const result = cudaDeviceGetAttribute(&supported_handle_types_bitmask,
cudaDevAttrMemoryPoolSupportedHandleTypes,
rmm::detail::current_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);
}

#endif
return (supported_handle_types_bitmask & handle_type) == handle_type;
}
Expand Down

0 comments on commit 89713b2

Please sign in to comment.