-
Notifications
You must be signed in to change notification settings - Fork 29
Support peer access DPC++ extension #2077
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
da9f596
to
20e80f1
Compare
View rendered docs @ https://intelpython.github.io/dpctl/pulls/2077/index.html |
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_194 ran successfully. |
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_194 ran successfully. |
libsyclinterface/include/syclinterface/dpctl_sycl_device_interface.h
Outdated
Show resolved
Hide resolved
libsyclinterface/include/syclinterface/dpctl_sycl_device_interface.h
Outdated
Show resolved
Hide resolved
only implemented for backends HIP, CUDA, Level Zero. Validation prevents crashes
Peer device docstrings link to related methods and docs on peer access extension Slips in fixes to other docstrings for SyclDevice methods
More user-readable
20e80f1
to
a21d585
Compare
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_199 ran successfully. |
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_200 ran successfully. |
Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_201 ran successfully. |
if not isinstance(peer, SyclDevice): | ||
raise TypeError( | ||
"peer device must be a `dpctl.SyclDevice`, got " | ||
f"{type(peer)}" | ||
) | ||
p_dev = <SyclDevice>peer | ||
|
||
_peer_access_backends = [ | ||
_backend_type._CUDA, | ||
_backend_type._HIP, | ||
_backend_type._LEVEL_ZERO | ||
] | ||
BTy1 = DPCTLDevice_GetBackend(self._device_ref) | ||
if BTy1 not in _peer_access_backends: | ||
raise ValueError( | ||
"Peer access not supported for this device backend " | ||
f"{_backend_type_to_filter_string_part(BTy1)}" | ||
) | ||
BTy2 = DPCTLDevice_GetBackend(p_dev.get_device_ref()) | ||
if BTy2 not in _peer_access_backends: | ||
raise ValueError( | ||
"Peer access not supported for peer device backend " | ||
f"{_backend_type_to_filter_string_part(BTy2)}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The checks are common for all four new functions. It probably makes sense to separate that to helper function.
if (BE1 != sycl::backend::ext_oneapi_level_zero && | ||
BE1 != sycl::backend::ext_oneapi_cuda && | ||
BE1 != sycl::backend::ext_oneapi_hip) | ||
{ | ||
std::ostringstream os; | ||
os << "Backend " << BE1 << " does not support peer access"; | ||
error_handler(os.str(), __FILE__, __func__, __LINE__); | ||
return false; | ||
} | ||
|
||
if (BE2 != sycl::backend::ext_oneapi_level_zero && | ||
BE2 != sycl::backend::ext_oneapi_cuda && | ||
BE2 != sycl::backend::ext_oneapi_hip) | ||
{ | ||
std::ostringstream os; | ||
os << "Backend " << BE2 << " does not support peer access"; | ||
error_handler(os.str(), __FILE__, __func__, __LINE__); | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems duplicating across all new functions. The checks might be moved to a separate internal helper function.
This PR adds full support for the DPC++
sycl_ext_oneapi_peer_access
extensionThis adds a Python interface to calls that check if a
dpctl.SyclDevice
can enable peer access to anotherdpctl.SyclDevice
and, if so, to enable or disable it.