Skip to content

Commit 32b9986

Browse files
author
Ewan Crawford
authored
[SYCL][Graph] Query for backend command-buffer support
Rather than the user deciding whether to use the emulation mode or backend command-buffer mode, it is less error prone to do it programmatically as a user can't select an unsupported config. This also fixes #90 where currently the `SYCL_EXT_ONEAPI_GRAPH` macro isn't defined when in emulation mode. Done by using a PI device info query in finalization. This also corresponds to a new UR device info query until the extension mechanism is decided oneapi-src/unified-runtime#458 but will be superceeded by whatever extension reporting mechanism is decided on. The only PI backend which reports support for command-buffer implementation is Level Zero, the other backends/adapters report no support. The vendor test macro test-e2e test is re-enabled with this change.
1 parent 78b8f5c commit 32b9986

File tree

14 files changed

+139
-98
lines changed

14 files changed

+139
-98
lines changed

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Our current prototype implementation can be found here:
1313
[https://github.com/reble/llvm/tree/sycl-graph-develop](https://github.com/reble/llvm/tree/sycl-graph-develop).
1414

1515
Limitations include:
16-
* LevelZero backend support only.
16+
* LevelZero backend support only. A fallback emulation mode is used for correctness on other backends.
1717
* Accessors and reductions are currently not supported.
1818

1919
### Other Material
@@ -34,11 +34,6 @@ TDB
3434

3535
See [Get Started Guide](./sycl/doc/GetStartedGuide.md).
3636

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.
4237
### Report a problem
4338

4439
Submit an [issue](https://github.com/intel/llvm/issues) or initiate a

buildbot/configure.py

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

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

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

111109
if args.use_lld:
112110
llvm_enable_lld = 'ON'
113-
114-
if args.enable_sycl_graph:
115-
sycl_enable_graph = 'ON'
116111

117112
# CI Default conditionally appends to options, keep it at the bottom of
118113
# args handling
@@ -171,7 +166,6 @@ def do_configure(args):
171166
"-DLLVM_ENABLE_SPHINX={}".format(llvm_enable_sphinx),
172167
"-DBUILD_SHARED_LIBS={}".format(llvm_build_shared_libs),
173168
"-DSYCL_ENABLE_XPTI_TRACING={}".format(sycl_enable_xpti_tracing),
174-
"-DSYCL_ENABLE_GRAPH={}".format(sycl_enable_graph),
175169
"-DLLVM_ENABLE_LLD={}".format(llvm_enable_lld),
176170
"-DXPTI_ENABLE_WERROR={}".format(xpti_enable_werror),
177171
"-DSYCL_CLANG_EXTRA_FLAGS={}".format(sycl_clang_extra_flags),

sycl/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ 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-
7672
if(MSVC)
7773
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
7874
# Skip asynchronous C++ exceptions catching and assume "extern C" functions

sycl/include/sycl/detail/pi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ typedef enum {
351351
PI_EXT_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES = 0x20006,
352352
PI_EXT_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES = 0x20007,
353353
PI_EXT_INTEL_DEVICE_INFO_MEM_CHANNEL_SUPPORT = 0x20008,
354+
// Supports command-buffer extension entry-points
355+
PI_EXT_ONEAPI_DEVICE_INFO_COMMAND_BUFFER_SUPPORT = 0x20009,
354356
} _pi_device_info;
355357

356358
typedef enum {

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,6 +2121,12 @@ pi_result cuda_piDeviceGetInfo(pi_device device, pi_device_info param_name,
21212121
case PI_DEVICE_INFO_GPU_HW_THREADS_PER_EU:
21222122
return PI_ERROR_INVALID_VALUE;
21232123

2124+
case PI_EXT_ONEAPI_DEVICE_INFO_COMMAND_BUFFER_SUPPORT: {
2125+
// Using CUDA-Graphs as a backend for PI command-buffers no yet supported
2126+
return getInfo<pi_bool>(param_value_size, param_value, param_value_size_ret,
2127+
false);
2128+
}
2129+
21242130
default:
21252131
__SYCL_PI_HANDLE_UNKNOWN_PARAM_NAME(param_name);
21262132
}

sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,9 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName,
842842
CASE_PI_UNSUPPORTED(PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_2D)
843843
CASE_PI_UNSUPPORTED(PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_3D)
844844

845+
case PI_EXT_ONEAPI_DEVICE_INFO_COMMAND_BUFFER_SUPPORT:
846+
return ReturnValue(pi_bool{false});
847+
845848
default:
846849
DIE_NO_IMPLEMENTATION;
847850
}

sycl/plugins/hip/pi_hip.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,6 +1984,12 @@ pi_result hip_piDeviceGetInfo(pi_device device, pi_device_info param_name,
19841984
PI_ERROR_INVALID_ARG_VALUE);
19851985
return PI_ERROR_PLUGIN_SPECIFIC_ERROR;
19861986

1987+
case PI_EXT_ONEAPI_DEVICE_INFO_COMMAND_BUFFER_SUPPORT {
1988+
// Using HIP-Graphs as a backend for PI command-buffers no yet supported
1989+
return getInfo<pi_bool>(param_value_size, param_value, param_value_size_ret,
1990+
false);
1991+
}
1992+
19871993
default:
19881994
__SYCL_PI_HANDLE_UNKNOWN_PARAM_NAME(param_name);
19891995
}

sycl/plugins/opencl/pi_opencl.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,15 @@ pi_result piDeviceGetInfo(pi_device device, pi_device_info paramName,
727727
std::memcpy(paramValue, &result, sizeof(cl_bool));
728728
return PI_SUCCESS;
729729
}
730+
731+
case PI_EXT_ONEAPI_DEVICE_INFO_COMMAND_BUFFER_SUPPORT: {
732+
// Using cl_khr_command_buffer extensions as a backend for PI
733+
// command-buffers no yet supported
734+
cl_bool result = false;
735+
std::memcpy(paramValue, &result, sizeof(cl_bool));
736+
return PI_SUCCESS;
737+
}
738+
730739
default:
731740
cl_int result = clGetDeviceInfo(
732741
cast<cl_device_id>(device), cast<cl_device_info>(paramName),

sycl/plugins/unified_runtime/pi2ur.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,9 @@ inline pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName,
791791
case PI_DEVICE_INFO_IMAGE_SRGB:
792792
InfoType = (ur_device_info_t)UR_DEVICE_INFO_IMAGE_SRGB;
793793
break;
794+
case PI_EXT_ONEAPI_DEVICE_INFO_COMMAND_BUFFER_SUPPORT:
795+
InfoType = (ur_device_info_t)UR_EXT_DEVICE_INFO_COMMAND_BUFFER_SUPPORT;
796+
break;
794797
case PI_DEVICE_INFO_BACKEND_VERSION: {
795798
// TODO: return some meaningful for backend_version below
796799
ReturnHelper ReturnValue(ParamValueSize, ParamValue, ParamValueSizeRet);

sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,8 @@ ur_result_t urDeviceGetInfo(
10171017
return ReturnValue(pi_bool{false});
10181018
case UR_DEVICE_INFO_IMAGE_SRGB:
10191019
return ReturnValue(pi_bool{false});
1020+
case UR_EXT_DEVICE_INFO_COMMAND_BUFFER_SUPPORT:
1021+
return ReturnValue(pi_bool{true});
10201022

10211023
// TODO: Implement.
10221024
default:

0 commit comments

Comments
 (0)