-
Notifications
You must be signed in to change notification settings - Fork 795
[SYCL][DOC] Initial commit of oneapi extension proposal for adding P2P #6104
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
Changes from 2 commits
19bc35a
96ff0cc
164f462
2eb8ff8
e3b12fc
15e306d
410d806
d28af85
0c4d39d
ab8625e
006dd20
2329d71
232ce60
549ce0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| = sycl_ext_oneapi_peer_access | ||
|
|
||
| :source-highlighter: coderay | ||
| :coderay-linenums-mode: table | ||
|
|
||
| // This section needs to be after the document title. | ||
| :doctype: book | ||
| :toc2: | ||
| :toc: left | ||
| :encoding: utf-8 | ||
| :lang: en | ||
| :dpcpp: pass:[DPC++] | ||
|
|
||
| // Set the default source code type in this document to C++, | ||
| // for syntax highlighting purposes. This is needed because | ||
| // docbook uses c++ and html5 uses cpp. | ||
| :language: {basebackend@docbook:c++:cpp} | ||
|
|
||
|
|
||
| == Notice | ||
|
|
||
| [%hardbreaks] | ||
| Copyright (C) 2022-2022 Intel Corporation. All rights reserved. | ||
|
|
||
| Khronos(R) is a registered trademark and SYCL(TM) and SPIR(TM) are trademarks | ||
| of The Khronos Group Inc. OpenCL(TM) is a trademark of Apple Inc. used by | ||
| permission by Khronos. | ||
|
|
||
|
|
||
| == Contact | ||
|
|
||
| To report problems with this extension, please open a new issue at: | ||
|
|
||
| https://github.com/intel/llvm/issues | ||
|
|
||
|
|
||
| == Dependencies | ||
|
|
||
| This extension is written against the SYCL 2020 revision 5 specification. All | ||
jbrodman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| references below to the "core SYCL specification" or to section numbers in the | ||
| SYCL specification refer to that revision. | ||
|
|
||
| == Status | ||
|
|
||
| This is a proposed extension specification, intended to gather community | ||
| feedback. Interfaces defined in this specification may not be implemented yet | ||
| or may be in a preliminary state. The specification itself may also change in | ||
| incompatible ways before it is finalized. *Shipping software products should | ||
| not rely on APIs defined in this specification.* | ||
|
|
||
|
|
||
| == Overview | ||
|
|
||
| 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. | ||
|
|
||
| == Specification | ||
|
|
||
| === Feature test macro | ||
|
|
||
| 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. | ||
|
|
||
| [%header,cols="1,5"] | ||
| |=== | ||
| |Value | ||
| |Description | ||
|
|
||
| |1 | ||
| |Initial version of this extension. | ||
| |=== | ||
|
|
||
|
|
||
| === Peer to Peer (P2P) Memory Access APIs | ||
|
|
||
| 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. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If two devices with P2P capabilities are placed in the same context, shouldn't this be implicitly enabled?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There has been a lot of discussion about what a context means. I think our current consensus is that it does not provide any guarantee about P2P access between devices. Therefore, placing two devices in the same context does not provide any guarantee that USM memory allocated for one of those devices is accessible from another device in that same context. See the discussion in internal Khronos issue 563. |
||
| 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 four new member functions to the device class, as described | ||
jbrodman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| below. | ||
|
|
||
| [source,c++] | ||
| ---- | ||
| namespace sycl { | ||
| namespace ext { | ||
| namespace oneapi { | ||
| enum class peer_access { | ||
| access_supported, | ||
| access_enabled, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops! |
||
| 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 sycl | ||
| ---- | ||
|
|
||
| The semantics of the new functions are: | ||
|
|
||
| |=== | ||
| | Member Function | Description | ||
|
|
||
| | bool ext_oneapi_can_access_peer(device peer, | ||
jbrodman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ext::oneapi::peer_access value = | ||
| ext::oneapi::peer_access::access_supported) | ||
| | Queries if this device may directly access the peer device's memory. | ||
| Returns true if access is supported and `value` is defaulted to | ||
| `ext::oneapi::peer_access::access_supported`. Returns true if `value` is | ||
| `ext::oneapi::peer_access::access_enabled` and peer access has been enabled | ||
| between this device and the peer device. Returns true if `value` is | ||
| `ext::oneapi::peer_access::atomics_supported` and this device can perform atomic | ||
| operations on the peer's memory. Returns false otherwise. | ||
jbrodman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| | void enable_peer_access(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. | ||
| This device must be in the same context as the allocations being accessed. | ||
gmlueck marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Throws an exception if access cannot be enabled or if access is already | ||
| enabled. | ||
gmlueck marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| | void disable_peer_access(device peer) | ||
| | Disables access to the peer device's memory from this device. Throws an | ||
| exception if access cannot be disabled or if access is not enabled. | ||
gmlueck marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| |=== | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.