24.07
|
Go to the documentation of this file.
34 namespace experimental
36 namespace dynamic_fusion
40 void calculate_and_init_dst_if_empty(ITensorInfo *
dst,
const ITensorInfo *lhs,
const ITensorInfo *rhs)
42 if (
dst->total_size() == 0U)
44 const std::pair<TensorShape, ValidRegion> broadcast_pair =
50 Status is_supported_op_helper(
const GpuWorkloadContext &
context,
51 const ITensorInfo *lhs,
52 const ITensorInfo *rhs,
53 const ITensorInfo *
dst,
54 const ElementwiseBinaryCommonAttributes &attributes)
58 TensorInfo dst_info_to_validate;
59 const ITensorInfo *dst_info_to_validate_ptr = &dst_info_to_validate;
63 dst_info_to_validate_ptr =
dst;
66 calculate_and_init_dst_if_empty(&dst_info_to_validate, lhs, rhs);
71 const auto cl_compile_ctx =
context.cl_compile_context();
76 ArgumentPack<ITensorInfo> arguments;
77 arguments.add_const_tensor(
ACL_SRC_0, lhs);
78 arguments.add_const_tensor(
ACL_SRC_1, rhs);
79 arguments.add_const_tensor(
ACL_DST_0, dst_info_to_validate_ptr);
95 ElementwiseBinaryCommonAttributes &
112 return is_supported_op_helper(
context, lhs, rhs,
nullptr, attributes);
127 calculate_and_init_dst_if_empty(&dst_info_to_validate, lhs, rhs);
137 "Operator fusion test failed. This operator cannot be fused into the workload");
140 return is_supported_op_helper(*
sketch.
gpu_context(), lhs, rhs, &dst_info_to_validate, attributes);
156 calculate_and_init_dst_if_empty(
dst, lhs, rhs);
Operator new_operator(const GpuOperatorType &operator_type, const ArgumentPack< ITensorInfo > &tensors) const
Create a new operator.
static ITensorInfo * create_op(GpuWorkloadSketch &sketch, ITensorInfo *lhs, ITensorInfo *rhs, const ElementwiseBinaryCommonAttributes &attributes)
Create an operator and fuse it into the workload sketch.
@ Run
Run every time after the first time.
@ Simple
Simple operators are operators that:
ITensorInfo * create_virtual_tensor()
Create a virtual (see MemoryType) tensor info and save it.
const GpuOperatorGroup & operator_group() const
Get operator group.
bool try_add_operator(const Operator &op, bool is_output=false) const
Try adding (without actually adding) an operator to the group.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
This is a generic class that packs the arguments of an operator.
const GpuWorkloadContext * gpu_context() const
Get the gpu workload context of this sketch.
Implementation & implementation()
Get the implementation.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
bool has_valid_id() const
Check if the tensor id is valid.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
const GpuKernelComponentGraph & component_graph() const
Get component graph.
A descriptor of a workload of operators.
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, QuantizationInfo quantization_info=QuantizationInfo())
Auto initialize the tensor info (shape, number of channels and data type) if the current assignment i...
Provide context necessary for the creation and configuration of a workload e.g.
void add_const_tensor(Id id, const T *tensor)
Add const tensor to the pack.
const Context * context() const
Get workload context.
void add_tensor(Id id, T *tensor)
Add tensor to the pack.
static std::pair< TensorShape, ValidRegion > broadcast_shape_and_valid_region(const Infos &...infos)
If infos are broadcast compatible tensor info's, return the broadcasted shape and the intersection of...
ElementwiseOp operation() const
Get operation.
Describes when a unit workload is run.
GpuOperatorType
Contain properties common to all operator types.
Store the tensor's metadata.
#define ARM_COMPUTE_RETURN_ERROR_ON_MSG(cond, msg)
If the condition is true, an error is returned.
Copyright (c) 2017-2024 Arm Limited.
static Status validate(const ArgumentPack< ITensorInfo > &tensors, const ElementwiseBinaryCommonAttributes &attributes)
Validate the component.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
KernelProperties Properties
Store the tensor's metadata.
#define ARM_COMPUTE_RETURN_ERROR_MSG(...)
An error is returned with the given description.
void add_operator(const Operator &op, bool is_output=false)
Add an operator to the group.
#define ARM_COMPUTE_LOG_PARAMS(...)
static Status validate_op(const GpuWorkloadSketch &sketch, const ITensorInfo *rhs, const ITensorInfo *lhs, const ElementwiseBinaryCommonAttributes &attributes)
Validate the operator and check if it can be fused into the workload sketch.
static Status is_supported_op(const GpuWorkloadContext &context, const ITensorInfo *lhs, const ITensorInfo *rhs, const ElementwiseBinaryCommonAttributes &attributes)
Check if the operator configuration is supported, irrespective of fusion.