Skip to content

Commit f6ef9db

Browse files
committed
[lc0][SYCL] Use extensions to submit native commands when available
Use the wrapper function from infrastructure/SYCL.h to call either host_task or native command submission extensions when available.
1 parent 2b14791 commit f6ef9db

File tree

3 files changed

+88
-52
lines changed

3 files changed

+88
-52
lines changed

infrastructure/SYCL.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ class SYCL
8383
#endif
8484
}
8585

86+
// Extensions ensure native stream sync happens with the sycl::event sync,
87+
// wheras plain host_task requires an explicit native sync
88+
constexpr static bool NativeCommandNeedsSync{
89+
#if defined(SYCL_EXT_ONEAPI_ENQUEUE_NATIVE_COMMAND) || defined(ACPP_EXT_ENQUEUE_CUSTOM_OPERATION)
90+
false
91+
#else
92+
true
93+
#endif
94+
};
95+
8696
/// Wrapper using SYCL extensions to submit a native command when available,
8797
/// or a plain host_task otherwise. Calls queue::wait_and_throw after the
8898
/// command submission and additionally nativeSync() when plain host_task is
@@ -95,9 +105,8 @@ class SYCL
95105
q.wait_and_throw();
96106
// Extensions ensure native stream sync happens with the above
97107
// queue::wait, but plain host_task requires an explicit native sync
98-
#if !defined(SYCL_EXT_ONEAPI_ENQUEUE_NATIVE_COMMAND) && !defined(ACPP_EXT_ENQUEUE_CUSTOM_OPERATION)
108+
if constexpr (SYCL::NativeCommandNeedsSync)
99109
nativeSync();
100-
#endif
101110
}
102111

103112
#ifdef USE_INFRASTRUCTURE // Move to testbench base??

lc0/meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ has_backends = false
8888
#add_project_arguments('-fsycl-targets=spir64_gen -Xs -device 0x0bd5 -revision_id 3' ', language : 'cpp')
8989
#endif
9090

91-
91+
# Common includes
92+
includes += include_directories('../infrastructure')
9293

9394
# Third party files.
9495
includes += include_directories('third_party', is_system: true)

0 commit comments

Comments
 (0)