Skip to content

Commit ff6c384

Browse files
committed
[SYCL] Fix program linking
This patch skips linking of already statically linked programs in program link constructor. Signed-off-by: Sindhu Chittireddy <sindhu.chittireddy@intel.com>
1 parent 9e1f628 commit ff6c384

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

sycl/include/CL/sycl/detail/program_impl.hpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,24 @@ class program_impl {
6666
if (!is_host()) {
6767
vector_class<cl_device_id> ClDevices(get_cl_devices());
6868
vector_class<cl_program> ClPrograms;
69+
bool NonInterOpToLink = false;
6970
for (const auto &Prg : ProgramList) {
71+
if (!Prg->IsLinkable && NonInterOpToLink)
72+
continue;
73+
NonInterOpToLink |= !Prg->IsLinkable;
7074
ClPrograms.push_back(Prg->ClProgram);
7175
}
72-
cl_int Err;
76+
cl_int Err = CL_SUCCESS;
7377
ClProgram = clLinkProgram(detail::getSyclObjImpl(Context)->getHandleRef(),
7478
ClDevices.size(), ClDevices.data(),
75-
LinkOptions.c_str(), ProgramList.size(),
79+
LinkOptions.c_str(), ClPrograms.size(),
7680
ClPrograms.data(), nullptr, nullptr, &Err);
7781
CHECK_OCL_CODE_THROW(Err, compile_program_error);
7882
}
7983
}
8084

8185
program_impl(const context &Context, cl_program ClProgram)
82-
: ClProgram(ClProgram), Context(Context) {
86+
: ClProgram(ClProgram), Context(Context), IsLinkable(true) {
8387
// TODO handle the case when cl_program build is in progress
8488
cl_uint NumDevices;
8589
CHECK_OCL_CODE(clGetProgramInfo(ClProgram, CL_PROGRAM_NUM_DEVICES,
@@ -382,6 +386,7 @@ class program_impl {
382386
cl_program ClProgram = nullptr;
383387
program_state State = program_state::none;
384388
context Context;
389+
bool IsLinkable = false;
385390
vector_class<device> Devices;
386391
string_class CompileOptions;
387392
string_class LinkOptions;

0 commit comments

Comments
 (0)