Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions backends/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ add_library(
source/dppl_sycl_platform_interface.cpp
source/dppl_sycl_queue_interface.cpp
source/dppl_sycl_queue_manager.cpp
source/dppl_utils.cpp
)

# Install DPPLOpenCLInterface
Expand Down
27 changes: 0 additions & 27 deletions backends/include/dppl_sycl_device_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,6 @@ DPPL_API
__dppl_give const char*
DPPLGetDeviceDriverInfo (__dppl_keep const DPPLSyclDeviceRef DRef);

/*!
* @brief Deletes a C string corresponding to the string returned by
* DPPLGetDeviceDriverInfo().
*
* @param DriverInfo C String for the driver number.
*/
DPPL_API
void DPPLDeleteDeviceDriverInfo (__dppl_take const char* DriverInfo);

/*!
* @brief Returns a C string for the device name.
*
Expand All @@ -136,15 +127,6 @@ DPPL_API
__dppl_give const char*
DPPLGetDeviceName (__dppl_keep const DPPLSyclDeviceRef DRef);

/*!
* @brief Deletes a C string corresponding to the string returned by
* DPPLGetDeviceName().
*
* @param DeviceName C String for the device name.
*/
DPPL_API
void DPPLDeleteDeviceName (__dppl_take const char* DeviceName);

/*!
* @brief Returns a C string corresponding to the vendor name.
*
Expand All @@ -155,15 +137,6 @@ DPPL_API
__dppl_give const char*
DPPLGetDeviceVendorName (__dppl_keep const DPPLSyclDeviceRef DRef);

/*!
* @brief Deletes a C string corresponding to the string returned by
* DPPLGetDeviceVendorName().
*
* @param char C String for the vendor name.
*/
DPPL_API
void DPPLDeleteDeviceVendorName (__dppl_take const char* VendorName);

/*!
* @brief Returns True if the device and the host share a unified memory
* subsystem, else returns False.
Expand Down
41 changes: 41 additions & 0 deletions backends/include/dppl_utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//===------------- dppl_utils.h - DPPL-SYCL interface --*-- C++ -----*-----===//
//
// Python Data Parallel Processing Library (PyDPPL)
//
// Copyright 2020 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file defines common helper functions used in other places in DPPL.
//===----------------------------------------------------------------------===//

#pragma once

#include "Support/DllExport.h"
#include "Support/ExternC.h"
#include "Support/MemOwnershipAttrs.h"

DPPL_C_EXTERN_C_BEGIN

/*!
* @brief Deletes the C String argument
*
* @param str C string to be deleted
*/
DPPL_API
void DPPLDeleteCString (__dppl_take const char* str);

DPPL_C_EXTERN_C_END
17 changes: 1 addition & 16 deletions backends/source/dppl_sycl_device_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(device, DPPLSyclDeviceRef)

/*!
* @brief
* @brief Helper function to print the metadata for a sycl::device.
*
* @param Device My Param doc
*/
Expand Down Expand Up @@ -108,11 +108,6 @@ DPPLGetDeviceName (__dppl_keep const DPPLSyclDeviceRef DRef)
return cstr_name;
}

void DPPLDeleteDeviceName (__dppl_take const char *DeviceName)
{
delete DeviceName;
}

__dppl_give const char*
DPPLGetDeviceVendorName (__dppl_keep const DPPLSyclDeviceRef DRef)
{
Expand All @@ -122,11 +117,6 @@ DPPLGetDeviceVendorName (__dppl_keep const DPPLSyclDeviceRef DRef)
return cstr_vendor;
}

void DPPLDeleteDeviceVendorName (__dppl_take const char *VendorName)
{
delete VendorName;
}

__dppl_give const char*
DPPLGetDeviceDriverInfo (__dppl_keep const DPPLSyclDeviceRef DRef)
{
Expand All @@ -136,11 +126,6 @@ DPPLGetDeviceDriverInfo (__dppl_keep const DPPLSyclDeviceRef DRef)
return cstr_driver;
}

void DPPLDeleteDeviceDriverInfo (__dppl_take const char *DriverInfo)
{
delete DriverInfo;
}

bool DPPLGetDeviceHostUnifiedMemory (__dppl_keep const DPPLSyclDeviceRef DRef)
{
return unwrap(DRef)->get_info<info::device::host_unified_memory>();
Expand Down
31 changes: 31 additions & 0 deletions backends/source/dppl_utils.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//===--------- dppl_utils.cpp - DPPL-SYCL interface ----*---- C++ ----*----===//
//
// Python Data Parallel Processing Library (PyDPPL)
//
// Copyright 2020 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file implements the helper functions defined in dppl_utils.h.
///
//===----------------------------------------------------------------------===//

#include "dppl_utils.h"

void DPPLDeleteCString (__dppl_take const char* str)
{
delete str;
}
11 changes: 5 additions & 6 deletions dppl/sycl_core.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ cdef class UnsupportedDeviceTypeError(Exception):
'''
pass

cdef extern from "dppl_utils.h":
cdef void DPPLDeleteCString (const char *str)

cdef extern from "dppl_sycl_types.h":
cdef struct DPPLOpaqueSyclContext:
Expand Down Expand Up @@ -75,9 +77,6 @@ cdef extern from "dppl_sycl_device_interface.h":
except +
cdef bool DPPLGetDeviceHostUnifiedMemory (const DPPLSyclDeviceRef DRef) \
except +
cdef void DPPLDeleteDeviceName (const char *DeviceName) except +
cdef void DPPLDeleteDeviceVendorName (const char *VendorName) except +
cdef void DPPLDeleteDeviceDriverInfo (const char *DriverInfo) except +

cdef extern from "dppl_sycl_platform_interface.h":
cdef size_t DPPLPlatform_GetNumPlatforms ()
Expand Down Expand Up @@ -143,9 +142,9 @@ cdef class SyclDevice:

def __dealloc__ (self):
DPPLDeleteSyclDevice(self.device_ptr)
DPPLDeleteDeviceName(self.device_name)
DPPLDeleteDeviceVendorName(self.vendor_name)
DPPLDeleteDeviceDriverInfo(self.driver_version)
DPPLDeleteCString(self.device_name)
DPPLDeleteCString(self.vendor_name)
DPPLDeleteCString(self.driver_version)

def dump_device_info (self):
''' Print information about the SYCL device.
Expand Down