-
Notifications
You must be signed in to change notification settings - Fork 795
[SYCL][DOC] Add initial spec draft for new default device #15382
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8107ee0
Add initial spec draft for new default devices and queues
jbrodman 56db9f9
Update sycl/doc/extensions/proposed/sycl_ext_oneapi_global_defaults.a…
jbrodman 861a2fa
Update sycl/doc/extensions/proposed/sycl_ext_oneapi_global_defaults.a…
jbrodman 0ff778e
Update sycl/doc/extensions/proposed/sycl_ext_oneapi_global_defaults.a…
jbrodman 9e9483f
Update sycl/doc/extensions/proposed/sycl_ext_oneapi_global_defaults.a…
jbrodman bf2f7b8
Update sycl/doc/extensions/proposed/sycl_ext_oneapi_global_defaults.a…
jbrodman 8a55848
Apply suggestions
jbrodman 45d7580
Change CRLF to LF.
jbrodman 6c72329
Add language specifying that the current device is per-thread.
jbrodman 5d098ce
Remove free enqueue/alloc/dealloc functions
jbrodman f9eb365
Strip it back to just the default device for now
jbrodman 50167bc
Commit the removals I forgot earlier and some edits.
jbrodman 1f7e658
Rename extension to current device from global defaults
jbrodman 899c21c
Begone pesky empty line
jbrodman 4d1c2b6
Edits
jbrodman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
140 changes: 140 additions & 0 deletions
140
sycl/doc/extensions/proposed/sycl_ext_oneapi_current_device.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| = sycl_ext_oneapi_current_device | ||
|
|
||
|
|
||
| :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) 2024 Intel Corporation. All rights reserved. | ||
jbrodman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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 9 specification. All | ||
| 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 introduces additional state into SYCL in order to simplify | ||
| programming for developers. The extension provides a mechanism to both set and | ||
| query the 'current' per-thread `sycl::device`. By adding the notion of a 'current' | ||
| device, this can simplify interfaces and reduce the amount of boilerplate code | ||
| required to write a SYCL application. | ||
|
|
||
| Since this function relates to the environment of the calling thread, | ||
| it is the user's responsibility to ensure that it is called by the correct thread. | ||
| For example, it is unsafe to call this function inside of a host task, within an | ||
| asynchronous error handler, or within other functions that may be executed | ||
| asynchronously, since these operations are not guaranteed to execute on any | ||
| specific thread. | ||
|
|
||
| == 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_CURRENT_DEVICE` 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. | ||
| |=== | ||
|
|
||
| === New free functions | ||
|
|
||
| This extension adds the following new free functions: | ||
|
|
||
|
|
||
| ''' | ||
|
|
||
| [frame=all,grid=none,separator="@"] | ||
| !==== | ||
| a@ | ||
| [source,c++] | ||
| ---- | ||
| namespace sycl::ext::oneapi::experimental::this_thread { | ||
|
|
||
| sycl::device get_current_device(); | ||
|
|
||
| } // namespace sycl::ext::oneapi::experimental::this_thread | ||
| ---- | ||
| !==== | ||
|
|
||
| _Returns:_ The current default device for the calling host thread. If | ||
| `set_current_device()` has not been called by this thread, returns the | ||
| device selected by the default device selector. | ||
|
|
||
| _Preconditions:_ The function is called from a host thread, executing | ||
| outside of a host task or an asynchronous error handler. | ||
|
|
||
| ''' | ||
|
|
||
| [frame=all,grid=none,separator="@"] | ||
| !==== | ||
| a@ | ||
| [source,c++] | ||
| ---- | ||
| namespace sycl::ext::oneapi::experimental::this_thread { | ||
|
|
||
| void set_current_device(sycl::device dev); | ||
|
|
||
| } // namespace sycl::ext::oneapi::experimental::this_thread | ||
| ---- | ||
| !==== | ||
|
|
||
| _Effects:_ Sets the current default device to `dev` for the calling host thread. | ||
|
|
||
| _Preconditions:_ The function is called from a host thread, executing outside | ||
| of a host task or an asynchronous error handler. | ||
|
|
||
| == Issues | ||
| . [RESOLVED] Should the current device be global or should we also support a per-thread | ||
| device? Answer: It should be per-thread to align with the behavior of other programming | ||
| models. | ||
| . [OPEN] We want to add a default queue per device. Should this queue be in-order or out-of-order? | ||
| Do we want to allow the user to specify this? | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
From the description: "It also extends the new launch mechanisms with queue-less forms that utilize the default device's default queue."
Am I correct that these changes will be introduced in separate PR/spec?
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.
Good catch. The PR description should be changed.
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.
Fixed. Took a second to realize this was the PR description and not the spec. :)