Skip to content
Merged
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
16 changes: 7 additions & 9 deletions sycl/source/detail/program_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,6 @@ program_impl::program_impl(ContextImplPtr Context,
pi_native_handle InteropProgram,
RT::PiProgram Program)
: MProgram(Program), MContext(Context), MLinkable(true) {

if (Context->getDevices().size() > 1) {
throw feature_not_supported(
"multiple devices within a context are not supported with "
"sycl::program and sycl::kernel",
PI_INVALID_OPERATION);
}

const detail::plugin &Plugin = getPlugin();
if (MProgram == nullptr) {
assert(InteropProgram &&
Expand Down Expand Up @@ -172,6 +164,12 @@ program_impl::program_impl(ContextImplPtr Context,
Plugin.call<PiApiKind::piProgramGetBuildInfo>(
MProgram, Device, CL_PROGRAM_BINARY_TYPE, sizeof(cl_program_binary_type),
&BinaryType, nullptr);
if (BinaryType == CL_PROGRAM_BINARY_TYPE_NONE) {
throw invalid_object_error(
"The native program passed to the program constructor has to be either "
"compiled or linked",
PI_INVALID_PROGRAM);
}
size_t Size = 0;
Plugin.call<PiApiKind::piProgramGetBuildInfo>(
MProgram, Device, CL_PROGRAM_BUILD_OPTIONS, 0, nullptr, &Size);
Expand All @@ -182,7 +180,7 @@ program_impl::program_impl(ContextImplPtr Context,
string_class Options(OptionsVector.begin(), OptionsVector.end());
switch (BinaryType) {
case CL_PROGRAM_BINARY_TYPE_NONE:
MState = program_state::none;
assert(false);
break;
case CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT:
MState = program_state::compiled;
Expand Down