diff --git a/sycl/source/detail/program_impl.cpp b/sycl/source/detail/program_impl.cpp index 7408ef99131cf..ec41944559d7a 100644 --- a/sycl/source/detail/program_impl.cpp +++ b/sycl/source/detail/program_impl.cpp @@ -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 && @@ -172,6 +164,12 @@ program_impl::program_impl(ContextImplPtr Context, Plugin.call( 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( MProgram, Device, CL_PROGRAM_BUILD_OPTIONS, 0, nullptr, &Size); @@ -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;