Skip to content

Commit b8445a0

Browse files
committed
fix error message.
Signed-off-by: rbegam <[email protected]>
1 parent 18fccab commit b8445a0

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2650,7 +2650,7 @@ pi_result cuda_piclProgramCreateWithSource(pi_context context, pi_uint32 count,
26502650
const size_t *lengths,
26512651
pi_program *program) {
26522652
cl::sycl::detail::pi::die("cuda_piclProgramCreateWithSource not implemented");
2653-
return {};
2653+
return PI_INVALID_OPERATION;
26542654
}
26552655

26562656
/// Loads the images from a PI program into a CUmodule that can be

sycl/source/detail/program_impl.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <detail/spec_constant_impl.hpp>
1818

1919
#include <algorithm>
20+
#include <string>
2021
#include <fstream>
2122
#include <list>
2223
#include <memory>
@@ -26,6 +27,21 @@ __SYCL_INLINE_NAMESPACE(cl) {
2627
namespace sycl {
2728
namespace detail {
2829

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+
2945
program_impl::program_impl(ContextImplPtr Context,
3046
const property_list &PropList)
3147
: 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) {
362378
Plugin.call_nocheck<PiApiKind::piclProgramCreateWithSource>(
363379
MContext->getHandleRef(), 1, &Src, &Size, &MProgram);
364380

365-
if (Plugin.getBackend() == cl::sycl::backend::level_zero &&
366-
Err == PI_INVALID_OPERATION) {
381+
if (Err == PI_INVALID_OPERATION) {
367382
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);
370385
}
371386
}
372387

0 commit comments

Comments
 (0)