@@ -66,20 +66,24 @@ class program_impl {
66
66
if (!is_host ()) {
67
67
vector_class<cl_device_id> ClDevices (get_cl_devices ());
68
68
vector_class<cl_program> ClPrograms;
69
+ bool NonInterOpToLink = false ;
69
70
for (const auto &Prg : ProgramList) {
71
+ if (!Prg->IsLinkable && NonInterOpToLink)
72
+ continue ;
73
+ NonInterOpToLink |= !Prg->IsLinkable ;
70
74
ClPrograms.push_back (Prg->ClProgram );
71
75
}
72
- cl_int Err;
76
+ cl_int Err = CL_SUCCESS ;
73
77
ClProgram = clLinkProgram (detail::getSyclObjImpl (Context)->getHandleRef (),
74
78
ClDevices.size (), ClDevices.data (),
75
- LinkOptions.c_str (), ProgramList .size (),
79
+ LinkOptions.c_str (), ClPrograms .size (),
76
80
ClPrograms.data (), nullptr , nullptr , &Err);
77
81
CHECK_OCL_CODE_THROW (Err, compile_program_error);
78
82
}
79
83
}
80
84
81
85
program_impl (const context &Context, cl_program ClProgram)
82
- : ClProgram(ClProgram), Context(Context) {
86
+ : ClProgram(ClProgram), Context(Context), IsLinkable( true ) {
83
87
// TODO handle the case when cl_program build is in progress
84
88
cl_uint NumDevices;
85
89
CHECK_OCL_CODE (clGetProgramInfo (ClProgram, CL_PROGRAM_NUM_DEVICES,
@@ -382,6 +386,7 @@ class program_impl {
382
386
cl_program ClProgram = nullptr ;
383
387
program_state State = program_state::none;
384
388
context Context;
389
+ bool IsLinkable = false ;
385
390
vector_class<device> Devices;
386
391
string_class CompileOptions;
387
392
string_class LinkOptions;
0 commit comments