17
17
#include < detail/spec_constant_impl.hpp>
18
18
19
19
#include < algorithm>
20
+ #include < string>
20
21
#include < fstream>
21
22
#include < list>
22
23
#include < memory>
@@ -26,6 +27,21 @@ __SYCL_INLINE_NAMESPACE(cl) {
26
27
namespace sycl {
27
28
namespace detail {
28
29
30
+ inline const std::string GetBackendString (cl::sycl::backend backend) {
31
+ switch (backend) {
32
+ #define PI_BACKEND_STR (backend_name ) \
33
+ case cl::sycl::backend::backend_name: \
34
+ return #backend_name
35
+ PI_BACKEND_STR (cuda);
36
+ PI_BACKEND_STR (host);
37
+ PI_BACKEND_STR (opencl);
38
+ PI_BACKEND_STR (level_zero);
39
+ #undef PI_BACKEND_STR
40
+ default :
41
+ return " Unknown Plugin" ;
42
+ }
43
+ }
44
+
29
45
program_impl::program_impl (ContextImplPtr Context,
30
46
const property_list &PropList)
31
47
: program_impl(Context, Context->get_info<info::context::devices>(),
@@ -362,11 +378,10 @@ void program_impl::create_cl_program_with_source(const string_class &Source) {
362
378
Plugin.call_nocheck <PiApiKind::piclProgramCreateWithSource>(
363
379
MContext->getHandleRef (), 1 , &Src, &Size, &MProgram);
364
380
365
- if (Plugin.getBackend () == cl::sycl::backend::level_zero &&
366
- Err == PI_INVALID_OPERATION) {
381
+ if (Err == PI_INVALID_OPERATION) {
367
382
throw feature_not_supported (
368
- " piclProgramCreateWithSource is not supported in Level Zero " ,
369
- PI_INVALID_OPERATION);
383
+ " program::compile_with_source is not supported in" +
384
+ GetBackendString (Plugin. getBackend ()), PI_INVALID_OPERATION);
370
385
}
371
386
}
372
387
0 commit comments