-
Notifications
You must be signed in to change notification settings - Fork 30
Sycl wrappers #30
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
Sycl wrappers #30
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5d81879
Adds C and Cython API for portions of Sycl queue, device, context int…
diptorupd 35a4674
Add missing DPPL_API.
diptorupd 7bb5faf
Move platform specific functions into a separate file.
diptorupd 4a11490
Create a single utility function to delete C strings.
diptorupd 6e246fb
Update backends/source/dppl_utils.cpp
PokhodenkoSA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//===--- dppl_sycl_context_interface.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 header declares a C API to SYCL's sycl::context interface. | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
|
||
#include "dppl_data_types.h" | ||
#include "dppl_sycl_types.h" | ||
#include "Support/DllExport.h" | ||
#include "Support/ExternC.h" | ||
#include "Support/MemOwnershipAttrs.h" | ||
#include <stdbool.h> | ||
|
||
DPPL_C_EXTERN_C_BEGIN | ||
|
||
/*! | ||
* @brief Returns true if this SYCL context is a host context. | ||
* | ||
* @param CtxtRef A opaque pointer to a sycl::context. | ||
* @return True if the SYCL context is a host context, else False. | ||
*/ | ||
DPPL_API | ||
bool DPPLIsHostContext (__dppl_keep const DPPLSyclContextRef CtxtRef); | ||
diptorupd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/*! | ||
* @brief Delete the pointer after casting it to sycl::context | ||
* | ||
* @param CtxtRef The DPPLSyclContextRef pointer to be deleted. | ||
*/ | ||
DPPL_API | ||
void DPPLDeleteSyclContext (__dppl_take DPPLSyclContextRef CtxtRef); | ||
diptorupd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
DPPL_C_EXTERN_C_END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
//===--- dppl_sycl_device_interface.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 header declares a C interface to sycl::device. Not all of the device | ||
/// API is exposed, only the bits needed in other places like context and queue | ||
/// interfaces. | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
|
||
#include "dppl_data_types.h" | ||
#include "dppl_sycl_types.h" | ||
#include "Support/DllExport.h" | ||
#include "Support/ExternC.h" | ||
#include "Support/MemOwnershipAttrs.h" | ||
|
||
DPPL_C_EXTERN_C_BEGIN | ||
|
||
/*! | ||
* @brief Redefinition of Sycl's device_type so that we do not have to include | ||
* sycl.hpp here and in the Python bindings. | ||
* | ||
*/ | ||
typedef enum | ||
{ | ||
DPPL_CPU, | ||
DPPL_GPU, | ||
DPPL_ACCELERATOR, | ||
DPPL_CUSTOM, | ||
DPPL_AUTOMATIC, | ||
DPPL_HOST, | ||
DPPL_ALL | ||
} DPPLSyclDeviceType; | ||
|
||
/*! | ||
* @brief Prints out some of the info::deivice attributes for the device. | ||
* | ||
* @param DRef A DPPLSyclDeviceRef pointer. | ||
*/ | ||
DPPL_API | ||
void DPPLDumpDeviceInfo (__dppl_keep const DPPLSyclDeviceRef DRef); | ||
|
||
/*! | ||
* @brief Deletes a DPPLSyclDeviceRef pointer after casting to to sycl::device. | ||
* | ||
* @param DRef The DPPLSyclDeviceRef pointer to be freed. | ||
*/ | ||
DPPL_API | ||
void DPPLDeleteSyclDevice (__dppl_take DPPLSyclDeviceRef DRef); | ||
|
||
/*! | ||
* @brief Returns true if this SYCL device is an OpenCL device and the device | ||
* type is sycl::info::device_type::accelerator. | ||
* | ||
* @param DRef Opaque pointer to a sycl::device | ||
* @return True if the device type is an accelerator, else False. | ||
*/ | ||
DPPL_API | ||
bool DPPLDeviceIsAccelerator (__dppl_keep const DPPLSyclDeviceRef DRef); | ||
|
||
/*! | ||
* @brief Returns true if this SYCL device is an OpenCL device and the device | ||
* type is sycl::info::device_type::cpu. | ||
* | ||
* @param DRef Opaque pointer to a sycl::device | ||
* @return True if the device type is a cpu, else False. | ||
*/ | ||
DPPL_API | ||
bool DPPLDeviceIsCPU (__dppl_keep const DPPLSyclDeviceRef DRef); | ||
|
||
/*! | ||
* @brief Returns true if this SYCL device is an OpenCL device and the device | ||
* type is sycl::info::device_type::gpu. | ||
* | ||
* @param DRef Opaque pointer to a sycl::device | ||
* @return True if the device type is a gpu, else False. | ||
*/ | ||
DPPL_API | ||
bool DPPLDeviceIsGPU (__dppl_keep const DPPLSyclDeviceRef DRef); | ||
|
||
/*! | ||
* @brief Returns true if this SYCL device is a host device. | ||
* | ||
* @param DRef Opaque pointer to a sycl::device | ||
* @return True if the device is a host device, else False. | ||
*/ | ||
DPPL_API | ||
bool DPPLDeviceIsHost (__dppl_keep const DPPLSyclDeviceRef DRef); | ||
|
||
/*! | ||
* @brief Returns the OpenCL software driver version as a C string. | ||
* | ||
* @param DRef Opaque pointer to a sycl::device | ||
* @return A C string in the form major_number.minor.number that corresponds | ||
* to the OpenCL driver version if this is a OpenCL device. | ||
*/ | ||
DPPL_API | ||
__dppl_give const char* | ||
DPPLGetDeviceDriverInfo (__dppl_keep const DPPLSyclDeviceRef DRef); | ||
|
||
/*! | ||
* @brief Returns a C string for the device name. | ||
* | ||
* @param DRef Opaque pointer to a sycl::device | ||
* @return A C string containing the OpenCL device name. | ||
*/ | ||
DPPL_API | ||
__dppl_give const char* | ||
DPPLGetDeviceName (__dppl_keep const DPPLSyclDeviceRef DRef); | ||
|
||
/*! | ||
* @brief Returns a C string corresponding to the vendor name. | ||
* | ||
* @param DRef Opaque pointer to a sycl::device | ||
* @return A C string containing the OpenCL device vendor name. | ||
*/ | ||
DPPL_API | ||
__dppl_give const char* | ||
DPPLGetDeviceVendorName (__dppl_keep const DPPLSyclDeviceRef DRef); | ||
|
||
/*! | ||
* @brief Returns True if the device and the host share a unified memory | ||
* subsystem, else returns False. | ||
* | ||
* @param DRef Opaque pointer to a sycl::device | ||
* @return Boolean indicating if the device shares a unified memory subsystem | ||
* with the host. | ||
*/ | ||
DPPL_API | ||
bool DPPLGetDeviceHostUnifiedMemory (__dppl_keep const DPPLSyclDeviceRef DRef); | ||
|
||
DPPL_C_EXTERN_C_END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//===--- dppl_sycl_platform_interface.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 header declares a C interface to sycl::platform interface functions. | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
|
||
#include "dppl_data_types.h" | ||
#include "Support/DllExport.h" | ||
#include "Support/ExternC.h" | ||
|
||
DPPL_C_EXTERN_C_BEGIN | ||
|
||
/*! | ||
* @brief Get the number of sycl::platform available on the system. | ||
* | ||
* @return The number of available sycl::platforms. | ||
*/ | ||
DPPL_API | ||
size_t DPPLPlatform_GetNumPlatforms (); | ||
|
||
/*! | ||
* @brief Prints out some selected info about all sycl::platform on the system. | ||
* | ||
*/ | ||
DPPL_API | ||
void DPPLPlatform_DumpInfo (); | ||
|
||
DPPL_C_EXTERN_C_END |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.