Skip to content

Update opencl interoprability code to fix build with open source llvm/sycl bundle #625

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 1 commit into from
Oct 12, 2021
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
9 changes: 5 additions & 4 deletions dpctl-capi/source/dpctl_sycl_program_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "Support/CBindingWrapping.h"
#include <CL/cl.h> /* OpenCL headers */
#include <CL/sycl.hpp> /* Sycl headers */
#include <CL/sycl/backend/opencl.hpp>

#ifdef DPCTL_ENABLE_LO_PROGRAM_CREATION
#include "../helper/include/dpctl_dynamic_lib_helper.h"
Expand Down Expand Up @@ -75,7 +76,7 @@ createOpenCLInterOpProgram(const context &SyclCtx,
const char *CompileOpts)
{
cl_int err;
auto CLCtx = SyclCtx.get();
auto CLCtx = get_native<backend::opencl>(SyclCtx);
auto CLProgram = clCreateProgramWithIL(CLCtx, IL, length, &err);
if (err) {
// \todo: record the error string and any other information.
Expand All @@ -89,7 +90,7 @@ createOpenCLInterOpProgram(const context &SyclCtx,
// Get a list of CL Devices from the Sycl devices
auto CLDevices = new cl_device_id[SyclDevices.size()];
for (auto i = 0ul; i < SyclDevices.size(); ++i)
CLDevices[i] = SyclDevices[i].get();
CLDevices[i] = get_native<backend::opencl>(SyclDevices[i]);

// Build the OpenCL interoperability program
err = clBuildProgram(CLProgram, (cl_uint)(SyclDevices.size()), CLDevices,
Expand Down Expand Up @@ -138,7 +139,7 @@ createLevelZeroInterOpProgram(const context &SyclCtx,
size_t length,
const char *CompileOpts)
{
auto ZeCtx = SyclCtx.get_native<backend::level_zero>();
auto ZeCtx = get_native<backend::level_zero>(SyclCtx);
auto SyclDevices = SyclCtx.get_devices();
if (SyclDevices.size() > 1) {
std::cerr << "Level zero program can be created for only one device.\n";
Expand All @@ -159,7 +160,7 @@ createLevelZeroInterOpProgram(const context &SyclCtx,
ZeModuleDesc.pBuildFlags = CompileOpts;
ZeModuleDesc.pConstants = &ZeSpecConstants;

auto ZeDevice = SyclDevices[0].get_native<backend::level_zero>();
auto ZeDevice = get_native<backend::level_zero>(SyclDevices[0]);
ze_module_handle_t ZeModule;

auto stZeModuleCreateF = getZeModuleCreateFn();
Expand Down