Skip to content

Feature/program interface #47

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
defc264
Move _memory.pyx
PokhodenkoSA Sep 15, 2020
8b811c5
Import setuptools before Cython. Otherwise, both might disagree about…
PokhodenkoSA Sep 15, 2020
0704258
Add dppl._memory Cython module.
PokhodenkoSA Sep 15, 2020
e57927d
Run dppl/tests/dppl_tests too when run all unit tests.
PokhodenkoSA Sep 15, 2020
267492f
Add tests for memory manager.
PokhodenkoSA Sep 15, 2020
5ff3eb0
Split tests for memory. One test one context (no, CPU, GPU).
PokhodenkoSA Sep 15, 2020
902bc8a
[opt] Rename getpyexts() to extensions().
PokhodenkoSA Sep 15, 2020
5d81879
Adds C and Cython API for portions of Sycl queue, device, context int…
diptorupd Sep 15, 2020
758aacc
Add C-API stub library for sycl memory.
PokhodenkoSA Sep 16, 2020
35a4674
Add missing DPPL_API.
diptorupd Sep 16, 2020
7bb5faf
Move platform specific functions into a separate file.
diptorupd Sep 16, 2020
4a11490
Create a single utility function to delete C strings.
diptorupd Sep 16, 2020
6e246fb
Update backends/source/dppl_utils.cpp
PokhodenkoSA Sep 17, 2020
97b53ca
Merge branch 'pr/30' into feature/usm
PokhodenkoSA Sep 17, 2020
abcf6f3
Add _sycl_core.pxd file.
PokhodenkoSA Sep 17, 2020
039b794
Remove using of PyCapsule in _memory.pyx.
PokhodenkoSA Sep 17, 2020
dc72b03
Small style fixes in _memory.pyx.
PokhodenkoSA Sep 17, 2020
b5ab5d6
Moved functions from _memory.pyx to C-API interface library.
PokhodenkoSA Sep 17, 2020
c57c05c
Move Cython definitions for backend to single pxd file.
PokhodenkoSA Sep 17, 2020
c075f0c
Remove SyclQueue from _memory.pyx
PokhodenkoSA Sep 17, 2020
708fd1f
Use SyclQueue from
PokhodenkoSA Sep 17, 2020
5d3db20
Remove cl::sycl::queue from _memory.pyx
PokhodenkoSA Sep 17, 2020
6747080
Removed commented code from _memory.pyx
PokhodenkoSA Sep 17, 2020
56241ef
Eliminate temporary context object.
PokhodenkoSA Sep 17, 2020
7fabbe4
Fix style.
PokhodenkoSA Sep 17, 2020
abd373b
Add MemoryUSM* classes.
PokhodenkoSA Sep 18, 2020
ba3e497
Add __getbuffer__ to Shared and Host MemoryUSM classes.
PokhodenkoSA Sep 18, 2020
00d63b0
Rename C-API types for USM.
PokhodenkoSA Sep 18, 2020
28f0496
Add DPPLUSM_GetPointerType and remove types from CL/sycl.hpp from _me…
PokhodenkoSA Sep 18, 2020
80cec2a
Clean unused code from _memory_.pyx
PokhodenkoSA Sep 18, 2020
debc2eb
Merge branch 'master' into feature/usm
PokhodenkoSA Sep 18, 2020
8ef95df
Small fixes.
PokhodenkoSA Sep 18, 2020
fa585da
Remove unused code.
PokhodenkoSA Sep 18, 2020
533e74b
Fix style.
PokhodenkoSA Sep 18, 2020
ab7a9ba
Fix style
PokhodenkoSA Sep 18, 2020
0edf5a1
Add typedefs for some more sycl data types.
diptorupd Sep 19, 2020
b5674b4
Use wrap().
PokhodenkoSA Sep 19, 2020
5e93d6e
Store context instead of queue in Memory class.
PokhodenkoSA Sep 19, 2020
6bd1756
Pass queue as parameter to constructor. If queue is None then get dpp…
PokhodenkoSA Sep 19, 2020
1333676
Add comment about casting memory_ptr to char*.
PokhodenkoSA Sep 19, 2020
b82eab5
Remove pointer property from Memory.
PokhodenkoSA Sep 19, 2020
1b5f804
Rename file with usm tests.
PokhodenkoSA Sep 19, 2020
722c8cf
Standardize the names of DPPL functions on DPPLXXX_FuncName.
diptorupd Sep 19, 2020
1b92c15
Merge branch 'feature/usm' into rename_functions
diptorupd Sep 19, 2020
a9b1011
Merge branch 'master' into rename_functions
diptorupd Sep 19, 2020
0c67a99
Fix files.
diptorupd Sep 19, 2020
7e5e955
Merge branch 'rename_functions' into feature/program_interface
diptorupd Sep 19, 2020
fa2955e
Minor changes to scripts.
diptorupd Sep 19, 2020
503ead4
Fix name og tester class.
diptorupd Sep 20, 2020
49ea38b
Add the C API for program, kernel interfaces.
diptorupd Sep 21, 2020
09c4587
Add tests to check program creation from SPIR-V.
diptorupd Sep 21, 2020
140d0af
Fix name for the DPPLSyclKernelRef deleter.
diptorupd Sep 22, 2020
756d293
Add classes for SyclProgram and SyclDevice.
diptorupd Sep 22, 2020
3802f53
Rename the CString deleter to follow convention in rest of the library.
diptorupd Sep 22, 2020
1dd2cf8
Merge branch 'rename_functions' into feature/program_interface
diptorupd Sep 22, 2020
ead3c7c
Update function name.
diptorupd Sep 22, 2020
eb0de50
Add Cython wrapper functions to create sycl programs.
diptorupd Sep 22, 2020
c6675c3
Merge branch 'master' into feature/program_interface
diptorupd Sep 22, 2020
f50cda9
Expose in Cython some more DPPLKernel functions.
diptorupd Sep 22, 2020
647a87e
Merge branch 'master' into feature/program_interface
diptorupd Sep 22, 2020
ec2be8a
Fix leftover PyDPPL use, and add/update copyright notices.
diptorupd Sep 22, 2020
0871041
Reorganize tests and minor fixes to change dppl to dpctl.
diptorupd Sep 22, 2020
b7f3a7e
Fix indentation.
diptorupd Sep 23, 2020
4cb0820
Merge branch 'fix/leftover_name_changes' into feature/program_interface
diptorupd Sep 23, 2020
7cb811a
Merge branch 'feature/refactor_tests' into feature/program_interface
diptorupd Sep 23, 2020
3138fe5
Change test class name.
diptorupd Sep 23, 2020
7a821e4
Merge branch 'feature/refactor_tests' into feature/program_interface
diptorupd Sep 23, 2020
7f83935
Use wrap/unwrap macros.
diptorupd Sep 23, 2020
a331de0
Fix names in docstrings.
diptorupd Sep 23, 2020
e84e48e
Merge branch 'fix/leftover_name_changes' into feature/refactor_tests
diptorupd Sep 23, 2020
e9e37d0
Fix names etc.
diptorupd Sep 23, 2020
5a71d4f
Rename function from is_in_dpctl_ctxt to is_in_device_context.
diptorupd Sep 23, 2020
56d61d0
Merge branch 'fix/leftover_name_changes' into feature/program_interface
diptorupd Sep 23, 2020
6dbeddf
Merge branch 'feature/refactor_tests' into feature/program_interface
diptorupd Sep 23, 2020
138f934
Add queue submit and wait API.
diptorupd Sep 23, 2020
ada1d01
Add some temporary prints to instrument.
diptorupd Sep 23, 2020
f96dc26
Fix program creation from source and add a test case.
diptorupd Sep 23, 2020
9e72b98
WIP compile spirv program...
diptorupd Sep 24, 2020
d3049c2
Merge branch 'master' into feature/program_interface
Sep 24, 2020
ad80143
Fix program build from spirv.
Sep 24, 2020
814a290
Store a reference to the ffi, lib object so they are removed aonly on…
Sep 24, 2020
28dcf62
Merge branch 'upstream_master' into feature/program_interface
diptorupd Sep 24, 2020
36e69db
Add C unit test for the queue submit and wait calls.
diptorupd Sep 25, 2020
f6e05fb
WIP submit function.
diptorupd Sep 25, 2020
a9d8cf7
WIP stuff..
Sep 25, 2020
3d21faa
Add wrapper for SYCL queue::memcpy().
PokhodenkoSA Sep 25, 2020
5584588
Fix comment.
PokhodenkoSA Sep 26, 2020
2f2cde1
WIP stuff...
diptorupd Sep 26, 2020
b68aa9a
Merge branch 'buildscript_refactor' into feature/program_interface
diptorupd Sep 26, 2020
8d99c84
WIP changes to queue submit.
diptorupd Sep 28, 2020
cd35423
Handle exception.
diptorupd Sep 28, 2020
ec7a0dd
added processing of ctype.c_float
oleksandr-pavlyk Sep 28, 2020
190a2d7
Merge branch 'add-get-include-and-include-headers' into feature/progr…
diptorupd Sep 28, 2020
860d2e1
added processing of gSize
oleksandr-pavlyk Sep 28, 2020
17794a2
Merge remote-tracking branch 'origin/master' into add-float
oleksandr-pavlyk Sep 28, 2020
5f86e2f
WIP towards passing USM memory to kernel
oleksandr-pavlyk Sep 28, 2020
2585aa7
Merge remote-tracking branch 'sergey/feature/memcpy' into add-float
oleksandr-pavlyk Sep 28, 2020
872dd8f
fixed Cython errors
oleksandr-pavlyk Sep 28, 2020
fa4a3ba
fixed test_kernel_sybmit
oleksandr-pavlyk Sep 28, 2020
9445d17
Merge branch 'add-float' into feature/program_interface
diptorupd Sep 28, 2020
b6c68fb
Minor change.
diptorupd Sep 28, 2020
3f0b556
Remove printf
diptorupd Sep 29, 2020
4890e61
Rename DPPLQueue_Submit and allow DepEvents.
diptorupd Sep 29, 2020
c0f6521
Update Cython to use latest DubmitRange function.
diptorupd Sep 29, 2020
c185789
Refactoring
diptorupd Sep 29, 2020
3b19998
Fix indentation.
diptorupd Sep 29, 2020
1f7a0b1
Fix test case.
diptorupd Sep 29, 2020
2b3b62a
Minor refactoring...
diptorupd Sep 30, 2020
1e1b030
Add nd_range support.
diptorupd Sep 30, 2020
7a5b4d4
add support for dependent events.
diptorupd Sep 30, 2020
c70c55f
Add a basic unit test to test kernel submission.
diptorupd Sep 30, 2020
bdef26c
Add a basic unit test.
diptorupd Sep 30, 2020
a6e0aef
Merge branch 'master' into feature/program_interface
diptorupd Sep 30, 2020
bd2c171
minor clean ups left over by merge.
diptorupd Sep 30, 2020
39c54ae
Add extra new line.
diptorupd Sep 30, 2020
a665c4d
Merge branch 'master' into feature/program_interface
diptorupd Sep 30, 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
3 changes: 3 additions & 0 deletions backends/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ add_library(
SHARED
source/dppl_sycl_context_interface.cpp
source/dppl_sycl_device_interface.cpp
source/dppl_sycl_event_interface.cpp
source/dppl_sycl_kernel_interface.cpp
source/dppl_sycl_platform_interface.cpp
source/dppl_sycl_program_interface.cpp
source/dppl_sycl_queue_interface.cpp
source/dppl_sycl_queue_manager.cpp
source/dppl_sycl_usm_interface.cpp
Expand Down
6 changes: 2 additions & 4 deletions backends/dbg_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mkdir build
pushd build

INSTALL_PREFIX=`pwd`/../install
rm -rf ${INSTALL_PREFIX}
export ONEAPI_ROOT=/opt/intel/oneapi
DPCPP_ROOT=${ONEAPI_ROOT}/compiler/latest/linux
PYTHON_INC=`python -c "import distutils.sysconfig; \
Expand All @@ -24,9 +25,6 @@ cmake \
-DGTEST_LIB_DIR=${CONDA_PREFIX}/lib \
..

make V=1 -n -j 4
make check
make install

make V=1 -n -j 4 && make check && make install

popd
55 changes: 55 additions & 0 deletions backends/include/dppl_sycl_event_interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//===--- dppl_sycl_event_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 a sub-set of the sycl::event 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"


DPPL_C_EXTERN_C_BEGIN

/*!
* @brief C-API wrapper for sycl::event.wait.
*
* @param ERef An opaque DPPLSyclEventRef pointer on which to wait.
*/
DPPL_API
void DPPLEvent_Wait (__dppl_keep DPPLSyclEventRef ERef);

/*!
* @brief Deletes the DPPLSyclEventRef after casting it to a sycl::event.
*
* @param ERef An opaque DPPLSyclEventRef pointer that would be
* freed.
*/
DPPL_API
void
DPPLEvent_Delete (__dppl_take DPPLSyclEventRef ERef);

DPPL_C_EXTERN_C_END
74 changes: 74 additions & 0 deletions backends/include/dppl_sycl_kernel_interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//===---- dppl_sycl_kernel_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 create Sycl kernels from OpenCL kernels. In
/// future, API to create interoperability kernels from other languages such as
/// Level-0 driver API may be added here.
///
/// \todo Investigate what we should do when we add support for Level-0 API.
///
//===----------------------------------------------------------------------===//

#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 Returns a C string for the kernel name.
*
* @param KRef DPPLSyclKernelRef pointer to an OpenCL
* interoperability kernel.
* @return If a kernel name exists then returns it as a C string, else
* returns a nullptr.
*/
DPPL_API
__dppl_give const char*
DPPLKernel_GetFunctionName (__dppl_keep const DPPLSyclKernelRef KRef);

/*!
* @brief Returns the number of arguments for the OpenCL kernel.
*
* @param KRef DPPLSyclKernelRef pointer to an OpenCL
* interoperability kernel.
* @return Returns the number of arguments for the OpenCL interoperability
* kernel.
*/
DPPL_API
size_t
DPPLKernel_GetNumArgs (__dppl_keep const DPPLSyclKernelRef KRef);

/*!
* @brief Deletes the DPPLSyclKernelRef after casting it to a sycl::kernel.
*
* @param KRef DPPLSyclKernelRef pointer to an OpenCL
* interoperability kernel.
*/
DPPL_API
void
DPPLKernel_Delete (__dppl_take DPPLSyclKernelRef KRef);

DPPL_C_EXTERN_C_END
114 changes: 114 additions & 0 deletions backends/include/dppl_sycl_program_interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
//===---- dppl_sycl_program_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 create Sycl program an interoperability
/// program defined in OpenCL. In future, API to create interoperability
/// kernels from other languages such as Level-0 driver API may be added here.
///
/// \todo Investigate what we should do when we add support for Level-0 API.
///
//===----------------------------------------------------------------------===//

#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 Create a Sycl program from an OpenCL SPIR-V binary file.
*
* Sycl 1.2 does expose any method to create a sycl::program from a SPIR-V IL
* file. To get around this limitation, we need to use the Sycl feature to
* create an interoperability kernel from an OpenCL kernel. This function first
* creates an OpenCL program and kernel from the SPIR-V binary and then using
* the Sycl-OpenCL interoperability feature creates a Sycl kernel from the
* OpenCL kernel.
*
* The feature to create a Sycl kernel from a SPIR-V IL binary will be available
* in Sycl 2.0, at which point we may deprecate this function.
*
* @param Ctx An opaque pointer to a sycl::context
* @param IL SPIR-V binary
* @return A new SyclProgramRef pointer if the program creation succeeded,
* else returns NULL.
*/
DPPL_API
__dppl_give DPPLSyclProgramRef
DPPLProgram_CreateFromOCLSpirv (__dppl_keep const DPPLSyclContextRef Ctx,
__dppl_keep const void *IL,
size_t Length);

/*!
* @brief Create a Sycl program from an OpenCL kernel source string.
*
* @param Ctx An opaque pointer to a sycl::context
* @param Source OpenCL source string
* @param CompileOptions Extra compiler flags (refer Sycl spec.)
* @return A new SyclProgramRef pointer if the program creation succeeded,
* else returns NULL.
*/
DPPL_API
__dppl_give DPPLSyclProgramRef
DPPLProgram_CreateFromOCLSource (__dppl_keep const DPPLSyclContextRef Ctx,
__dppl_keep const char *Source,
__dppl_keep const char *CompileOpts = nullptr);

/*!
* @brief Returns the SyclKernel with given name from the program, if not found
* then return NULL.
*
* @param PRef Opaque pointer to a sycl::program
* @param KernelName Name of kernel
* @return A SyclKernel reference if the kernel exists, else NULL
*/
DPPL_API
__dppl_give DPPLSyclKernelRef
DPPLProgram_GetKernel (__dppl_keep DPPLSyclProgramRef PRef,
__dppl_keep const char *KernelName);

/*!
* @brief Return True if a SyclKernel with given name exists in the program, if
* not found then returns False.
*
* @param PRef Opaque pointer to a sycl::program
* @param KernelName Name of kernel
* @return True if the kernel exists, else False
*/
DPPL_API
bool
DPPLProgram_HasKernel (__dppl_keep DPPLSyclProgramRef PRef,
__dppl_keep const char *KernelName);

/*!
* @brief Frees the DPPLSyclProgramRef pointer.
*
* @param PRef Opaque pointer to a sycl::program
*/
DPPL_API
void
DPPLProgram_Delete (__dppl_take DPPLSyclProgramRef PRef);

DPPL_C_EXTERN_C_END
Loading