24.04
GpuCast.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2022-2024 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 ACL_ARM_COMPUTE_DYNAMIC_FUSION_SKETCH_GPU_OPERATORS_GPUCAST_H
25
#define ACL_ARM_COMPUTE_DYNAMIC_FUSION_SKETCH_GPU_OPERATORS_GPUCAST_H
26
27
#include "
arm_compute/dynamic_fusion/sketch/attributes/CastAttributes.h
"
28
29
namespace
arm_compute
30
{
31
namespace
experimental
32
{
33
namespace
dynamic_fusion
34
{
35
/** Forward declaration */
36
class
GpuWorkloadContext;
37
class
GpuWorkloadSketch;
38
39
/** Operator interface. */
40
class
GpuCast
final
41
{
42
public
:
43
/** Attributes are a set of backend-agnostic parameters that define what an operator does */
44
using
Attributes
=
CastAttributes
;
45
/** Create an operator and fuse it into the workload sketch.
46
* @note If @ref validate_op() fails, the creation also fails and may throw an error.
47
* @note If @ref validate_op() fails, @p sketch remains unchanged and valid.
48
*
49
* Valid data type configurations:
50
* |src |dst |
51
* |:--------------|:--------------------------------------|
52
* |F16 | F32 |
53
* |F32 | F16 |
54
*
55
* Input data type must be different than output data type.
56
*
57
* Valid data layouts:
58
* - Any
59
*
60
* @param[in,out] sketch Workload sketch into which the operator will be fused
61
* @param[in] src Left hand side tensor info. Data types supported: U8/S8/U16/S16/U32/S32/F16/F32.
62
* @param[in] attributes Operator attributes
63
*
64
* @return Pointer for the destination tensor info
65
*/
66
static
ITensorInfo
*
create_op
(
GpuWorkloadSketch
&
sketch
,
ITensorInfo
*
src
,
const
Attributes
&attributes);
67
/** Check if the operator configuration is supported, irrespective of fusion
68
*
69
* @param[in] context Workload context within which the operator is running
70
* @param[in] src Left hand side tensor info. Data types supported: All.
71
* @param[in] attributes Operator attributes
72
*
73
* @return Status
74
*/
75
static
Status
76
is_supported_op
(
const
GpuWorkloadContext
&
context
,
const
ITensorInfo
*
src
,
const
Attributes
&attributes);
77
/** Validate the operator and check if the its configuration is supported and if it can be fused into the workload sketch.
78
*
79
* Parameters are similar to @ref GpuCast::create_op()
80
*
81
* @return Status
82
*/
83
static
Status
validate_op
(
const
GpuWorkloadSketch
&
sketch
,
const
ITensorInfo
*
src
,
const
Attributes
&attributes);
84
};
85
}
// namespace dynamic_fusion
86
}
// namespace experimental
87
}
// namespace arm_compute
88
#endif // ACL_ARM_COMPUTE_DYNAMIC_FUSION_SKETCH_GPU_OPERATORS_GPUCAST_H
arm_compute::test::validation::src
SimpleTensor< float > src
Definition:
DFT.cpp:155
CastAttributes.h
arm_compute::experimental::dynamic_fusion::GpuCast::validate_op
static Status validate_op(const GpuWorkloadSketch &sketch, const ITensorInfo *src, const Attributes &attributes)
Validate the operator and check if the its configuration is supported and if it can be fused into the...
Definition:
GpuCast.cpp:95
arm_compute::experimental::dynamic_fusion::CastAttributes
Attributes are backend-agnostic parameters (in addition to the input/output tensors) of an operator.
Definition:
CastAttributes.h:39
arm_compute::test::validation::sketch
GpuWorkloadSketch sketch
Definition:
DirectConv2d.cpp:168
arm_compute::experimental::dynamic_fusion::GpuCast::is_supported_op
static Status is_supported_op(const GpuWorkloadContext &context, const ITensorInfo *src, const Attributes &attributes)
Check if the operator configuration is supported, irrespective of fusion.
Definition:
GpuCast.cpp:90
arm_compute::experimental::dynamic_fusion::GpuCast
Operator interface.
Definition:
GpuCast.h:40
arm_compute::experimental::dynamic_fusion::GpuWorkloadSketch
A descriptor of a workload of operators.
Definition:
GpuWorkloadSketch.h:42
arm_compute::Status
Status class.
Definition:
Error.h:52
arm_compute::experimental::dynamic_fusion::GpuWorkloadContext
Provide context necessary for the creation and configuration of a workload e.g.
Definition:
GpuWorkloadContext.h:57
arm_compute::test::validation::context
auto context
Definition:
DirectConv2d.cpp:167
arm_compute
Copyright (c) 2017-2024 Arm Limited.
Definition:
introduction.dox:24
arm_compute::experimental::dynamic_fusion::GpuCast::create_op
static ITensorInfo * create_op(GpuWorkloadSketch &sketch, ITensorInfo *src, const Attributes &attributes)
Create an operator and fuse it into the workload sketch.
Definition:
GpuCast.cpp:119
arm_compute::ITensorInfo
Store the tensor's metadata.
Definition:
ITensorInfo.h:44
arm_compute
dynamic_fusion
sketch
gpu
operators
GpuCast.h
Generated on Mon Apr 29 2024 10:53:52 for Compute Library by
1.8.17