-
Notifications
You must be signed in to change notification settings - Fork 124
Add support for command-buffer kernel updates #1924
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
aarongreig
merged 1 commit into
oneapi-src:main
from
Bensuo:fabio/cmd_buffer_kernel_update
Sep 30, 2024
Merged
Changes from all commits
Commits
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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 |
|---|---|---|
|
|
@@ -144,8 +144,8 @@ were obtained from. | |
| // sync-point | ||
| ${x}CommandBufferAppendKernelLaunchExp(hCommandBuffer, hKernel, workDim, | ||
| pGlobalWorkOffset, pGlobalWorkSize, | ||
| pLocalWorkSize, 1, &syncPoint, | ||
| nullptr, nullptr); | ||
| pLocalWorkSize, 0, nullptr, 1, | ||
| &syncPoint, nullptr, nullptr); | ||
|
|
||
| Enqueueing Command-Buffers | ||
| -------------------------------------------------------------------------------- | ||
|
|
@@ -167,13 +167,21 @@ Updating Command-Buffer Commands | |
|
|
||
| An adapter implementing the command-buffer experimental feature can optionally | ||
| support updating the configuration of kernel commands recorded to a | ||
| command-buffer. Support for this is reported by returning true in the | ||
| ${X}_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP query. | ||
| command-buffer. The attributes of kernel commands that can be updated are | ||
| device specific and can be queried using the | ||
| ${X}_DEVICE_INFO_COMMAND_BUFFER_UPDATE_CAPABILITIES_EXP query. | ||
|
|
||
| Updating kernel commands is done by passing the new kernel configuration | ||
| to ${x}CommandBufferUpdateKernelLaunchExp along with the command handle of | ||
| the kernel command to update. Configurations that can be changed are the | ||
| parameters to the kernel and the execution ND-Range. | ||
| kernel handle, the parameters to the kernel and the execution ND-Range. | ||
|
|
||
| Kernel handles that might be used to update the kernel of a command, need | ||
EwanC marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| to be registered when the command is created. This can be done | ||
| using the ``phKernelAlternatives`` parameter of | ||
| ${x}CommandBufferAppendKernelLaunchExp. The command can then be updated | ||
| to use the new kernel handle by passing it to | ||
| ${x}CommandBufferUpdateKernelLaunchExp. | ||
|
|
||
| .. parsed-literal:: | ||
|
|
||
|
|
@@ -187,12 +195,14 @@ parameters to the kernel and the execution ND-Range. | |
| ${x}CommandBufferCreateExp(hContext, hDevice, &desc, &hCommandBuffer); | ||
|
|
||
| // Append a kernel command which has two buffer parameters, an input | ||
| // and an output. | ||
| // and an output. Register hNewKernel as an alternative kernel handle | ||
| // which can later be used to change the kernel handle associated | ||
| // with this command. | ||
| ${x}_exp_command_buffer_command_handle_t hCommand; | ||
| ${x}CommandBufferAppendKernelLaunchExp(hCommandBuffer, hKernel, workDim, | ||
| pGlobalWorkOffset, pGlobalWorkSize, | ||
| pLocalWorkSize, 0, nullptr, | ||
| nullptr, &hCommand); | ||
| pLocalWorkSize, 1, &hNewKernel, | ||
| 0, nullptr, nullptr, &hCommand); | ||
|
|
||
| // Close the command-buffer before updating | ||
| ${x}CommandBufferFinalizeExp(hCommandBuffer); | ||
|
|
@@ -220,6 +230,7 @@ parameters to the kernel and the execution ND-Range. | |
| ${x}_exp_command_buffer_update_kernel_launch_desc_t update { | ||
| UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_KERNEL_LAUNCH_DESC, // stype | ||
| nullptr, // pNext | ||
| hNewKernel // hNewKernel | ||
| 2, // numNewMemobjArgs | ||
| 0, // numNewPointerArgs | ||
| 0, // numNewValueArgs | ||
|
|
@@ -249,7 +260,13 @@ Enums | |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| * ${x}_device_info_t | ||
| * ${X}_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP | ||
| * ${X}_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP | ||
| * ${X}_DEVICE_INFO_COMMAND_BUFFER_UPDATE_CAPABILITIES_EXP | ||
| * ${x}_device_command_buffer_update_capability_flags_t | ||
| * UPDATE_KERNEL_ARGUMENTS | ||
| * LOCAL_WORK_SIZE | ||
| * GLOBAL_WORK_SIZE | ||
| * GLOBAL_WORK_OFFSET | ||
| * KERNEL_HANDLE | ||
| * ${x}_result_t | ||
| * ${X}_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP | ||
| * ${X}_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP | ||
|
|
@@ -340,6 +357,8 @@ Changelog | |
| +-----------+-------------------------------------------------------+ | ||
| | 1.4 | Add function definitions for kernel command update | | ||
| +-----------+-------------------------------------------------------+ | ||
| | 1.5 | Add support for updating kernel handles. | | ||
| +-----------+-------------------------------------------------------+ | ||
|
|
||
| Contributors | ||
| -------------------------------------------------------------------------------- | ||
|
|
@@ -348,3 +367,4 @@ Contributors | |
| * Ewan Crawford `[email protected] <[email protected]>`_ | ||
| * Maxime France-Pillois `[email protected] <[email protected]>`_ | ||
| * Aaron Greig `[email protected] <[email protected]>`_ | ||
| * Fábio Mestre `[email protected] <[email protected]>`_ | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.