Copyright © 2022 Intel Corporation. All rights reserved.
Khronos® is a registered trademark and SYCL™ and SPIR™ are trademarks of The Khronos Group Inc. OpenCL™ is a trademark of Apple Inc. used by permission by Khronos.
To report problems with this extension, please open a new issue at:
This extension is written against the SYCL 2020 revision 9 specification. All references below to the "core SYCL specification" or to section numbers in the SYCL specification refer to that revision.
This extension is currently implemented in DPC++ for all GPU devices and
backends; however, only the CUDA, HIP and Level Zero backends allows peer to
peer memory access. Other backends report false from the
ext_oneapi_can_access_peer query. Peer-Peer memory access is only possible
between two devices from the same backend.
This extension adds support for mechanisms to query and enable support for memory access between peer devices in a system. In particular, this allows one device to access USM Device allocations for a peer device. This extension does not apply to USM Shared allocations. Peer to peer capabilities are useful as they can provide access to a peer device’s memory inside a compute kernel and optimized memory copies between peer devices.
This extension provides a feature-test macro as described in the core SYCL
specification. An implementation supporting this extension must predefine the
macro SYCL_EXT_ONEAPI_PEER_ACCESS to one of the values defined in the table
below. Applications can test for the existence of this macro to determine if
the implementation supports this feature, or applications can test the macro’s
value to determine which of the extension’s features the implementation
supports.
| Value | Description |
|---|---|
1 |
Initial version of this extension. |
This extension adds support for mechanisms to query and enable support for direct memory access between peer devices in a system. In particular, this allows one device to directly access USM Device allocations for a peer device in the same context. Peer to peer capabilities are useful as they can provide access to a peer device’s memory inside a compute kernel and also optimized memory copies between peer devices.
This extension adds the following new member functions to the device class, as described below.
namespace sycl {
namespace ext {
namespace oneapi {
enum class peer_access {
access_supported,
atomics_supported,
};
} // namespace oneapi
} // namespace ext
class device {
public:
bool ext_oneapi_can_access_peer(const device &peer,
ext::oneapi::peer_access value =
ext::oneapi::peer_access::access_supported);
void ext_oneapi_enable_peer_access(const device &peer);
void ext_oneapi_disable_peer_access(const device &peer);
};
} // namespace syclThe semantics of the new functions are:
| Member Function | Description |
|---|---|
bool ext_oneapi_can_access_peer(const device &peer, ext::oneapi::peer_access value = ext::oneapi::peer_access::access_supported) |
Queries the peer access status between this device and
|
void ext_oneapi_enable_peer_access(const device &peer) |
Enables this device to access USM device allocations located on the peer
device. This does not permit the peer device to access this device’s memory.
Once this access is enabled, SYCL kernel functions and the explicit memory
functions may access USM device allocations on the peer device subject to the
normal rules about context as described in the core SYCL specification.
If this device does not support peer access (as defined by
|
void ext_oneapi_disable_peer_access(const device &peer) |
Disables access to the peer device’s memory from this device. If peer access
is not enabled, throws an |