forked from intel/llvm
-
Notifications
You must be signed in to change notification settings - Fork 3
[SYCL][DOC] Adding design document for command graph extension #183
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
5 commits
Select commit
Hold shift + click to select a range
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
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,66 @@ | ||
# Command Graph Extension | ||
|
||
This document describes the implementation design of the | ||
[SYCL Graph Extension](https://github.com/intel/llvm/pull/5626). | ||
|
||
A related presentation can be found | ||
[here](https://www.youtube.com/watch?v=aOTAmyr04rM). | ||
|
||
## Requirements | ||
|
||
An efficient implementation of a lazy command graph execution and its replay | ||
requires extensions to the UR layer. Such an extension is command buffers, | ||
where a command-buffer object represents a series of operations to be enqueued | ||
to the backend device and their dependencies. A single command graph can be | ||
partitioned into more than one command-buffer by the runtime. | ||
We distinguish between backends that support command buffer extensions and | ||
those that do not. Currently command buffer extensions are only supported by | ||
Level Zero. All other backends would fall back to an emulation mode, or not | ||
be reported as supported. | ||
|
||
The emulation mode targets support of functionality only, without potentially | ||
resulting performance improvements, i.e. execution of a closed Level Zero | ||
command list multiple times. | ||
|
||
### Command Buffer extension | ||
|
||
| Function | Description | | ||
| ------------------------- | ------------------------ | | ||
| `piextCommandBufferCreate` | create a command-buffer. | | ||
| `piextCommandBufferRetain` | incrementing reference count of command-buffer. | | ||
| `piextCommandBufferRelease` | decrementing reference count of command-buffer. | | ||
| `piextCommandBufferFinalize` | no more commands can be appended, makes command buffer ready to enqueue on command-queue. | | ||
| `piextCommandBufferNDRangeKernel` | append a kernel execution command to command buffer. | | ||
| `piextEnqueueCommandBuffer` | submit command-buffer to queue for execution | | ||
| `piextCommandBufferMemcpyUSM` | append a USM memcpy command to the command-buffer. | | ||
| `piextCommandBufferMemBufferCopy` | append a mem buffer copy command to the command-buffer. | | ||
| `piextCommandBufferMemBufferCopyRect` | append a rectangular mem buffer copy command to the command-buffer. | | ||
|
||
reble marked this conversation as resolved.
Show resolved
Hide resolved
|
||
## Design | ||
|
||
 | ||
|
||
There are two sets of user facing interfaces that can be used to create a | ||
command graph object: | ||
Explicit and Record & Replay API. Within the runtime they share a common | ||
infrastructure. | ||
|
||
## Scheduler integration | ||
|
||
When there are no requirements for accessors in a command graph the scheduler | ||
is bypassed and it is directly enqueued to a command buffer. If | ||
there are requirements, commands need to be enqueued by the scheduler. | ||
|
||
## Memory handling: Buffer and Accessor | ||
|
||
There is no extra support for Graph-specific USM allocations in the current | ||
proposal. Memory operations will be supported subsequently by the current | ||
implementation starting with `memcpy`. | ||
|
||
Buffers and accessors are supported in a command graph. Following restrictions | ||
are required to adapt buffers and their lifetime to a lazy work execution model: | ||
|
||
- Lifetime of a buffer with host data will be extended by copying the underlying | ||
data. | ||
- Host accessor on buffer that are used by a command graph are prohibited. | ||
- Copy-back behavior on destruction of a buffer is prohibited. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Uh oh!
There was an error while loading. Please reload this page.