Skip to content

[SYCL] Fix program linking #79

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 2 commits into from
Apr 16, 2019
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
11 changes: 8 additions & 3 deletions sycl/include/CL/sycl/detail/program_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,24 @@ class program_impl {
if (!is_host()) {
vector_class<cl_device_id> ClDevices(get_cl_devices());
vector_class<cl_program> ClPrograms;
bool NonInterOpToLink = false;
for (const auto &Prg : ProgramList) {
if (!Prg->IsLinkable && NonInterOpToLink)
continue;
NonInterOpToLink |= !Prg->IsLinkable;
ClPrograms.push_back(Prg->ClProgram);
}
cl_int Err;
cl_int Err = CL_SUCCESS;
ClProgram = clLinkProgram(detail::getSyclObjImpl(Context)->getHandleRef(),
ClDevices.size(), ClDevices.data(),
LinkOptions.c_str(), ProgramList.size(),
LinkOptions.c_str(), ClPrograms.size(),
ClPrograms.data(), nullptr, nullptr, &Err);
CHECK_OCL_CODE_THROW(Err, compile_program_error);
}
}

program_impl(const context &Context, cl_program ClProgram)
: ClProgram(ClProgram), Context(Context) {
: ClProgram(ClProgram), Context(Context), IsLinkable(true) {
// TODO handle the case when cl_program build is in progress
cl_uint NumDevices;
CHECK_OCL_CODE(clGetProgramInfo(ClProgram, CL_PROGRAM_NUM_DEVICES,
Expand Down Expand Up @@ -382,6 +386,7 @@ class program_impl {
cl_program ClProgram = nullptr;
program_state State = program_state::none;
context Context;
bool IsLinkable = false;
vector_class<device> Devices;
string_class CompileOptions;
string_class LinkOptions;
Expand Down