21.02
CLUtils.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2020 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
25
#ifndef ARM_COMPUTE_CL_CLUTILS_H
26
#define ARM_COMPUTE_CL_CLUTILS_H
27
28
#include "
arm_compute/core/CL/OpenCL.h
"
29
30
namespace
arm_compute
31
{
32
class
TensorShape;
33
34
/** Create a cl::Image2D object from an OpenCL buffer
35
*
36
* @note The following conditions are required to create a OpenCL image object from OpenCL buffer,
37
* -# The platform should support the OpenCL cl_khr_image2d_from_buffer extension
38
* -# The stride Y for the input1 should satisfy the OpenCL pitch alignment requirement
39
* -# input width should be less or equal to (CL_DEVICE_IMAGE2D_MAX_WIDTH * 4)
40
* -# input height should be less or equal to CL_DEVICE_IMAGE2D_MAX_HEIGHT
41
*
42
* It is user responsibility to ensure the above conditions are satisfied since no checks are performed within this function
43
*
44
* @param[in] ctx cl::Context object
45
* @param[in] buffer cl::Buffer object from which the OpenCL image2d object is created
46
* @param[in] shape2d 2D tensor shape
47
* @param[in] data_type DataType to use. Only supported: F32,F16
48
* @param[in] image_row_pitch Image row pitch (a.k.a. stride Y) to be used in the image2d object
49
*
50
* @return cl::Image2D object
51
*/
52
cl::Image2D
create_image2d_from_buffer
(
const
cl::Context &ctx,
const
cl::Buffer &buffer,
const
TensorShape &shape2d,
DataType
data_type
,
size_t
image_row_pitch);
53
54
}
// arm_compute
55
56
#endif
/* ARM_COMPUTE_CL_CLUTILS_H */
arm_compute
Copyright (c) 2017-2021 Arm Limited.
Definition:
00_introduction.dox:24
arm_compute::test::validation::data_type
const DataType data_type
Definition:
Im2Col.cpp:150
OpenCL.h
Wrapper to configure the Khronos OpenCL C++ header.
arm_compute::create_image2d_from_buffer
cl::Image2D create_image2d_from_buffer(const cl::Context &ctx, const cl::Buffer &buffer, const TensorShape &shape2d, DataType data_type, size_t image_row_pitch)
Create a cl::Image2D object from an OpenCL buffer.
Definition:
CLUtils.cpp:29
arm_compute::DataType
DataType
Available data types.
Definition:
Types.h:77
src
core
CL
CLUtils.h
Generated on Thu Feb 25 2021 17:17:33 for Compute Library by
1.8.13