-
Notifications
You must be signed in to change notification settings - Fork 30
Add support for events, programs, and kernel submission to dpctl. #80
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
PokhodenkoSA
merged 13 commits into
IntelPython:master
from
diptorupd:feature/program_interfacev2
Oct 2, 2020
Merged
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
cf168ef
Add support for events, programs, and kernel submission to dpctl.
diptorupd 68e7402
Fix windows build for dpctl.
diptorupd 5393b46
Update .gitignore
diptorupd 03a2ab3
Minor cosmetic changes
diptorupd e48ba39
Additional information is now printed when dpctl.dump is called.
diptorupd bc23795
Fix test cases so that kernels are not submitted to default queue.
diptorupd 0986034
Add test files to package
PokhodenkoSA f99ca38
Update dpctl/tests/__init__.py
PokhodenkoSA a30df76
Update dpctl/tests/test_sycl_kernel_submit.py
PokhodenkoSA 62c0d08
Update dpctl/tests/test_sycl_program.py
PokhodenkoSA ecd4b46
Fix comment.
diptorupd 784e899
Merge branch 'feature/program_interfacev2' of github.com:diptorupd/dp…
diptorupd 53e1e39
Another comment was fixed.
diptorupd 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
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,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 |
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,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 |
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,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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is better to say, "at which point this function may become deprecated." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed the comment. Thanks. |
||
* | ||
* @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 |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean 'does not expose'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch. Fixed now.