Skip to content

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

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

ndgrigorian
Copy link
Collaborator

This PR adds full support for the DPC++ sycl_ext_oneapi_peer_access extension

This adds a Python interface to calls that check if a dpctl.SyclDevice can enable peer access to another dpctl.SyclDevice and, if so, to enable or disable it.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?
  • If this PR is a work in progress, are you opening the PR as a draft?

@ndgrigorian ndgrigorian force-pushed the feature/support-peer-access-extension branch from da9f596 to 20e80f1 Compare May 5, 2025 21:33
Copy link

github-actions bot commented May 5, 2025

Copy link

github-actions bot commented May 5, 2025

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_194 ran successfully.
Passed: 1109
Failed: 3
Skipped: 119

@coveralls
Copy link
Collaborator

coveralls commented May 5, 2025

Coverage Status

coverage: 85.222% (-1.2%) from 86.372%
when pulling bb1f1d9 on feature/support-peer-access-extension
into 3aff6ca on master.

Copy link

github-actions bot commented May 6, 2025

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_194 ran successfully.
Passed: 1109
Failed: 3
Skipped: 119

@ndgrigorian ndgrigorian force-pushed the feature/support-peer-access-extension branch from 20e80f1 to a21d585 Compare May 6, 2025 23:47
Copy link

github-actions bot commented May 7, 2025

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_199 ran successfully.
Passed: 1107
Failed: 5
Skipped: 119

Copy link

github-actions bot commented May 7, 2025

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_200 ran successfully.
Passed: 1109
Failed: 3
Skipped: 119

Copy link

github-actions bot commented May 7, 2025

Array API standard conformance tests for dpctl=0.20.0dev0=py310h93fe807_201 ran successfully.
Passed: 1108
Failed: 4
Skipped: 119

Comment on lines +1830 to +1853
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)}"
)
Copy link
Collaborator

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.

Comment on lines +917 to +935
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;
}
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants