@@ -1143,7 +1143,6 @@ inline cl_int getInfoHelper(Func f, cl_uint name, vector<vector<unsigned char>>*
11431143 }
11441144 }
11451145
1146-
11471146 return CL_SUCCESS;
11481147}
11491148
@@ -5922,6 +5921,7 @@ Local(size_type size)
59225921class Kernel : public detail ::Wrapper<cl_kernel>
59235922{
59245923public:
5924+ inline Kernel (const Program& program, const string& name, cl_int* err = nullptr );
59255925 inline Kernel (const Program& program, const char * name, cl_int* err = nullptr );
59265926
59275927 // ! \brief Default constructor - initializes to nullptr.
@@ -6400,7 +6400,6 @@ class Program : public detail::Wrapper<cl_program>
64006400 }
64016401 }
64026402
6403-
64046403#if defined(CL_HPP_USE_IL_KHR) || CL_HPP_TARGET_OPENCL_VERSION >= 210
64056404 /* *
64066405 * Program constructor to allow construction of program from SPIR-V or another IL.
@@ -6550,7 +6549,6 @@ class Program : public detail::Wrapper<cl_program>
65506549 return ;
65516550 }
65526551
6553-
65546552 vector<size_type> lengths (numDevices);
65556553 vector<const unsigned char *> images (numDevices);
65566554#if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
@@ -6564,7 +6562,7 @@ class Program : public detail::Wrapper<cl_program>
65646562 lengths[i] = binaries[(int )i].second ;
65656563 }
65666564#endif // #if !defined(CL_HPP_ENABLE_PROGRAM_CONSTRUCTION_FROM_ARRAY_COMPATIBILITY)
6567-
6565+
65686566 vector<cl_device_id> deviceIDs (numDevices);
65696567 for ( size_type deviceIndex = 0 ; deviceIndex < numDevices; ++deviceIndex ) {
65706568 deviceIDs[deviceIndex] = (devices[deviceIndex])();
@@ -6573,7 +6571,7 @@ class Program : public detail::Wrapper<cl_program>
65736571 if (binaryStatus) {
65746572 binaryStatus->resize (numDevices);
65756573 }
6576-
6574+
65776575 object_ = ::clCreateProgramWithBinary (
65786576 context (), (cl_uint) devices.size (),
65796577 deviceIDs.data (),
@@ -6640,6 +6638,14 @@ class Program : public detail::Wrapper<cl_program>
66406638 return *this ;
66416639 }
66426640
6641+ cl_int build (
6642+ const vector<Device>& devices,
6643+ const string& options,
6644+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr,
6645+ void* data = nullptr) const
6646+ {
6647+ return build (devices, options.c_str (), notifyFptr, data);
6648+ }
66436649
66446650 cl_int build (
66456651 const vector<Device>& devices,
@@ -6649,7 +6655,7 @@ class Program : public detail::Wrapper<cl_program>
66496655 {
66506656 size_type numDevices = devices.size ();
66516657 vector<cl_device_id> deviceIDs (numDevices);
6652-
6658+
66536659 for ( size_type deviceIndex = 0 ; deviceIndex < numDevices; ++deviceIndex ) {
66546660 deviceIDs[deviceIndex] = (devices[deviceIndex])();
66556661 }
@@ -6666,6 +6672,15 @@ class Program : public detail::Wrapper<cl_program>
66666672 return detail::buildErrHandler (buildError, __BUILD_PROGRAM_ERR, getBuildInfo<CL_PROGRAM_BUILD_LOG>());
66676673 }
66686674
6675+ cl_int build (
6676+ const Device& device,
6677+ const string& options,
6678+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr,
6679+ void* data = nullptr) const
6680+ {
6681+ return build (device, options.c_str (), notifyFptr, data);
6682+ }
6683+
66696684 cl_int build (
66706685 const Device& device,
66716686 const char * options = nullptr ,
@@ -6687,6 +6702,14 @@ class Program : public detail::Wrapper<cl_program>
66876702 return detail::buildErrHandler (buildError, __BUILD_PROGRAM_ERR, buildLog);
66886703 }
66896704
6705+ cl_int build (
6706+ const string& options,
6707+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr,
6708+ void* data = nullptr) const
6709+ {
6710+ return build (options.c_str (), notifyFptr, data);
6711+ }
6712+
66906713 cl_int build (
66916714 const char * options = nullptr ,
66926715 void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr,
@@ -6704,6 +6727,14 @@ class Program : public detail::Wrapper<cl_program>
67046727 }
67056728
67066729#if CL_HPP_TARGET_OPENCL_VERSION >= 120
6730+ cl_int compile (
6731+ const string& options,
6732+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr,
6733+ void* data = nullptr) const
6734+ {
6735+ return compile (options.c_str (), notifyFptr, data);
6736+ }
6737+
67076738 cl_int compile (
67086739 const char * options = nullptr ,
67096740 void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr,
@@ -6728,6 +6759,16 @@ class Program : public detail::Wrapper<cl_program>
67286759 const vector<string>& headerIncludeNames,
67296760 void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr,
67306761 void* data = nullptr) const
6762+ {
6763+ return compile (options.c_str (), inputHeaders, headerIncludeNames, notifyFptr, data);
6764+ }
6765+
6766+ cl_int compile (
6767+ const char * options,
6768+ const vector<Program>& inputHeaders,
6769+ const vector<string>& headerIncludeNames,
6770+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr,
6771+ void* data = nullptr) const
67316772 {
67326773 static_assert (sizeof (cl::Program) == sizeof (cl_program),
67336774 " Size of cl::Program must be equal to size of cl_program" );
@@ -6739,7 +6780,7 @@ class Program : public detail::Wrapper<cl_program>
67396780 object_,
67406781 0 ,
67416782 nullptr ,
6742- options. c_str () ,
6783+ options,
67436784 static_cast <cl_uint>(inputHeaders.size ()),
67446785 reinterpret_cast <const cl_program*>(inputHeaders.data ()),
67456786 reinterpret_cast <const char **>(headerIncludeNamesCStr.data ()),
@@ -6755,6 +6796,17 @@ class Program : public detail::Wrapper<cl_program>
67556796 const vector<string>& headerIncludeNames = vector<string>(),
67566797 void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr,
67576798 void* data = nullptr) const
6799+ {
6800+ return compile (options.c_str (), deviceList, inputHeaders, headerIncludeNames, notifyFptr, data);
6801+ }
6802+
6803+ cl_int compile (
6804+ const char * options,
6805+ const vector<Device>& deviceList,
6806+ const vector<Program>& inputHeaders = vector<Program>(),
6807+ const vector<string>& headerIncludeNames = vector<string>(),
6808+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr,
6809+ void* data = nullptr) const
67586810 {
67596811 static_assert (sizeof (cl::Program) == sizeof (cl_program),
67606812 " Size of cl::Program must be equal to size of cl_program" );
@@ -6770,7 +6822,7 @@ class Program : public detail::Wrapper<cl_program>
67706822 object_,
67716823 static_cast <cl_uint>(deviceList.size ()),
67726824 reinterpret_cast <const cl_device_id*>(deviceIDList.data ()),
6773- options. c_str () ,
6825+ options,
67746826 static_cast <cl_uint>(inputHeaders.size ()),
67756827 reinterpret_cast <const cl_program*>(inputHeaders.data ()),
67766828 reinterpret_cast <const char **>(headerIncludeNamesCStr.data ()),
@@ -6993,6 +7045,17 @@ inline Program linkProgram(
69937045 return Program (prog);
69947046}
69957047
7048+ inline Program linkProgram (
7049+ const Program& input1,
7050+ const Program& input2,
7051+ const string& options,
7052+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr,
7053+ void* data = nullptr,
7054+ cl_int* err = nullptr)
7055+ {
7056+ return linkProgram (input1, input2, options.c_str (), notifyFptr, data, err);
7057+ }
7058+
69967059inline Program linkProgram (
69977060 const vector<Program>& inputPrograms,
69987061 const char * options = nullptr ,
@@ -7031,6 +7094,16 @@ inline Program linkProgram(
70317094
70327095 return Program (prog);
70337096}
7097+
7098+ inline Program linkProgram (
7099+ const vector<Program>& inputPrograms,
7100+ const string& options,
7101+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = nullptr,
7102+ void* data = nullptr,
7103+ cl_int* err = nullptr)
7104+ {
7105+ return linkProgram (inputPrograms, options.c_str (), notifyFptr, data, err);
7106+ }
70347107#endif // CL_HPP_TARGET_OPENCL_VERSION >= 120
70357108
70367109// Template specialization for CL_PROGRAM_BINARIES
@@ -7089,6 +7162,18 @@ inline cl_int cl::Program::setSpecializationConstant(cl_uint index, const bool &
70897162}
70907163#endif // CL_HPP_TARGET_OPENCL_VERSION >= 220
70917164
7165+ inline Kernel::Kernel (const Program& program, const string& name, cl_int* err)
7166+ {
7167+ cl_int error;
7168+
7169+ object_ = ::clCreateKernel (program (), name.c_str (), &error);
7170+ detail::errHandler (error, __CREATE_KERNEL_ERR);
7171+
7172+ if (err != nullptr ) {
7173+ *err = error;
7174+ }
7175+ }
7176+
70927177inline Kernel::Kernel (const Program& program, const char * name, cl_int* err)
70937178{
70947179 cl_int error;
@@ -7099,7 +7184,6 @@ inline Kernel::Kernel(const Program& program, const char* name, cl_int* err)
70997184 if (err != nullptr ) {
71007185 *err = error;
71017186 }
7102-
71037187}
71047188
71057189#ifdef cl_khr_external_memory
0 commit comments