Skip to content

Feature/backend specific queues v2 #93

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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c338842
rebase wih master.
Oct 3, 2020
576598a
Change the QueueManager API to require backend type.
diptorupd Oct 1, 2020
cace295
Aspects do not seem to work well in beta09. Switch to use get_info<in…
diptorupd Oct 1, 2020
1edf230
Introduce the concept of sycl backends into dpctl.
diptorupd Oct 1, 2020
4076520
Update dppl_sycl_queue_manager.cpp
PokhodenkoSA Oct 2, 2020
425f4b9
Move the initializer for queue manager queues to separate functions.
diptorupd Oct 2, 2020
fa4f29a
Change how the queue manager creates the context.
diptorupd Oct 3, 2020
5823125
Fix test cases.
Oct 3, 2020
c96c50d
Make the queue backend discoverable in sycl_core.
Oct 3, 2020
14bf63f
Add helper functions to get current backend.
Oct 4, 2020
fb1fbb2
bring back has_{cpu|gpu}_queues
Oct 4, 2020
4572588
Return the queue that was set as default. Helps in error checking.
Oct 4, 2020
99f9080
Equivalency checking helpers.
Oct 4, 2020
ccb8d4c
A current device is always present even outside a device context.
Oct 4, 2020
3f92407
Allow program creation only for OpenCL for the time being.
Oct 4, 2020
530ae9f
Fix errors found for Sergey.
Oct 4, 2020
d6bcd74
Remove useless except+, as C++ exceptions do not cross C API.
Oct 4, 2020
4e6aabc
no need to use enum in return type
oleksandr-pavlyk Oct 5, 2020
7629342
Fixed TBB warnings on setting GPU queue
oleksandr-pavlyk Oct 5, 2020
772b97d
Rename DPPLSyclBEType to DPPLSyclBackendType. Drop superfluous enum s…
Oct 5, 2020
c4acc54
Merge branch 'feature/backend_specific_queues_v2' of github.com:dipto…
Oct 5, 2020
5d6ddc4
Reformat.
Oct 5, 2020
81dd13d
Fix formatting.
Oct 5, 2020
7586726
onaAPI beta10 compiler (#103)
PokhodenkoSA Oct 5, 2020
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
26 changes: 25 additions & 1 deletion backends/include/dppl_sycl_context_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,46 @@

#include "dppl_data_types.h"
#include "dppl_sycl_types.h"
#include "dppl_sycl_platform_interface.h"
#include "Support/DllExport.h"
#include "Support/ExternC.h"
#include "Support/MemOwnershipAttrs.h"
#include <stdbool.h>

DPPL_C_EXTERN_C_BEGIN

/*!
* @brief Checks if two DPPLSyclContextRef objects point to the same
* sycl::context.
*
* @param CtxRef1 First opaque pointer to the sycl context.
* @param CtxRef2 Second opaque pointer to the sycl context.
* @return True if the underlying sycl::context are same, false otherwise.
*/
DPPL_API
bool DPPLContext_AreEq (__dppl_keep const DPPLSyclContextRef CtxRef1,
__dppl_keep const DPPLSyclContextRef CtxRef2);

/*!
* @brief Returns true if this SYCL context is a host context.
*
* @param CtxRef A opaque pointer to a sycl::context.
* @param CtxRef An opaque pointer to a sycl::context.
* @return True if the SYCL context is a host context, else False.
*/
DPPL_API
bool DPPLContext_IsHost (__dppl_keep const DPPLSyclContextRef CtxRef);

/*!
* @brief Returns the sycl backend for the DPPLSyclContextRef pointer.
*
* @param CtxRef An opaque pointer to a sycl::context.
* @return The sycl backend for the DPPLSyclContextRef returned as
* a DPPLSyclBackendType enum type.
*/
DPPL_API
DPPLSyclBackendType
DPPLContext_GetBackend (__dppl_keep const DPPLSyclContextRef CtxRef);

/*!
* @brief Delete the pointer after casting it to sycl::context
*
Expand Down
17 changes: 1 addition & 16 deletions backends/include/dppl_sycl_device_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,14 @@
#pragma once

#include "dppl_data_types.h"
#include "dppl_sycl_enum_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.
*
Expand Down
90 changes: 90 additions & 0 deletions backends/include/dppl_sycl_enum_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
//===--- dppl_sycl_enum_types.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 defines DPPL specficif enum types that wrap corresponding Sycl
/// enum classes. These enums are defined primarily so that Python extensions
/// that use DPPL do not have to include Sycl headers directly.
///
//===----------------------------------------------------------------------===//

#pragma once

#include "Support/ExternC.h"

DPPL_C_EXTERN_C_BEGIN

/*!
* @brief Redefinition of DPC++-specific Sycl backend types.
*
*/
enum DPPLSyclBackendType
{
DPPL_UNKNOWN_BACKEND = 0x0,
DPPL_OPENCL = 1 << 16,
DPPL_HOST = 1 << 15,
DPPL_LEVEL_ZERO = 1 << 14,
DPPL_CUDA = 1 << 13
};

/*!
* @brief DPPL device types that are equivalent to Sycl's device_type.
*
*/
enum DPPLSyclDeviceType
{
DPPL_CPU = 1 << 0,
DPPL_GPU = 1 << 1,
DPPL_ACCELERATOR = 1 << 2,
DPPL_CUSTOM = 1 << 3,
DPPL_AUTOMATIC = 1 << 4,
DPPL_HOST_DEVICE = 1 << 5,
DPPL_ALL = 1 << 6
// IMP: before adding new values here look at DPPLSyclBackendType enum. The
// values should not overlap.
};

/*!
* @brief Supported types for kernel arguments to be passed to a Sycl kernel
* using DPPL.
*
* \todo Add support for sycl::buffer
*
*/
typedef enum
{
DPPL_CHAR,
DPPL_SIGNED_CHAR,
DPPL_UNSIGNED_CHAR,
DPPL_SHORT,
DPPL_INT,
DPPL_UNSIGNED_INT,
DPPL_LONG,
DPPL_UNSIGNED_LONG,
DPPL_LONG_LONG,
DPPL_UNSIGNED_LONG_LONG,
DPPL_SIZE_T,
DPPL_FLOAT,
DPPL_DOUBLE,
DPPL_LONG_DOUBLE,
DPPL_VOID_PTR
} DPPLKernelArgType;

DPPL_C_EXTERN_C_END
29 changes: 28 additions & 1 deletion backends/include/dppl_sycl_platform_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,46 @@
#pragma once

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

DPPL_C_EXTERN_C_BEGIN

/*!
* @brief Get the number of sycl::platform available on the system.
* @brief Returns the number of sycl::platform available on the system.
*
* @return The number of available sycl::platforms.
*/
DPPL_API
size_t DPPLPlatform_GetNumPlatforms ();

/*!
* @brief Returns the number of unique sycl backends on the system not counting
* the host backend.
*
* @return The number of unique sycl backends.
*/
DPPL_API
size_t DPPLPlatform_GetNumBackends ();

/*!
* @brief Returns an array of the unique DPPLSyclBackendType values on the system.
*
* @return An array of DPPLSyclBackendType enum values.
*/
DPPL_API
__dppl_give DPPLSyclBackendType* DPPLPlatform_GetListOfBackends ();

/*!
* @brief Frees an array of DPPLSyclBackendType enum values.
*
* @param BEArr An array of DPPLSyclBackendType enum values to be freed.
*/
DPPL_API
void DPPLPlatform_DeleteListOfBackends (__dppl_take DPPLSyclBackendType* BEArr);

/*!
* @brief Prints out some selected info about all sycl::platform on the system.
*
Expand Down
2 changes: 1 addition & 1 deletion backends/include/dppl_sycl_program_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ DPPL_API
__dppl_give DPPLSyclProgramRef
DPPLProgram_CreateFromOCLSource (__dppl_keep const DPPLSyclContextRef Ctx,
__dppl_keep const char *Source,
__dppl_keep const char *CompileOpts = nullptr);
__dppl_keep const char *CompileOpts);

/*!
* @brief Returns the SyclKernel with given name from the program, if not found
Expand Down
43 changes: 20 additions & 23 deletions backends/include/dppl_sycl_queue_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#pragma once

#include "dppl_data_types.h"
#include "dppl_sycl_enum_types.h"
#include "dppl_sycl_types.h"
#include "Support/DllExport.h"
#include "Support/ExternC.h"
Expand All @@ -36,37 +37,33 @@
DPPL_C_EXTERN_C_BEGIN

/*!
* @brief Supported types for kernel arguments to be passed to a Sycl kernel.
* @brief Delete the pointer after casting it to sycl::queue.
*
* \todo Add support for sycl::buffer
* @param QRef A DPPLSyclQueueRef pointer that gets deleted.
*/
DPPL_API
void DPPLQueue_Delete (__dppl_take DPPLSyclQueueRef QRef);

/*!
* @brief Checks if two DPPLSyclQueueRef objects point to the same sycl::queue.
*
* @param QRef1 First opaque pointer to the sycl queue.
* @param QRef2 Second opaque pointer to the sycl queue.
* @return True if the underlying sycl::queue are same, false otherwise.
*/
typedef enum
{
DPPL_CHAR,
DPPL_SIGNED_CHAR,
DPPL_UNSIGNED_CHAR,
DPPL_SHORT,
DPPL_INT,
DPPL_UNSIGNED_INT,
DPPL_LONG,
DPPL_UNSIGNED_LONG,
DPPL_LONG_LONG,
DPPL_UNSIGNED_LONG_LONG,
DPPL_SIZE_T,
DPPL_FLOAT,
DPPL_DOUBLE,
DPPL_LONG_DOUBLE,
DPPL_VOID_PTR
} DPPLKernelArgType;
DPPL_API
bool DPPLQueue_AreEq (__dppl_keep const DPPLSyclQueueRef QRef1,
__dppl_keep const DPPLSyclQueueRef QRef2);

/*!
* @brief Delete the pointer after casting it to sycl::queue.
* @brief Returns the Sycl backend for the provided sycl::queue.
*
* @param QRef A DPPLSyclQueueRef pointer that gets deleted.
* @param QRef An opaque pointer to the sycl queue.
* @return A enum DPPLSyclBackendType corresponding to the backed for the
* queue.
*/
DPPL_API
void DPPLQueue_Delete (__dppl_take DPPLSyclQueueRef QRef);
DPPLSyclBackendType DPPLQueue_GetBackend (__dppl_keep DPPLSyclQueueRef QRef);

/*!
* @brief Returns the Sycl context for the queue.
Expand Down
Loading