Skip to content

Commit 0461c77

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web' (#1)
2 parents 3b4091f + abc6a59 commit 0461c77

File tree

11 files changed

+54
-41
lines changed

11 files changed

+54
-41
lines changed

sycl/include/CL/sycl/detail/platform_impl.hpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <CL/sycl/detail/common.hpp>
1111
#include <CL/sycl/detail/force_device.hpp>
1212
#include <CL/sycl/detail/pi.hpp>
13-
#include <CL/sycl/detail/platform_info.hpp>
1413
#include <CL/sycl/info/info_desc.hpp>
1514
#include <CL/sycl/stl.hpp>
1615

@@ -41,15 +40,7 @@ class platform_impl {
4140
///
4241
/// @param ExtensionName is a string containing extension name.
4342
/// @return true if platform supports specified extension.
44-
bool has_extension(const string_class &ExtensionName) const {
45-
if (is_host())
46-
return false;
47-
48-
string_class AllExtensionNames =
49-
get_platform_info<string_class, info::platform::extensions>::get(
50-
MPlatform);
51-
return (AllExtensionNames.find(ExtensionName) != std::string::npos);
52-
}
43+
bool has_extension(const string_class &ExtensionName) const;
5344

5445
/// Returns all SYCL devices associated with this platform.
5546
///
@@ -68,14 +59,7 @@ class platform_impl {
6859
/// The return type depends on information being queried.
6960
template <info::platform param>
7061
typename info::param_traits<info::platform, param>::return_type
71-
get_info() const {
72-
if (is_host())
73-
return get_platform_info_host<param>();
74-
75-
return get_platform_info<
76-
typename info::param_traits<info::platform, param>::return_type,
77-
param>::get(this->getHandleRef());
78-
}
62+
get_info() const;
7963

8064
/// @return true if this SYCL platform is a host platform.
8165
bool is_host() const { return MHostPlatform; };

sycl/source/detail/platform_impl.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <CL/sycl/detail/device_impl.hpp>
1010
#include <CL/sycl/detail/platform_impl.hpp>
11+
#include <CL/sycl/detail/platform_info.hpp>
1112
#include <CL/sycl/device.hpp>
1213
#include <detail/config.hpp>
1314

@@ -227,6 +228,34 @@ platform_impl::get_devices(info::device_type DeviceType) const {
227228

228229
return Res;
229230
}
231+
232+
bool platform_impl::has_extension(const string_class &ExtensionName) const {
233+
if (is_host())
234+
return false;
235+
236+
string_class AllExtensionNames =
237+
get_platform_info<string_class, info::platform::extensions>::get(
238+
MPlatform);
239+
return (AllExtensionNames.find(ExtensionName) != std::string::npos);
240+
}
241+
242+
template <info::platform param>
243+
typename info::param_traits<info::platform, param>::return_type
244+
platform_impl::get_info() const {
245+
if (is_host())
246+
return get_platform_info_host<param>();
247+
248+
return get_platform_info<
249+
typename info::param_traits<info::platform, param>::return_type,
250+
param>::get(this->getHandleRef());
251+
}
252+
253+
#define PARAM_TRAITS_SPEC(param_type, param, ret_type) \
254+
template ret_type platform_impl::get_info<info::param_type::param>() const;
255+
256+
#include <CL/sycl/info/platform_traits.def>
257+
#undef PARAM_TRAITS_SPEC
258+
230259
} // namespace detail
231260
} // namespace sycl
232261
} // namespace cl

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -197,23 +197,30 @@ static bool isDeviceBinaryTypeSupported(const context &C,
197197
if (Format != PI_DEVICE_BINARY_TYPE_SPIRV)
198198
return true;
199199

200+
vector_class<device> Devices = C.get_devices();
201+
202+
// Program type is SPIR-V, so we need a device compiler to do JIT.
203+
for (const device &D : Devices) {
204+
if (!D.get_info<info::device::is_compiler_available>())
205+
return false;
206+
}
207+
200208
// OpenCL 2.1 and greater require clCreateProgramWithIL
201209
if (pi::useBackend(pi::SYCL_BE_PI_OPENCL) &&
202210
C.get_platform().get_info<info::platform::version>() >= "2.1")
203211
return true;
204212

205-
// Otherwise we need cl_khr_il_program extension to be present
206-
// and we can call clCreateProgramWithILKHR using the extension
207-
for (const device &D : C.get_devices()) {
213+
for (const device &D : Devices) {
214+
// We need cl_khr_il_program extension to be present
215+
// and we can call clCreateProgramWithILKHR using the extension
208216
vector_class<string_class> Extensions =
209217
D.get_info<info::device::extensions>();
210-
if (std::find(Extensions.begin(), Extensions.end(),
211-
string_class("cl_khr_il_program")) != Extensions.end())
212-
return true;
218+
if (Extensions.end() ==
219+
std::find(Extensions.begin(), Extensions.end(), "cl_khr_il_program"))
220+
return false;
213221
}
214222

215-
// This device binary type is not supported.
216-
return false;
223+
return true;
217224
}
218225

219226
static const char *getFormatStr(RT::PiDeviceBinaryType Format) {
@@ -618,14 +625,6 @@ ProgramManager::build(ProgramPtr Program, RT::PiContext Context,
618625
}
619626
const char *Opts = std::getenv("SYCL_PROGRAM_BUILD_OPTIONS");
620627

621-
for (const auto &DeviceId : Devices) {
622-
if (!createSyclObjFromImpl<device>(std::make_shared<device_impl>(DeviceId))
623-
.get_info<info::device::is_compiler_available>()) {
624-
throw feature_not_supported(
625-
"Online compilation is not supported by this device");
626-
}
627-
}
628-
629628
if (!Opts)
630629
Opts = Options.c_str();
631630

sycl/test/aot/accelerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: aoc
1+
// REQUIRES: aoc, accelerator
22

33
// RUN: %clangxx -fsycl -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice %s -o %t.out
44
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out

sycl/test/aot/cpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: opencl-aot
1+
// REQUIRES: opencl-aot, cpu
22

33
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice %s -o %t.out
44
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out

sycl/test/aot/gpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: ocloc
1+
// REQUIRES: ocloc, gpu
22

33
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xsycl-target-backend=spir64_gen-unknown-unknown-sycldevice "-device skl" %s -o %t.out
44
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out

sycl/test/aot/multiple-devices.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===------------------------------------------------------------------------===//
88

9-
// REQUIRES: opencl-aot, ocloc, aoc
9+
// REQUIRES: opencl-aot, ocloc, aoc, cpu, gpu, accelerator
1010

1111
// 1-command compilation case
1212
// Targeting CPU, GPU, FPGA
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: aoc
1+
// REQUIRES: aoc, accelerator
22

33
// RUN: %clangxx -fsycl -fsycl-device-code-split=per_source -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice -I %S/Inputs -o %t.out %S/split-per-source-main.cpp %S/Inputs/split-per-source-second-file.cpp
44
// RUN: %ACC_RUN_PLACEHOLDER %t.out
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: ioc64
1+
// REQUIRES: opencl-aot, cpu
22

33
// RUN: %clangxx -fsycl -fsycl-device-code-split=per_source -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice -I %S/Inputs -o %t.out %S/split-per-source-main.cpp %S/Inputs/split-per-source-second-file.cpp
44
// RUN: %CPU_RUN_PLACEHOLDER %t.out
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: ocloc
1+
// REQUIRES: ocloc, gpu
22

33
// RUN: %clangxx -fsycl -fsycl-device-code-split=per_source -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xsycl-target-backend=spir64_gen-unknown-unknown-sycldevice "-device skl" -I %S/Inputs -o %t.out %S/split-per-source-main.cpp %S/Inputs/split-per-source-second-file.cpp
44
// RUN: %GPU_RUN_PLACEHOLDER %t.out

sycl/test/lit.cfg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def getDeviceCount(device_type):
150150
print("Found available accelerator device")
151151
acc_run_substitute = " env SYCL_DEVICE_TYPE=ACC "
152152
acc_check_substitute = "| FileCheck %s"
153+
config.available_features.add('accelerator')
153154
config.substitutions.append( ('%ACC_RUN_PLACEHOLDER', acc_run_substitute) )
154155
config.substitutions.append( ('%ACC_CHECK_PLACEHOLDER', acc_check_substitute) )
155156

0 commit comments

Comments
 (0)