Skip to content

Commit 51efbe7

Browse files
committed
Squashed commit of the following:
commit 2348227 Author: Ben Tracy <[email protected]> Date: Wed Apr 19 14:48:17 2023 +0100 [SYCL] Update graph constructor/finalize to current spec (#140) - Add device and context params to graph constructor - Remove context from finalize - Minor changes to graph_impl to support this - Update all examples to use updated API - Tidied up ordering of graph_impl declarations a little commit 7e580c5 Author: Ben Tracy <[email protected]> Date: Wed Apr 19 13:46:52 2023 +0100 [SYCL] Fix subgraphs, move sync points to exec graph (#134) * [SYCL] Fix subgraphs, move sync points to exec graph - Fixes subgraph support for command buffer graphs - Move sync points to executable graph instead of node - Removed unused graph impl from nodes - Kernel dims are now correctly reversed before submission with dims > 1 - Remove unnecessary call to piEventCreate commit 2f75c88 Author: Ewan Crawford <[email protected]> Date: Thu Apr 13 12:48:40 2023 +0100 [SYCL] Replace lazy queue property with PI command-buffers. (#100) - Remove lazy queue property - Use command buffers inside graphs for execution - Separate executable graph impl from modifiable graph impl - Implement handler::depends_on for record and replay nodes - New test for finalizing different graphs from the same modifiable one - graph-record-dotp now uses handler::depends_on - Implement arg filtering before setting args - Make applyFuncOnFilteredArgs accessible from commands.hpp - Track dependencies through empty nodes in graphs - Guard reduction use in device mem example - Fix issues with empty node example - Guard command buffer behind SYCL_EXT_ONEAPI_GRAPH - Recreate simple submission in emulation mode --------- Co-authored-by: Ben Tracy <[email protected]> commit 33d64f9 Author: Pablo Reble <[email protected]> Date: Fri Mar 31 12:46:04 2023 -0500 [SYCL] Add empty node implementation (#112) Co-authored-by: Ben Tracy <[email protected]> commit 187c9d0 Merge: ec71841 7d4e315 Author: Julian Miller <[email protected]> Date: Thu Mar 30 18:21:03 2023 +0200 Merge pull request #115 from reble/julianmi/graph-testing-waits Graph Testing: Add missing waits and USM device tests commit ec71841 Merge: 1efde99 9b95a70 Author: Julian Miller <[email protected]> Date: Thu Mar 30 18:20:44 2023 +0200 Merge pull request #71 from reble/julianmi/graph-emulation-macro Guard SYCL Graph implementation and fallback emulation commit 7d4e315 Author: Julian Miller <[email protected]> Date: Wed Mar 29 12:05:55 2023 +0200 Add USM device graph test commit 6b89b23 Author: Julian Miller <[email protected]> Date: Wed Mar 29 12:04:50 2023 +0200 Add missing waits in graph tests commit 9b95a70 Author: Julian Miller <[email protected]> Date: Tue Mar 28 19:15:55 2023 +0200 Remove unneeded includes commit e285e0a Author: Julian Miller <[email protected]> Date: Wed Mar 22 17:43:00 2023 +0100 Add compiler configuration instructions for SYCL Graph commit 5f31bfa Author: Pablo Reble <[email protected]> Date: Wed Mar 1 14:59:14 2023 -0600 Update README.md commit 7370c0b Author: Pablo Reble <[email protected]> Date: Wed Mar 1 08:48:16 2023 -0600 Update README.md add first draft of landing page commit e5f4da8 Author: Julian Miller <[email protected]> Date: Tue Mar 21 17:27:01 2023 +0100 Remove guarded members commit 26b24a9 Author: Julian Miller <[email protected]> Date: Mon Mar 13 17:25:43 2023 +0100 Add feature test macro commit 152ccea Author: Julian Miller <[email protected]> Date: Fri Jan 20 18:06:55 2023 +0100 Guard SYCL Graph implementation and fallback emulation commit 1efde99 Author: Ben Tracy <[email protected]> Date: Thu Mar 23 12:26:50 2023 +0000 [SYCL] Remove CGF reuse in graph nodes - Note reductions are broken by this commit due to missing accessor support - Handler info is extracted and copied into nodes - Adding nodes in record and replay moved to finalize. - Workarounds for reduction wg sizes added. - Introduce `graph-record-temp-scope.cpp` test case which fails before this commit and passes afterwards. Instead of USM arguments, it is buffer accessors that should be used for edge detection. Fixes `graph-explicit-node-ordering.cpp` test ordering which is currently creating incorrect extra edges Also added `graph-explicit-dotp-buffer.cpp` test for explicit API with accessor edges, we can use to see if this logic works once accessors are better supported. This change adds a new handler constructor which takes a graph, rather than creating a default temporary queue object to pass to the existing constructor. Co-authored-by: Ewan Crawford <[email protected]> commit b7f17c8 Author: Ewan Crawford <[email protected]> Date: Tue Mar 21 08:15:57 2023 +0000 [SYCL] Update record & replay tests Update the record & replay tests to match changes from #72 which were missed after merging the record and replay branch: * Remove unused headers * Uses asserts instead of printing to std out commit d2ff468 Author: Julian Miller <[email protected]> Date: Thu Mar 16 10:08:27 2023 +0100 [SYCL] Improve Graphs testing * Extend testing * Fix reduction test * Add test to verify node ordering * Update sycl include * Switch to assertions in graph tests * Formatting commit 068dd95 Author: Pablo Reble <[email protected]> Date: Mon Mar 13 11:14:29 2023 -0500 Resolving naming style mismatch (#86) commit 66d1b6b Author: Pablo Reble <[email protected]> Date: Thu Mar 2 23:54:48 2023 -0600 Improve code location and replace shared ptr aliases (#82) commit 62d6b15 Author: Ben Tracy <[email protected]> Date: Tue Feb 28 10:53:46 2023 +0000 [SYCL][PI] Prototype command_buffer API in level zero - Adds a prototype of an explicit command buffer - Implemented only for level zero backend - Unit tests added which test new entry points. commit d4c1ed3 Author: Ewan Crawford <[email protected]> Date: Mon Feb 27 08:48:23 2023 +0000 [SYCL] Record & Replay Implementation Implementation of Record & Replay API with tests Co-authored-by: Ben Tracy <[email protected]> commit 06c588f Author: Pablo Reble <[email protected]> Date: Thu Feb 9 10:53:47 2023 -0600 Apply suggestions from code review Co-authored-by: Steffen Larsen <[email protected]> commit 0ac7a7e Author: Pablo Reble <[email protected]> Date: Thu Jan 19 10:29:46 2023 -0600 Adding new example using make edge function (#63) Co-authored-by: Ben Tracy <[email protected]> commit 1249fbc Author: Ewan Crawford <[email protected]> Date: Thu Jan 19 10:03:56 2023 +0000 [SYCL] Pass property_list to APIs Adds the `sycl::property_list` to the constructor of `command_graph<modifiable>()` and `finalize()` to match spec change #67 commit 4a306ed Author: Ben Tracy <[email protected]> Date: Wed Jan 11 10:53:16 2023 +0000 [SYCL] Add unit tests for command graph POC - Add some unit tests for the command graph POC -Add missing specializations for lazy queue property commit fb28d59 Author: Ben Tracy <[email protected]> Date: Mon Jan 9 11:10:26 2023 +0000 [SYCL] Rename exec_graph to ext_oneapi_graph [SYCL] handler::ext_oneapi_graph Update to reflect changes from #65 - In line with recent spec changes, rename handler and queue shortcut functions from exec_graph to ext_oneapi_graph - Also updated usage in the examples Co-authored-by: Ewan Crawford <[email protected]> commit 1448cb5 Author: Ben Tracy <[email protected]> Date: Wed Dec 21 09:10:40 2022 +0000 [SYCL] Enable submitting sub-graphs - Enable submitting a sub-graph as part of a larger command_graph - Flag added to queue_impl to enable graph to be aware it is a sub-graph and delay flush - Adds an example whichuses a subgraph in the middle of a command_graph commit c99bdca Author: Ben Tracy <[email protected]> Date: Tue Dec 13 10:57:15 2022 +0000 [SYCL] Fix reductions not working inside graph * Graph submission now properly creates a host visible event on the command list allowing auxilliary resources to be cleaned up * executeCommandList slightly modified to block execution only for command lists not allowed to be batched. commit 3073cfc Author: Ewan Crawford <[email protected]> Date: Fri Dec 2 10:47:32 2022 +0000 [SYCL] Clean-up lazy queue PI changes * PI Minor version bump for new flag * Document new PI property as comments * Make value next consecutive bit `1 << 5`, rather than `1 << 11`. commit 7bb11ce Author: Ewan Crawford <[email protected]> Date: Wed Nov 30 13:14:50 2022 +0000 [SYCL] Use handler to execute graph Update API to match the spec change from #26 to execute a graph via the handler rather than queue submit. This spec update includes queue shortcut functions, which i've added a new test for. commit 578692f Author: Ewan Crawford <[email protected]> Date: Thu Nov 24 09:26:27 2022 +0000 [SYCL] PIMPL refactor Refactor the command_graph and node classes so that we interface with the impl types rather than user exposed types, and just the interface lives in the public facing headers. This change also means we can use a `.cpp` file for implementation code rather than being header only. The motivation for these changes was trying to get graph submission through a handler, at which point only the `sycl::detail::queue_impl` class is available rather than `sycl::queue` commit 9f127d7 Author: Ewan Crawford <[email protected]> Date: Fri Nov 18 16:27:54 2022 +0000 [SYCL] Repro for reduction fail * Add RUN lines to tests so that tests are run by LIT * clang-format existing tests, and other minor cleanups * Add `graph-explicit-reduction.cpp` which shows fail from #24 by using the `sycl::ext::oneapi::property::queue::lazy_execution` property on a queue which uses a reduction outwith the graph building API commit 2cf9d0f Author: Pablo Reble <[email protected]> Date: Tue Nov 29 21:26:28 2022 -0600 Cosmetic changes commit df971e5 Author: Ben Tracy <[email protected]> Date: Thu Nov 24 08:46:12 2022 +0000 [SYCL] Minor graph classes refactor (#36) - getSyclObjImpl and createSyclObjFromImpl support added - Minor renaming to enable this. - Adds basic results validation to dotp test - Minor fixes to address warnings etc. commit f71ea49 Author: Ewan Crawford <[email protected]> Date: Mon Nov 21 12:25:44 2022 +0000 Common changes from record & replay API (#32) Changes to common code from #6 which has already been reviewed and merged into the `sycl-graph-record-replay` branch. This patch should not contain anything specific to the record and replay API. commit 383459c Author: Pablo Reble <[email protected]> Date: Tue Nov 1 13:35:42 2022 -0500 Renaming variables commit 4478390 Author: Pablo Reble <[email protected]> Date: Tue Nov 1 12:45:31 2022 -0500 clang-format commit fa58aa3 Author: Pablo Reble <[email protected]> Date: Wed Oct 19 20:16:21 2022 -0700 renaming macro and bugfix commit 38da3c6 Author: Pablo Reble <[email protected]> Date: Tue Oct 18 07:49:47 2022 -0700 add basic tests commit 7581915 Author: Pablo Reble <[email protected]> Date: Tue Oct 18 07:40:15 2022 -0700 bugfix commit fa7494d Author: Pablo Reble <[email protected]> Date: Tue Oct 18 07:39:19 2022 -0700 starting to rework lazy execution logic commit 446ac53 Author: Pablo Reble <[email protected]> Date: Tue Oct 18 07:37:41 2022 -0700 revert changes to level-zero plugin commit 8850b18 Author: Pablo Reble <[email protected]> Date: Wed Oct 12 11:33:57 2022 -0700 fix rebase issue commit a3164de Author: Pablo Reble <[email protected]> Date: Wed Oct 12 08:03:55 2022 -0700 update API to recent proposal commit 7917086 Author: Pablo Reble <[email protected]> Date: Tue May 10 11:25:51 2022 -0500 fix formatting commit 7d81618 Author: Pablo Reble <[email protected]> Date: Fri May 6 11:54:58 2022 -0500 fix issue introd. by recent merge commit 9b46c4b Author: Pablo Reble <[email protected]> Date: Fri May 6 10:30:29 2022 -0500 fix formatting issues commit 50d49a1 Author: Julian Miller <[email protected]> Date: Tue May 3 11:29:34 2022 -0500 Propagate lazy queue property commit 0d8a5f4 Author: Pablo Reble <[email protected]> Date: Mon Mar 14 14:08:02 2022 +0100 Apply suggestions from code review Co-authored-by: Ronan Keryell <[email protected]> commit f957996 Author: Pablo Reble <[email protected]> Date: Mon May 2 21:06:42 2022 -0500 fix typos and syntax issues commit 047839b Author: Pablo Reble <[email protected]> Date: Fri Mar 11 20:47:16 2022 +0100 typo commit 2b50af4 Author: Pablo Reble <[email protected]> Date: Fri Mar 11 16:42:43 2022 +0100 update extension proposal started to incorporate feedback commit a8b5b32 Author: Pablo Reble <[email protected]> Date: Tue Feb 22 10:46:54 2022 -0600 Update pi_level_zero.cpp Fix merge conflict commit 0bad787 Author: Pablo Reble <[email protected]> Date: Mon Feb 21 22:25:38 2022 -0600 fix merge commit 656f5c3 Author: Pablo Reble <[email protected]> Date: Tue Feb 15 17:18:32 2022 -0600 Adding lazy execution property to queue commit d286c71 Author: Pablo Reble <[email protected]> Date: Fri Feb 18 15:15:10 2022 -0600 Adding initial sycl graph doc commit 1acf57e Author: Pablo Reble <[email protected]> Date: Fri Feb 18 15:16:27 2022 -0600 Inital version of sycl graph prototype
1 parent 379a094 commit 51efbe7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3685
-117
lines changed

README.md

Lines changed: 21 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,44 @@
1-
This is the Intel staging area for llvm.org contributions and the home for
2-
Intel LLVM-based projects:
1+
# SYCL Command Graph Extensions
32

4-
- [oneAPI DPC++ compiler](#oneapi-dpc-compiler)
5-
- [Late-outline OpenMP and OpenMP Offload](#late-outline-openmp-and-openmp-offload)
3+
This is the collaboration space for the oneAPI vendor Command Graph extension for SYCL2020. It provides an API for defining a graph of operations and their dependencies once and submitting this graph repeatedly for execution.
64

7-
For general contribution process see [CONTRIBUTING.md](./CONTRIBUTING.md)
5+
### Specification
86

9-
## oneAPI DPC++ compiler
7+
A draft of our Command Graph extension proposal can be found here:
8+
[https://github.com/intel/llvm/pull/5626](https://github.com/intel/llvm/pull/5626).
109

11-
[![oneAPI logo](https://spec.oneapi.io/oneapi-logo-white-scaled.jpg)](https://www.oneapi.io/)
10+
### Implementation
1211

13-
[![SYCL Post Commit](https://github.com/intel/llvm/actions/workflows/sycl_post_commit.yml/badge.svg?branch=sycl)](https://github.com/intel/llvm/actions/workflows/sycl_post_commit.yml)
14-
[![Generate Doxygen documentation](https://github.com/intel/llvm/actions/workflows/gh_pages.yml/badge.svg?branch=sycl)](https://github.com/intel/llvm/actions/workflows/gh_pages.yml)
12+
Our current prototype implementation can be found here:
13+
[https://github.com/reble/llvm/tree/sycl-graph-develop](https://github.com/reble/llvm/tree/sycl-graph-develop).
1514

16-
The DPC++ is a LLVM-based compiler project that implements compiler and runtime
17-
support for the SYCL\* language. The project is hosted in the
18-
[sycl](https://github.com/intel/llvm/tree/sycl) branch and is synced with the
19-
tip of the LLVM upstream main branch on a regular basis (revisions delay is
20-
usually not more than 1-2 weeks). DPC++ compiler takes everything from LLVM
21-
upstream as is, however some modules of LLVM might be not included in the
22-
default project build configuration. Additional modules can be enabled by
23-
modifying build framework settings.
15+
Limitations include:
16+
* LevelZero backend support only.
17+
* Accessors and reductions are currently not supported.
2418

25-
The DPC++ goal is to support the latest SYCL\* standard and work on that is in
26-
progress. DPC++ also implements a number of extensions to the SYCL\* standard,
27-
which can be found in the [sycl/doc/extensions](./sycl/doc/extensions)
28-
directory.
19+
### Other Material
2920

30-
The main purpose of this project is open source collaboration on the DPC++
31-
compiler implementation in LLVM across a variety of architectures, prototyping
32-
compiler and runtime library solutions, designing future extensions, and
33-
conducting experiments. As the implementation becomes more mature, we try to
34-
upstream as much DPC++ support to LLVM main branch as possible. See
35-
[SYCL upstreaming working group notes](https://github.com/intel/llvm/wiki/SYCL-upstreaming-working-group-meeting-notes)
36-
for more details.
21+
This extension was presented at the oneAPI Technical Advisory board (Sept'22 meeting). Slides: [https://github.com/oneapi-src/oneAPI-tab/blob/main/language/presentations/2022-09-28-TAB-SYCL-Graph.pdf](https://github.com/oneapi-src/oneAPI-tab/blob/main/language/presentations/2022-09-28-TAB-SYCL-Graph.pdf).
3722

38-
Note that this project can be used as a technical foundation for some
39-
proprietary compiler products, which may leverage implementations from this open
40-
source project. One of the examples is
41-
[Intel(R) oneAPI DPC++ Compiler](https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler.html)
42-
Features parity between this project and downstream projects is not guaranteed.
23+
## Intel Project for LLVM\* technology
4324

44-
Project documentation is available at:
45-
[DPC++ Documentation](https://intel.github.io/llvm-docs/).
25+
We target a contribution through the origin of this fork: [Intel staging area for llvm.org contributions](https://github.com/intel/llvm).
4626

4727
### How to use DPC++
4828

49-
#### Docker containers
50-
51-
See available containers with pre-built/pre-installed DPC++ compiler at:
52-
[Containers](./sycl/doc/developer/DockerBKMs.md#sycl-containers-overview)
53-
5429
#### Releases
5530

56-
Daily builds of the sycl branch on Linux are available at
57-
[releases](https://github.com/intel/llvm/releases).
58-
A few times a year, we publish [Release Notes](./sycl/ReleaseNotes.md) to
59-
highlight all important changes made in the project: features implemented and
60-
issues addressed. The corresponding builds can be found using
61-
[search](https://github.com/intel/llvm/releases?q=oneAPI+DPC%2B%2B+Compiler&expanded=true)
62-
in daily releases. None of the branches in the project are stable or rigorously
63-
tested for production quality control, so the quality of these releases is
64-
expected to be similar to the daily releases.
31+
TDB
6532

6633
#### Build from sources
6734

6835
See [Get Started Guide](./sycl/doc/GetStartedGuide.md).
6936

37+
SYCL Graph support is enabled with:
38+
* Configuration script: `configure.py -enable-sycl-graph`.
39+
* CMake: `cmake -DSYCL_ENABLE_GRAPH`.
40+
41+
A fallback emulation mode is used otherwise that enables the graph API but eagerly submits kernels.
7042
### Report a problem
7143

7244
Submit an [issue](https://github.com/intel/llvm/issues) or initiate a
@@ -76,10 +48,6 @@ Submit an [issue](https://github.com/intel/llvm/issues) or initiate a
7648

7749
See [ContributeToDPCPP](./sycl/doc/developer/ContributeToDPCPP.md).
7850

79-
## Late-outline OpenMP\* and OpenMP\* Offload
80-
81-
See [openmp](/tree/openmp) branch.
82-
8351
# License
8452

8553
See [LICENSE](./sycl/LICENSE.TXT) for details.

buildbot/configure.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def do_configure(args):
5757

5858
if sys.platform != "darwin":
5959
sycl_enabled_plugins.append("level_zero")
60+
61+
sycl_enable_graph = 'OFF'
6062

6163
# lld is needed on Windows or for the HIP plugin on AMD
6264
if platform.system() == 'Windows' or (args.hip and args.hip_platform == 'AMD'):
@@ -108,6 +110,9 @@ def do_configure(args):
108110

109111
if args.use_lld:
110112
llvm_enable_lld = 'ON'
113+
114+
if args.enable_sycl_graph:
115+
sycl_enable_graph = 'ON'
111116

112117
# CI Default conditionally appends to options, keep it at the bottom of
113118
# args handling
@@ -166,6 +171,7 @@ def do_configure(args):
166171
"-DLLVM_ENABLE_SPHINX={}".format(llvm_enable_sphinx),
167172
"-DBUILD_SHARED_LIBS={}".format(llvm_build_shared_libs),
168173
"-DSYCL_ENABLE_XPTI_TRACING={}".format(sycl_enable_xpti_tracing),
174+
"-DSYCL_ENABLE_GRAPH={}".format(sycl_enable_graph),
169175
"-DLLVM_ENABLE_LLD={}".format(llvm_enable_lld),
170176
"-DXPTI_ENABLE_WERROR={}".format(xpti_enable_werror),
171177
"-DSYCL_CLANG_EXTRA_FLAGS={}".format(sycl_clang_extra_flags),
@@ -240,6 +246,7 @@ def main():
240246
help="host LLVM target architecture, defaults to X86, multiple targets may be provided as a semi-colon separated string")
241247
parser.add_argument("--enable-esimd-emulator", action='store_true', help="build with ESIMD emulation support")
242248
parser.add_argument("--enable-all-llvm-targets", action='store_true', help="build compiler with all supported targets, it doesn't change runtime build")
249+
parser.add_argument("--enable-sycl-graph", action='store_true', help="build with SYCL Graph support")
243250
parser.add_argument("--no-assertions", action='store_true', help="build without assertions")
244251
parser.add_argument("--docs", action='store_true', help="build Doxygen documentation")
245252
parser.add_argument("--werror", action='store_true', help="Treat warnings as errors")

sycl/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ endif()
6969
# of the SYCL runtime and expect enabling
7070
option(SYCL_ENABLE_XPTI_TRACING "Enable tracing of SYCL constructs" OFF)
7171

72+
# Create a soft option for enabling or disabling the experimental support
73+
# for SYCl Graph
74+
option(SYCL_ENABLE_GRAPH "Enable experimental SYCL Graph support" OFF)
75+
if (SYCL_ENABLE_GRAPH)
76+
set(SYCL_BUILD_SYCL_GRAPH ON)
77+
endif()
78+
7279
if(MSVC)
7380
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
7481
# Skip asynchronous C++ exceptions catching and assume "extern C" functions

sycl/doc/GetStartedGuide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ flags can be found by launching the script with `--help`):
126126
* `--enable-esimd-emulator` -> enable ESIMD CPU emulation (see [ESIMD CPU emulation](#build-dpc-toolchain-with-support-for-esimd-cpu-emulation))
127127
* `--enable-all-llvm-targets` -> build compiler (but not a runtime) with all
128128
supported targets
129+
* `--enable-sycl-graph` -> build SYCL Graph support
129130
* `--shared-libs` -> Build shared libraries
130131
* `-t` -> Build type (Debug or Release)
131132
* `-o` -> Path to build directory

sycl/include/sycl/detail/common.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,20 @@ struct code_location {
104104

105105
#ifndef DISABLE_SYCL_INSTRUMENTATION_METADATA
106106
#define _CODELOCONLYPARAM(a) \
107-
const detail::code_location a = detail::code_location::current()
107+
const ::sycl::detail::code_location a = \
108+
::sycl::detail::code_location::current()
108109
#define _CODELOCPARAM(a) \
109-
, const detail::code_location a = detail::code_location::current()
110-
#define _CODELOCPARAMDEF(a) , const detail::code_location a
110+
, const ::sycl::detail::code_location a = \
111+
::sycl::detail::code_location::current()
112+
#define _CODELOCPARAMDEF(a) , const ::sycl::detail::code_location a
111113

112114
#define _CODELOCARG(a)
113115
#define _CODELOCFW(a) , a
114116
#else
115117
#define _CODELOCONLYPARAM(a)
116118
#define _CODELOCPARAM(a)
117119

118-
#define _CODELOCARG(a) const detail::code_location a = {}
120+
#define _CODELOCARG(a) const ::sycl::detail::code_location a = {}
119121
#define _CODELOCFW(a)
120122
#endif
121123

sycl/include/sycl/detail/pi.def

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ _PI_API(piextKernelSetArgSampler)
141141

142142
_PI_API(piextPluginGetOpaqueData)
143143

144+
/// command-buffer Extension
145+
_PI_API(piextCommandBufferCreate)
146+
_PI_API(piextCommandBufferRetain)
147+
_PI_API(piextCommandBufferRelease)
148+
_PI_API(piextCommandBufferFinalize)
149+
_PI_API(piextCommandBufferNDRangeKernel)
150+
_PI_API(piextEnqueueCommandBuffer)
144151
_PI_API(piPluginGetLastError)
145152

146153
_PI_API(piTearDown)

sycl/include/sycl/detail/pi.h

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@
9090
// native handles.
9191
// 12.29 Support PI_EXT_PLATFORM_INFO_BACKEND query in piPlatformGetInfo
9292
// 12.30 Added PI_EXT_INTEL_DEVICE_INFO_MEM_CHANNEL_SUPPORT device info query.
93+
// 12.31 Added command-buffer extension methods
9394

9495
#define _PI_H_VERSION_MAJOR 12
95-
#define _PI_H_VERSION_MINOR 30
96+
#define _PI_H_VERSION_MINOR 31
9697

9798
#define _PI_STRING_HELPER(a) #a
9899
#define _PI_CONCAT(a, b) _PI_STRING_HELPER(a.b)
@@ -468,6 +469,7 @@ typedef enum {
468469
PI_COMMAND_TYPE_SVM_MEMFILL = 0x120B,
469470
PI_COMMAND_TYPE_SVM_MAP = 0x120C,
470471
PI_COMMAND_TYPE_SVM_UNMAP = 0x120D,
472+
PI_COMMAND_TYPE_EXT_COMMAND_BUFFER = 0x12A8,
471473
PI_COMMAND_TYPE_DEVICE_GLOBAL_VARIABLE_READ = 0x418E,
472474
PI_COMMAND_TYPE_DEVICE_GLOBAL_VARIABLE_WRITE = 0x418F
473475
} _pi_command_type;
@@ -2121,6 +2123,84 @@ __SYCL_EXPORT pi_result piPluginGetBackendOption(pi_platform platform,
21212123
__SYCL_EXPORT pi_result piGetDeviceAndHostTimer(pi_device Device,
21222124
uint64_t *DeviceTime,
21232125
uint64_t *HostTime);
2126+
2127+
/// Command buffer extension
2128+
struct _pi_ext_command_buffer;
2129+
struct _pi_ext_sync_point;
2130+
using pi_ext_command_buffer = _pi_ext_command_buffer *;
2131+
using pi_ext_sync_point = pi_uint32;
2132+
2133+
typedef enum {
2134+
PI_EXT_STRUCTURE_TYPE_COMMAND_BUFFER_DESC = 0
2135+
} pi_ext_structure_type;
2136+
2137+
struct pi_ext_command_buffer_desc final {
2138+
pi_ext_structure_type stype;
2139+
const void *pNext;
2140+
pi_queue_properties *properties;
2141+
};
2142+
2143+
/// API to create a command-buffer.
2144+
/// \param context The context to associate the command-buffer with.
2145+
/// \param device The device to associate the command-buffer with.
2146+
/// \param desc Descriptor for the new command-buffer.
2147+
/// \param ret_command_buffer Pointer to fill with the address of the new
2148+
/// command-buffer.
2149+
__SYCL_EXPORT pi_result
2150+
piextCommandBufferCreate(pi_context context, pi_device device,
2151+
const pi_ext_command_buffer_desc *desc,
2152+
pi_ext_command_buffer *ret_command_buffer);
2153+
2154+
/// API to increment the reference count of the command-buffer
2155+
/// \param command_buffer The command_buffer to retain.
2156+
__SYCL_EXPORT pi_result
2157+
piextCommandBufferRetain(pi_ext_command_buffer command_buffer);
2158+
2159+
/// API to decrement the reference count of the command-buffer. After the
2160+
/// command_buffer reference count becomes zero and has finished execution, the
2161+
/// command-buffer is deleted. \param command_buffer The command_buffer to
2162+
/// release.
2163+
__SYCL_EXPORT pi_result
2164+
piextCommandBufferRelease(pi_ext_command_buffer command_buffer);
2165+
2166+
/// API to stop command-buffer recording such that no more commands can be
2167+
/// appended, and makes the command-buffer ready to enqueue on a command-queue.
2168+
/// \param command_buffer The command_buffer to finalize.
2169+
__SYCL_EXPORT pi_result
2170+
piextCommandBufferFinalize(pi_ext_command_buffer command_buffer);
2171+
2172+
/// API to append a kernel execution command to the command-buffer.
2173+
/// \param command_buffer The command-buffer to append onto.
2174+
/// \param kernel The kernel to append.
2175+
/// \param work_dim Dimension of the kernel execution.
2176+
/// \param global_work_offset Offset to use when executing kernel.
2177+
/// \param global_work_size Global work size to use when executing kernel.
2178+
/// \param local_work_size Local work size to use when executing kernel.
2179+
/// \param num_sync_points_in_wait_list The number of sync points in the
2180+
/// provided wait list.
2181+
/// \param sync_point_wait_list A list of sync points that this executions must
2182+
/// wait on.
2183+
/// \param sync_point The sync_point associated with this kernel execution.
2184+
__SYCL_EXPORT pi_result piextCommandBufferNDRangeKernel(
2185+
pi_ext_command_buffer command_buffer, pi_kernel kernel, pi_uint32 work_dim,
2186+
const size_t *global_work_offset, const size_t *global_work_size,
2187+
const size_t *local_work_size, pi_uint32 num_sync_points_in_wait_list,
2188+
const pi_ext_sync_point *sync_point_wait_list,
2189+
pi_ext_sync_point *sync_point);
2190+
2191+
/// API to submit the command-buffer to queue for execution, returns an error if
2192+
/// command-buffer not finalized or another instance of same command-buffer
2193+
/// currently executing.
2194+
/// \param command_buffer The command-buffer to be submitted.
2195+
/// \param queue The PI queue to submit on.
2196+
/// \param num_events_in_wait_list The number of events that this execution
2197+
/// depends on.
2198+
/// \param event_wait_list List of pi_events to wait on.
2199+
/// \param event The pi_event associated with this enqueue.
2200+
__SYCL_EXPORT pi_result
2201+
piextEnqueueCommandBuffer(pi_ext_command_buffer command_buffer, pi_queue queue,
2202+
pi_uint32 num_events_in_wait_list,
2203+
const pi_event *event_wait_list, pi_event *event);
21242204

21252205
struct _pi_plugin {
21262206
// PI version supported by host passed to the plugin. The Plugin

0 commit comments

Comments
 (0)