Compatibility with newer OpenCL versions (#22051)

This commit is contained in:
Ilya Lavrenov 2024-01-10 11:31:17 +04:00 committed by GitHub
parent 47c49e7e84
commit b981887d6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -299,7 +299,7 @@ memory_capabilities init_memory_caps(const cl::Device& device, const device_info
} // namespace
ocl_device::ocl_device(const cl::Device dev, const cl::Context& ctx, const cl_platform_id platform)
ocl_device::ocl_device(const cl::Device dev, const cl::Context& ctx, const cl::Platform& platform)
: _context(ctx)
, _device(dev)
, _platform(platform)

View File

@ -18,7 +18,7 @@ namespace ocl {
struct ocl_device : public device {
public:
ocl_device(const cl::Device dev, const cl::Context& ctx, const cl_platform_id platform);
ocl_device(const cl::Device dev, const cl::Context& ctx, const cl::Platform& platform);
device_info get_info() const override { return _info; }
memory_capabilities get_mem_caps() const override { return _mem_caps; }
@ -26,7 +26,7 @@ public:
const cl::Device& get_device() const { return _device; }
cl::Device& get_device() { return _device; }
const cl::Context& get_context() const { return _context; }
cl_platform_id get_platform() const { return _platform; }
const cl::Platform& get_platform() const { return _platform; }
bool is_same(const device::ptr other) override;
@ -35,7 +35,7 @@ public:
private:
cl::Context _context;
cl::Device _device;
cl_platform_id _platform;
cl::Platform _platform;
device_info _info;
memory_capabilities _mem_caps;
};

View File

@ -207,7 +207,7 @@ std::vector<device::ptr> ocl_device_detector::create_device_list() const {
for (auto& device : devices) {
if (!does_device_match_config(device))
continue;
supported_devices.emplace_back(std::make_shared<ocl_device>(device, cl::Context(device), id));
supported_devices.emplace_back(std::make_shared<ocl_device>(device, cl::Context(device), platform));
}
} catch (std::exception& ex) {
GPU_DEBUG_LOG << "Devices query/creation failed for " << platform.getInfo<CL_PLATFORM_NAME>() << ": " << ex.what() << std::endl;
@ -227,7 +227,7 @@ std::vector<device::ptr> ocl_device_detector::create_device_list_from_user_conte
auto& device = all_devices[i];
if (!does_device_match_config(device) || static_cast<int>(i) != ctx_device_id)
continue;
supported_devices.emplace_back(std::make_shared<ocl_device>(device, ctx, device.getInfo<CL_DEVICE_PLATFORM>()));
supported_devices.emplace_back(std::make_shared<ocl_device>(device, ctx, cl::Platform(device.getInfo<CL_DEVICE_PLATFORM>())));
}
OPENVINO_ASSERT(!supported_devices.empty(), "[GPU] User defined context does not have supported GPU device.");
@ -290,7 +290,7 @@ std::vector<device::ptr> ocl_device_detector::create_device_list_from_user_devic
CL_CONTEXT_INTEROP_USER_SYNC, CL_FALSE,
CL_CONTEXT_PLATFORM, (cl_context_properties)id,
0 };
supported_devices.emplace_back(std::make_shared<ocl_device>(device, cl::Context(device, props), id));
supported_devices.emplace_back(std::make_shared<ocl_device>(device, cl::Context(device, props), platform));
}
}
OPENVINO_ASSERT(!supported_devices.empty(), "[GPU] User specified device is not supported.");