Skip to content

Commit d82acd7

Browse files
authored
[SYCL] Fix compilation when JIT is disabled (#19302)
This fixes the compilation error if the JIT is disabled in the build as reported in #19291. --------- Signed-off-by: Lukas Sommer <[email protected]>
1 parent 79d1e54 commit d82acd7

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

sycl/source/detail/device_image_impl.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
#pragma once
1010

11+
#if SYCL_EXT_JIT_ENABLE
1112
#include "JITBinaryInfo.h"
13+
#endif // SYCL_EXT_JIT_ENABLE
1214
#include <detail/adapter_impl.hpp>
1315
#include <detail/compiler.hpp>
1416
#include <detail/context_impl.hpp>
@@ -35,6 +37,10 @@
3537
#include <mutex>
3638
#include <vector>
3739

40+
namespace jit_compiler {
41+
enum class BinaryFormat : uint32_t;
42+
}
43+
3844
namespace sycl {
3945
inline namespace _V1 {
4046
namespace detail {
@@ -700,7 +706,9 @@ class device_image_impl
700706
return MRTCBinInfo && MRTCBinInfo->MLanguage == Lang;
701707
}
702708

703-
static ::jit_compiler::BinaryFormat getTargetFormat(const backend Backend) {
709+
static ::jit_compiler::BinaryFormat
710+
getTargetFormat([[maybe_unused]] const backend Backend) {
711+
#if SYCL_EXT_JIT_ENABLE
704712
switch (Backend) {
705713
case backend::ext_oneapi_level_zero:
706714
case backend::opencl:
@@ -714,6 +722,10 @@ class device_image_impl
714722
sycl::make_error_code(sycl::errc::invalid),
715723
"Backend does not support kernel_compiler extension");
716724
}
725+
#else
726+
throw sycl::exception(sycl::make_error_code(sycl::errc::invalid),
727+
"JIT not supported");
728+
#endif // SYCL_EXT_JIT_ENABLE
717729
}
718730

719731
std::vector<std::shared_ptr<device_image_impl>> buildFromSource(

sycl/source/detail/jit_compiler.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
#pragma once
1010

11-
#include <JITBinaryInfo.h>
1211
#include <detail/jit_device_binaries.hpp>
1312
#include <detail/queue_impl.hpp>
1413
#include <sycl/detail/kernel_name_str_t.hpp>
1514
#include <sycl/feature_test.hpp>
1615
#if SYCL_EXT_JIT_ENABLE
16+
#include <JITBinaryInfo.h>
1717
#include <Materializer.h>
1818
#include <RTC.h>
1919
#endif // SYCL_EXT_JIT_ENABLE
@@ -28,6 +28,7 @@ struct RTCDevImgInfo;
2828
struct RTCBundleInfo;
2929
template <typename T> class DynArray;
3030
using JITEnvVar = DynArray<char>;
31+
enum class BinaryFormat : uint32_t;
3132
} // namespace jit_compiler
3233

3334
namespace sycl {

sycl/source/detail/kernel_compiler/kernel_compiler_sycl.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
#pragma once
1010

11-
#include <JITBinaryInfo.h>
11+
#if SYCL_EXT_JIT_ENABLE
12+
#include "JITBinaryInfo.h"
13+
#endif // SYCL_EXT_JIT_ENABLE
1214
#include <sycl/detail/defines_elementary.hpp>
1315
#include <sycl/detail/export.hpp> // __SYCL_EXPORT
1416
#include <sycl/detail/string_view.hpp>
@@ -18,6 +20,10 @@
1820
#include <string>
1921
#include <vector>
2022

23+
namespace jit_compiler {
24+
enum class BinaryFormat : uint32_t;
25+
}
26+
2127
namespace sycl {
2228
inline namespace _V1 {
2329
namespace ext::oneapi::experimental {

0 commit comments

Comments
 (0)