Skip to content

Commit 48a97be

Browse files
edwinsolisfumar456
authored andcommitted
Fixed incompatibility issues with newer opencl hpp headers
1 parent f4db00f commit 48a97be

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

src/backend/opencl/device_manager.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,11 @@ DeviceManager::DeviceManager()
261261

262262
// Create contexts and queues once the sort is done
263263
for (int i = 0; i < nDevices; i++) {
264-
cl_platform_id device_platform =
265-
devices[i]->getInfo<CL_DEVICE_PLATFORM>();
264+
// For OpenCL-HPP >= v2023.12.14 type is cl::Platform instead of
265+
// cl_platform_id
266+
cl::Platform device_platform;
267+
device_platform = devices[i]->getInfo<CL_DEVICE_PLATFORM>();
268+
266269
try {
267270
mContexts.emplace_back(
268271
make_unique<cl::Context>(mDeviceContextMap[*devices[i]]));
@@ -272,7 +275,7 @@ DeviceManager::DeviceManager()
272275
mDeviceTypes.push_back(getDeviceTypeEnum(*devices[i]));
273276
mPlatforms.push_back(
274277
std::make_pair<std::unique_ptr<cl::Platform>, afcl_platform>(
275-
make_unique<cl::Platform>(device_platform, true),
278+
make_unique<cl::Platform>(device_platform(), true),
276279
getPlatformEnum(*devices[i])));
277280
mDevices.emplace_back(std::move(devices[i]));
278281

src/backend/opencl/platform.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,11 @@ const std::string& getActiveDeviceBaseBuildFlags() {
337337
}
338338

339339
vector<Version> getOpenCLCDeviceVersion(const Device& device) {
340-
Platform device_platform(device.getInfo<CL_DEVICE_PLATFORM>(), false);
340+
// For OpenCL-HPP >= v2023.12.14 type is cl::Platform instead of
341+
// cl_platform_id
342+
Platform device_platform;
343+
device_platform = device.getInfo<CL_DEVICE_PLATFORM>();
344+
341345
auto platform_version = device_platform.getInfo<CL_PLATFORM_VERSION>();
342346
vector<Version> out;
343347

@@ -540,10 +544,13 @@ void addDeviceContext(cl_device_id dev, cl_context ctx, cl_command_queue que) {
540544
devMngr.mDeviceTypes.push_back(
541545
static_cast<int>(tDevice.getInfo<CL_DEVICE_TYPE>()));
542546

543-
auto device_platform = tDevice.getInfo<CL_DEVICE_PLATFORM>();
547+
// For OpenCL-HPP >= v2023.12.14 type is cl::Platform instead of
548+
// cl_platform_id
549+
cl::Platform device_platform;
550+
device_platform = tDevice.getInfo<CL_DEVICE_PLATFORM>();
544551
devMngr.mPlatforms.push_back(
545552
std::make_pair<std::unique_ptr<cl::Platform>, afcl_platform>(
546-
make_unique<cl::Platform>(device_platform, true),
553+
make_unique<cl::Platform>(device_platform(), true),
547554
getPlatformEnum(tDevice)));
548555

549556
devMngr.mDevices.emplace_back(make_unique<cl::Device>(move(tDevice)));

0 commit comments

Comments
 (0)