Skip to content

[SYCL] Report an error message when "sycl::program::create_program_with_source" is used with Level-Zero #3212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ namespace pi {
std::terminate();
}

// Reports error messages
void cuPrint(const char *Message) {
std::cerr << "pi_print: " << Message << std::endl;
}

void assertion(bool Condition, const char *Message) {
if (!Condition)
die(Message);
Expand Down Expand Up @@ -2649,8 +2654,9 @@ pi_result cuda_piclProgramCreateWithSource(pi_context context, pi_uint32 count,
const char **strings,
const size_t *lengths,
pi_program *program) {
cl::sycl::detail::pi::die("cuda_piclProgramCreateWithSource not implemented");
return {};
cl::sycl::detail::pi::cuPrint(
"cuda_piclProgramCreateWithSource not implemented");
return PI_INVALID_OPERATION;
}

/// Loads the images from a PI program into a CUmodule that can be
Expand Down
11 changes: 9 additions & 2 deletions sycl/source/detail/program_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,15 @@ void program_impl::create_cl_program_with_source(const string_class &Source) {
const char *Src = Source.c_str();
size_t Size = Source.size();
const detail::plugin &Plugin = getPlugin();
Plugin.call<PiApiKind::piclProgramCreateWithSource>(
MContext->getHandleRef(), 1, &Src, &Size, &MProgram);
RT::PiResult Err =
Plugin.call_nocheck<PiApiKind::piclProgramCreateWithSource>(
MContext->getHandleRef(), 1, &Src, &Size, &MProgram);

if (Err == PI_INVALID_OPERATION) {
throw feature_not_supported(
"program::compile_with_source is not supported by the selected backend",
PI_INVALID_OPERATION);
}
}

void program_impl::compile(const string_class &Options) {
Expand Down