Skip to content

Commit

Permalink
Closes #624 (#625)
Browse files Browse the repository at this point in the history
Replaced sycl::context::get() with
sycl::get_native<sycl::backend::opencl>( context )

Similar change for level-zero.
  • Loading branch information
oleksandr-pavlyk authored Oct 12, 2021
1 parent da90ebd commit 2907977
Showing 1 changed file with 5 additions and 4 deletions.
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

0 comments on commit 2907977

Please sign in to comment.