[libcu++] Fix peer access case in is_pointer_accessible#9478
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
SummaryThis PR fixes ChangesImplementation (
|
| Layer / File(s) | Summary |
|---|---|
Expanded __is_device_accessible implementation libcudacxx/include/cuda/__memory/is_pointer_accessible.h |
Includes ensure_current_context.h; replaces the peer-access-only return with a two-stage flow: peer gate for non-managed pointers, then __ensure_current_context + CU_POINTER_ATTRIBUTE_DEVICE_POINTER query + null check; errors handled with _CCCL_TRY/_CCCL_CATCH_ALL returning false or rethrowing. |
Pool helper refactor and multi-device test fixes libcudacxx/test/libcudacxx/cuda/memory/is_pointer_accessible.pass.cpp |
Introduces create_memory_pool (constructs pool, calls cudaMemPoolSetAccess, returns handle) and simplifies allocate_memory_from_pool to take only cudaMemPool_t; rewires test_memory_pool_impl; fixes cudaDeviceCanAccessPeer argument order; changes peer enablement from dev1 to dev0; replaces cudaDeviceEnablePeerAccess with cudaMemPoolSetAccess in test_multiple_devices_from_pool. |
Suggested reviewers
- Jacobfaib
- davebayer
Comment @coderabbitai help to get the list of available commands and usage tips.
This comment has been minimized.
This comment has been minimized.
|
|
||
| void* __device_ptr = nullptr; | ||
| const auto __ptr_status = | ||
| ::cuda::__driver::__pointerGetAttributeNoThrow<::CU_POINTER_ATTRIBUTE_DEVICE_POINTER>(__device_ptr, __p); |
There was a problem hiding this comment.
would be possible to move this query to the initial __pointerGetAttributesNoThrow call?
There was a problem hiding this comment.
Ahh, yes! We can remove the CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL and query CU_POINTER_ATTRIBUTE_DEVICE_POINTER instead. Good idea
This comment has been minimized.
This comment has been minimized.
🥳 CI Workflow Results🟩 Finished in 5h 06m: Pass: 100%/503 | Total: 4d 22h | Max: 1h 04m | Hits: 90%/738186See results here. |
is_pointer_accessibleis currently wrong in peer-access cases. It usescudaCeviceCanAccessPeer, which checks for possibility of peer access, not if it's enabled or not. This PR changes that to use pointer attributes to query the device pointer for a specific device and instead return false if that query fails.This PR also fixes usage of
cudaDeviceEnablePeerAccessin the tests foris_pointer_accessibleto correctly juggle the explicit argument and implicit current context argument and to disable peer access after the test cases