Georgios Pinitas | 8a5146f | 2021-01-12 15:51:07 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021 Arm Limited. |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
| 24 | #ifndef ARM_COMPUTE_ACLOPENCLEXT_H_ |
| 25 | #define ARM_COMPUTE_ACLOPENCLEXT_H_ |
| 26 | |
| 27 | #include "arm_compute/AclTypes.h" |
| 28 | |
| 29 | #ifndef CL_TARGET_OPENCL_VERSION |
| 30 | #define CL_TARGET_OPENCL_VERSION 200 |
| 31 | #define CL_USE_DEPRECATED_OPENCL_1_1_APIS |
| 32 | #define CL_USE_DEPRECATED_OPENCL_1_2_APIS |
| 33 | #endif /* CL_TARGET_OPENCL_VERSION */ |
| 34 | #pragma GCC diagnostic push |
| 35 | #pragma GCC diagnostic ignored "-Weffc++" |
| 36 | #include "include/CL/cl.h" |
| 37 | #pragma GCC diagnostic pop |
| 38 | |
| 39 | #ifdef __cplusplus |
| 40 | extern "C" { |
| 41 | #endif /* __cplusplus */ |
| 42 | |
| 43 | /** Extract the underlying OpenCL context used by a given Compute Library context object |
| 44 | * |
| 45 | * @note @ref AclContext should be of an OpenCL backend target |
| 46 | * @note @ref AclContext refcount should be 0, meaning not used by other objects |
| 47 | * |
| 48 | * @param[in] ctx A valid non-zero context |
| 49 | * @param[out] opencl_context Underlying OpenCL context used |
| 50 | * |
| 51 | * @return Status code |
| 52 | */ |
| 53 | AclStatus AclGetClContext(AclContext ctx, cl_context *opencl_context); |
| 54 | |
| 55 | /** Set the underlying OpenCL context used by a given Compute Library context object |
| 56 | * |
| 57 | * @note @ref AclContext should be of an OpenCL backend target |
| 58 | * |
| 59 | * @param[in] ctx A valid non-zero context object |
| 60 | * @param[out] opencl_context Underlying OpenCL context to be used |
| 61 | * |
| 62 | * @return Status code |
| 63 | */ |
| 64 | AclStatus AclSetClContext(AclContext ctx, cl_context opencl_context); |
| 65 | |
Georgios Pinitas | 3f26ef4 | 2021-02-23 10:01:33 +0000 | [diff] [blame^] | 66 | /** Extract the underlying OpenCL memory object by a given Compute Library tensor object |
| 67 | * |
| 68 | * @param[in] tensor A valid non-zero tensor |
| 69 | * @param[out] opencl_mem Underlyig OpenCL memory object |
| 70 | * |
| 71 | * @return Status code |
| 72 | */ |
| 73 | AclStatus AclGetClMem(AclTensor tensor, cl_mem *opencl_mem); |
| 74 | |
Georgios Pinitas | 8a5146f | 2021-01-12 15:51:07 +0000 | [diff] [blame] | 75 | #ifdef __cplusplus |
| 76 | } |
| 77 | #endif /* __cplusplus */ |
| 78 | #endif /* ARM_COMPUTE_ACLOPENCLEXT_H_ */ |