aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadContext.h47
-rw-r--r--arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h25
-rw-r--r--src/dynamic_fusion/sketch/gpu/GpuWorkloadContext.cpp88
-rw-r--r--src/dynamic_fusion/sketch/gpu/GpuWorkloadContextImpl.h99
-rw-r--r--src/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.cpp14
-rw-r--r--src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h23
-rw-r--r--src/dynamic_fusion/sketch/gpu/operators/GpuSoftmax.cpp4
-rw-r--r--tests/validation/dynamic_fusion/gpu/Integration.cpp262
-rw-r--r--tests/validation/dynamic_fusion/gpu/cl/Add.cpp8
-rw-r--r--tests/validation/dynamic_fusion/gpu/cl/Clamp.cpp6
-rw-r--r--tests/validation/dynamic_fusion/gpu/cl/DepthwiseConv2d.cpp10
-rw-r--r--tests/validation/dynamic_fusion/gpu/cl/DirectConv2d.cpp10
-rw-r--r--tests/validation/dynamic_fusion/gpu/cl/Mul.cpp8
-rw-r--r--tests/validation/dynamic_fusion/gpu/cl/Pool2d.cpp8
-rw-r--r--tests/validation/dynamic_fusion/gpu/cl/Reshape.cpp6
-rw-r--r--tests/validation/dynamic_fusion/gpu/cl/Resize.cpp36
-rw-r--r--tests/validation/dynamic_fusion/gpu/cl/Sigmoid.cpp6
-rw-r--r--tests/validation/dynamic_fusion/gpu/cl/Softmax.cpp8
-rw-r--r--tests/validation/dynamic_fusion/gpu/cl/Sub.cpp8
-rw-r--r--tests/validation/dynamic_fusion/gpu/cl/Tanh.cpp6
-rw-r--r--tests/validation/fixtures/dynamic_fusion/gpu/cl/DepthwiseConv2dFixture.h12
-rw-r--r--tests/validation/fixtures/dynamic_fusion/gpu/cl/DirectConv2dFixture.h24
-rw-r--r--tests/validation/fixtures/dynamic_fusion/gpu/cl/ElementwiseBinaryFixture.h12
-rw-r--r--tests/validation/fixtures/dynamic_fusion/gpu/cl/Pool2dFixture.h8
-rw-r--r--tests/validation/fixtures/dynamic_fusion/operators/ActivationFixture.h8
-rw-r--r--tests/validation/fixtures/dynamic_fusion/operators/CastFixture.h8
-rw-r--r--tests/validation/fixtures/dynamic_fusion/operators/ClampFixture.h8
-rw-r--r--tests/validation/fixtures/dynamic_fusion/operators/MulFixture.h56
-rw-r--r--tests/validation/fixtures/dynamic_fusion/operators/ReshapeFixture.h8
-rw-r--r--tests/validation/fixtures/dynamic_fusion/operators/ResizeFixture.h8
-rw-r--r--tests/validation/fixtures/dynamic_fusion/operators/SoftmaxFixture.h8
31 files changed, 608 insertions, 234 deletions
diff --git a/arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadContext.h b/arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadContext.h
index 1ee3c7e3ec..0b60899734 100644
--- a/arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadContext.h
+++ b/arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadContext.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Arm Limited.
+ * Copyright (c) 2022-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -25,6 +25,7 @@
#define ARM_COMPUTE_DYNAMIC_FUSION_SKETCH_GPU_GPUWORKLOADCONTEXT
#include "arm_compute/core/GPUTarget.h"
+#include "arm_compute/core/TensorInfo.h"
#include <memory>
@@ -56,16 +57,20 @@ enum class GpuLanguage
class GpuWorkloadContext
{
public:
+ class Impl;
+
/** Constructor */
GpuWorkloadContext(CLCompileContext *cl_compile_context);
- /** Allow instances of this class to be copy constructed */
- GpuWorkloadContext(const GpuWorkloadContext &config) = default;
- /** Allow instances of this class to be copied */
- GpuWorkloadContext &operator=(const GpuWorkloadContext &config) = default;
+ /** Destructor */
+ ~GpuWorkloadContext();
+ /** Prohibit instances of this class to be copy constructed */
+ GpuWorkloadContext(const GpuWorkloadContext &config) = delete;
+ /** Prohibit instances of this class to be copied */
+ GpuWorkloadContext &operator=(const GpuWorkloadContext &config) = delete;
/** Allow instances of this class to be move constructed */
- GpuWorkloadContext(GpuWorkloadContext &&config) = default;
+ GpuWorkloadContext(GpuWorkloadContext &&config);
/** Allow instances of this class to be moved */
- GpuWorkloadContext &operator=(GpuWorkloadContext &&config) = default;
+ GpuWorkloadContext &operator=(GpuWorkloadContext &&config);
/** Get @ref GpuLanguage of the context */
GpuLanguage gpu_language() const;
/** Get @ref GpuTarget of the context */
@@ -75,9 +80,33 @@ public:
*/
const CLCompileContext *cl_compile_context() const;
+ /** Create a @ref TensorInfo associated with the workload context.
+ *
+ * @return TensorInfo Newly created tensor info
+ */
+ template <typename... TArgs>
+ TensorInfo create_tensor_info(TArgs &&... args)
+ {
+ auto tensor_info = TensorInfo(std::forward<TArgs>(args)...);
+ register_user_tensor(tensor_info);
+ return tensor_info;
+ }
+
+ /** Get the internal implementation */
+ Impl &implementation();
+
+ /** Get the internal implementation */
+ const Impl &implementation() const;
+
private:
- GpuLanguage _gpu_language{ GpuLanguage::Unknown };
- CLCompileContext *_cl_compile_ctx{ nullptr };
+ /** Set a new ID to the tensor info and register its memory descriptor to the context.
+ *
+ * @param[in,out] tensor_info @ref ITensorInfo to be registered.
+ */
+ void register_user_tensor(ITensorInfo &tensor_info);
+
+ /** Internal implementation */
+ std::unique_ptr<Impl> _impl;
};
} // namespace dynamic_fusion
diff --git a/arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h b/arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h
index 155df293bf..75c2b1f528 100644
--- a/arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h
+++ b/arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Arm Limited.
+ * Copyright (c) 2022-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,7 +24,6 @@
#ifndef ARM_COMPUTE_DYNAMIC_FUSION_SKETCH_GPU_GPUWORKLOADSKETCH
#define ARM_COMPUTE_DYNAMIC_FUSION_SKETCH_GPU_GPUWORKLOADSKETCH
-#include "arm_compute/core/TensorInfo.h"
#include "arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadContext.h"
#include <memory>
@@ -62,30 +61,8 @@ public:
const Implementation &implementation() const;
/** Get the gpu workload context of this sketch */
const GpuWorkloadContext *gpu_context() const;
- /** Create a @ref TensorInfo associated with the workload sketch.
- *
- * @return TensorInfo Newly created tensor info
- */
- template <typename... Args>
- TensorInfo create_tensor_info(Args &&... args)
- {
- auto tensor_info = TensorInfo(std::forward<Args>(args)...);
- register_new_tensor(tensor_info);
- return tensor_info;
- }
- /** Create a default @ref TensorInfo associated with the workload sketch
- * It is usually used by user input or output tensors
- *
- * @return TensorInfo Newly created tensor info
- */
- TensorInfo create_tensor_info();
private:
- /** Register a new tensor by setting a new id to it and register its memory descriptor in the sketch
- *
- * @param[in,out] tensor_info @ref ITensorInfo that will be registered
- */
- void register_new_tensor(ITensorInfo &tensor_info);
std::unique_ptr<Implementation> _impl; /**< Internal opaque implementation*/
};
diff --git a/src/dynamic_fusion/sketch/gpu/GpuWorkloadContext.cpp b/src/dynamic_fusion/sketch/gpu/GpuWorkloadContext.cpp
index 623bf351f8..50f34d9c14 100644
--- a/src/dynamic_fusion/sketch/gpu/GpuWorkloadContext.cpp
+++ b/src/dynamic_fusion/sketch/gpu/GpuWorkloadContext.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Arm Limited.
+ * Copyright (c) 2022-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -21,8 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
+
#include "arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadContext.h"
#include "arm_compute/core/CL/CLCompileContext.h"
+#include "src/dynamic_fusion/sketch/gpu/GpuWorkloadContextImpl.h"
namespace arm_compute
{
@@ -30,26 +32,104 @@ namespace experimental
{
namespace dynamic_fusion
{
+
GpuWorkloadContext::GpuWorkloadContext(CLCompileContext *cl_compile_ctx)
- : _gpu_language{ GpuLanguage::OpenCL }, _cl_compile_ctx{ cl_compile_ctx }
+ : _impl { std::make_unique<Impl>(GpuLanguage::OpenCL, cl_compile_ctx) }
{
}
+GpuWorkloadContext::~GpuWorkloadContext() = default;
+
+GpuWorkloadContext::GpuWorkloadContext(GpuWorkloadContext &&other) = default;
+
+GpuWorkloadContext &GpuWorkloadContext::operator=(GpuWorkloadContext &&other) = default;
+
GpuTarget GpuWorkloadContext::gpu_target() const
{
- return _cl_compile_ctx->get_gpu_target();
+ return _impl->cl_compile_context()->get_gpu_target();
}
GpuLanguage GpuWorkloadContext::gpu_language() const
{
- return _gpu_language;
+ return _impl->gpu_language();
}
const CLCompileContext *GpuWorkloadContext::cl_compile_context() const
{
+ return _impl->cl_compile_context();
+}
+
+void GpuWorkloadContext::register_user_tensor(ITensorInfo &tensor_info)
+{
+ _impl->register_user_tensor(tensor_info);
+}
+
+GpuWorkloadContext::Impl &GpuWorkloadContext::implementation()
+{
+ return *_impl;
+}
+
+const GpuWorkloadContext::Impl &GpuWorkloadContext::implementation() const
+{
+ return *_impl;
+}
+
+GpuWorkloadContext::Impl::Impl(GpuLanguage gpu_language, CLCompileContext *cl_compile_ctx)
+ : _gpu_language(gpu_language), _cl_compile_ctx(cl_compile_ctx),
+ _next_tensor_id(1), _mem_map()
+{
+}
+
+GpuLanguage GpuWorkloadContext::Impl::gpu_language() const
+{
+ return _gpu_language;
+}
+
+const CLCompileContext *GpuWorkloadContext::Impl::cl_compile_context() const
+{
return _cl_compile_ctx;
}
+const MemoryDescriptorMap &GpuWorkloadContext::Impl::mem_map() const
+{
+ return _mem_map;
+}
+
+void GpuWorkloadContext::Impl::register_user_tensor(ITensorInfo &tensor_info)
+{
+ ARM_COMPUTE_ERROR_ON(tensor_info.has_valid_id());
+
+ const auto tensor_id = next_tensor_id();
+
+ tensor_info.set_id(tensor_id);
+ _mem_map[tensor_id] = MemoryDescriptor{ MemoryType::User };
+}
+
+void GpuWorkloadContext::Impl::register_aux_tensor(ITensorInfo &tensor_info, const AuxMemoryInfo &mem_info)
+{
+ ARM_COMPUTE_ERROR_ON(tensor_info.has_valid_id());
+
+ const auto tensor_id = next_tensor_id();
+
+ tensor_info.set_id(tensor_id);
+ _mem_map[tensor_id] = MemoryDescriptor{ MemoryType::Auxiliary, mem_info };
+}
+
+void GpuWorkloadContext::Impl::register_virtual_tensor(ITensorInfo &tensor_info)
+{
+ ARM_COMPUTE_ERROR_ON(tensor_info.has_valid_id());
+
+ const auto tensor_id = -next_tensor_id();
+
+ tensor_info.set_id(tensor_id);
+ _mem_map[tensor_id] = MemoryDescriptor{ MemoryType::Virtual };
+}
+
+ITensorInfo::Id GpuWorkloadContext::Impl::next_tensor_id()
+{
+ return _next_tensor_id++;
+}
+
} // namespace dynamic_fusion
} // namespace experimental
} // namespace arm_compute
diff --git a/src/dynamic_fusion/sketch/gpu/GpuWorkloadContextImpl.h b/src/dynamic_fusion/sketch/gpu/GpuWorkloadContextImpl.h
new file mode 100644
index 0000000000..a857932791
--- /dev/null
+++ b/src/dynamic_fusion/sketch/gpu/GpuWorkloadContextImpl.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2023 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_GPUWORKLOADCONTEXTIMPL_H
+#define ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_GPUWORKLOADCONTEXTIMPL_H
+
+#include "arm_compute/core/CL/CLCompileContext.h"
+#include "arm_compute/core/ITensorInfo.h"
+#include "arm_compute/dynamic_fusion/sketch/MemoryDescriptor.h"
+#include "arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadContext.h"
+
+namespace arm_compute
+{
+namespace experimental
+{
+namespace dynamic_fusion
+{
+
+/** Internal implementation of workload context. */
+class GpuWorkloadContext::Impl
+{
+public:
+ /** Constructor
+ *
+ * @param[in] gpu_language Target GPU language.
+ * @param[in] cl_compile_ctx CL compile context.
+ */
+ Impl(GpuLanguage gpu_language, CLCompileContext *cl_compile_ctx);
+
+ /** Copy constructor */
+ Impl(Impl &) = default;
+
+ /** Assignment */
+ Impl& operator=(Impl &) = default;
+
+ /** Get target GPU language. */
+ GpuLanguage gpu_language() const;
+
+ /** Get CL compile context. */
+ const CLCompileContext *cl_compile_context() const;
+
+ /** Get memory descriptor registry. */
+ const MemoryDescriptorMap &mem_map() const;
+
+ /** Set a new ID and register the user tensor info.
+ *
+ * @param[in, out] tensor_info The tensor info to be registered.
+ */
+ void register_user_tensor(ITensorInfo &tensor_info);
+
+ /** Set a new ID and register the auxiliary tensor info.
+ *
+ * @param[in, out] tensor_info The tensor info to be registered.
+ * @param[in] mem_info The auxiliary tensor memory info.
+ */
+ void register_aux_tensor(ITensorInfo &tensor_info, const AuxMemoryInfo &mem_info);
+
+ /** Set a new ID and register the virtual tensor info.
+ *
+ * @param[in, out] tensor_info The tensor info to be registered.
+ */
+ void register_virtual_tensor(ITensorInfo &tensor_info);
+
+private:
+ ITensorInfo::Id next_tensor_id();
+
+ GpuLanguage _gpu_language;
+ CLCompileContext *_cl_compile_ctx;
+
+ ITensorInfo::Id _next_tensor_id;
+ MemoryDescriptorMap _mem_map;
+};
+
+} // namespace dynamic_fusion
+} // namespace experimental
+} // namespace arm_compute
+
+#endif // ACL_SRC_DYNAMIC_FUSION_SKETCH_GPU_GPUWORKLOADCONTEXTIMPL_H
diff --git a/src/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.cpp b/src/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.cpp
index 33f672071d..d3a20c0dfe 100644
--- a/src/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.cpp
+++ b/src/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.cpp
@@ -43,20 +43,6 @@ const GpuWorkloadSketch::Context *GpuWorkloadSketch::gpu_context() const
return _impl->context();
}
-void GpuWorkloadSketch::register_new_tensor(ITensorInfo &tensor_info)
-{
- tensor_info.set_id(_impl->allocate_new_tensor_id());
- // All input output tensors are User tensors that need real backing memory
- _impl->register_memory_descriptor(tensor_info, MemoryDescriptor{ MemoryType::User });
-}
-
-TensorInfo GpuWorkloadSketch::create_tensor_info()
-{
- TensorInfo tensor_info{};
- register_new_tensor(tensor_info);
- return tensor_info;
-}
-
GpuWorkloadSketch::Implementation &GpuWorkloadSketch::implementation()
{
return *_impl;
diff --git a/src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h b/src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h
index d5075d5c94..44c99e844b 100644
--- a/src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h
+++ b/src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h
@@ -26,6 +26,7 @@
#include "arm_compute/dynamic_fusion/sketch/MemoryDescriptor.h"
#include "arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h"
+#include "src/dynamic_fusion/sketch/gpu/GpuWorkloadContextImpl.h"
#include "src/dynamic_fusion/sketch/gpu/GpuComponentServices.h"
#include "src/dynamic_fusion/sketch/gpu/GpuKernelComponentGraph.h"
#include "src/dynamic_fusion/sketch/gpu/GpuOperatorGroup.h"
@@ -53,8 +54,7 @@ public:
_comp_services{},
_component_graph{ &_comp_services },
_operator_group{},
- _managed_tensor_info_list{ std::vector<std::unique_ptr<TensorInfo>>() },
- _mem_map{}
+ _managed_tensor_info_list{ std::vector<std::unique_ptr<TensorInfo>>() }
{
}
/** Prevent instances of this class from being copy constructed */
@@ -101,7 +101,8 @@ public:
*/
GpuWorkloadSourceCode generate_source_code() const
{
- return component_graph().fuse(_mem_map).write_workload_code();
+ const auto mem_map = _context->implementation().mem_map();
+ return component_graph().fuse(mem_map).write_workload_code();
}
/** Create a virtual (see @ref MemoryType) tensor info and save it
*
@@ -110,8 +111,7 @@ public:
ITensorInfo *create_virtual_tensor()
{
auto uptr = std::make_unique<TensorInfo>();
- uptr->set_id(-allocate_new_tensor_id()); // virtual tensors must have negative id
- register_memory_descriptor(*uptr, MemoryDescriptor{ MemoryType::Virtual });
+ _context->implementation().register_virtual_tensor(*uptr);
_managed_tensor_info_list.emplace_back(std::move(uptr));
return _managed_tensor_info_list.back().get();
}
@@ -129,20 +129,10 @@ public:
ITensorInfo *create_auxiliary_tensor(const ITensorInfo &tensor_info)
{
auto uptr = std::make_unique<TensorInfo>(tensor_info);
- uptr->set_id(allocate_new_tensor_id());
- register_memory_descriptor(*uptr, MemoryDescriptor{ MemoryType::Auxiliary, AuxMemoryInfo{ uptr->total_size() } });
+ _context->implementation().register_aux_tensor(*uptr, AuxMemoryInfo{ uptr->total_size() });
_managed_tensor_info_list.emplace_back(std::move(uptr));
return _managed_tensor_info_list.back().get();
}
- /** Register memory descriptor of a tensor info
- *
- * @param[in] info @ref ITensorInfo to be registered
- * @param[in] mem_desc @ref MemoryDescriptor to be registered with @p info
- */
- void register_memory_descriptor(const ITensorInfo &info, const MemoryDescriptor &mem_desc)
- {
- _mem_map[info.id()] = mem_desc;
- }
private:
Context *_context;
@@ -151,7 +141,6 @@ private:
GpuOperatorGroup _operator_group;
ITensorInfo::Id _next_id{ ITensorInfo::invalid_tensor_id };
std::vector<std::unique_ptr<TensorInfo>> _managed_tensor_info_list;
- MemoryDescriptorMap _mem_map;
};
} // namespace dynamic_fusion
} // namespace experimental
diff --git a/src/dynamic_fusion/sketch/gpu/operators/GpuSoftmax.cpp b/src/dynamic_fusion/sketch/gpu/operators/GpuSoftmax.cpp
index 291a1e5bda..ffc4553a7d 100644
--- a/src/dynamic_fusion/sketch/gpu/operators/GpuSoftmax.cpp
+++ b/src/dynamic_fusion/sketch/gpu/operators/GpuSoftmax.cpp
@@ -136,9 +136,9 @@ void GpuSoftmax::create_op(GpuWorkloadSketch &sketch,
ARM_COMPUTE_ERROR_ON_NULLPTR(src, dst);
ARM_COMPUTE_LOG_PARAMS(src, dst, attributes);
TensorShape logits_sum_shape = src->tensor_shape();
- ITensorInfo *logits = sketch.implementation().create_auxiliary_tensor(src->clone()->set_tensor_shape(logits_sum_shape));
+ ITensorInfo *logits = sketch.implementation().create_auxiliary_tensor(src->clone()->set_id(ITensorInfo::invalid_tensor_id).set_tensor_shape(logits_sum_shape));
logits_sum_shape.set(0, 1);
- ITensorInfo *sum = sketch.implementation().create_auxiliary_tensor(src->clone()->set_tensor_shape(logits_sum_shape));
+ ITensorInfo *sum = sketch.implementation().create_auxiliary_tensor(src->clone()->set_id(ITensorInfo::invalid_tensor_id).set_tensor_shape(logits_sum_shape));
// Auto initialize dst tensor info and the auxiliary tensor infos as well
auto_init_if_empty(*dst, *src->clone());
diff --git a/tests/validation/dynamic_fusion/gpu/Integration.cpp b/tests/validation/dynamic_fusion/gpu/Integration.cpp
index 6a283f8082..3a915779c1 100644
--- a/tests/validation/dynamic_fusion/gpu/Integration.cpp
+++ b/tests/validation/dynamic_fusion/gpu/Integration.cpp
@@ -23,24 +23,33 @@
*/
#include "arm_compute/core/CL/CLKernelLibrary.h"
+#include "arm_compute/core/QuantizationInfo.h"
#include "arm_compute/core/TensorInfo.h"
+#include "arm_compute/core/Types.h"
#include "arm_compute/dynamic_fusion/runtime/gpu/cl/ClWorkloadRuntime.h"
#include "arm_compute/dynamic_fusion/sketch/attributes/CastAttributes.h"
#include "arm_compute/dynamic_fusion/sketch/attributes/Conv2dAttributes.h"
+#include "arm_compute/dynamic_fusion/sketch/attributes/DepthwiseConv2dAttributes.h"
#include "arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h"
#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuAdd.h"
#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuCast.h"
#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuConv2d.h"
+#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuDepthwiseConv2d.h"
+#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuMul.h"
#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuOutput.h"
+#include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuSigmoid.h"
#include "tests/CL/CLAccessor.h"
#include "tests/framework/Macros.h"
#include "tests/validation/Validation.h"
#include "tests/validation/dynamic_fusion/Utils.h"
+#include "tests/validation/reference/ActivationLayer.h"
#include "tests/validation/reference/ConvolutionLayer.h"
#include "tests/validation/reference/DepthConvertLayer.h"
+#include "tests/validation/reference/DepthwiseConvolutionLayer.h"
#include "tests/validation/reference/ElementwiseOperations.h"
#include "tests/validation/reference/Permute.h"
+#include "tests/validation/reference/PixelWiseMultiplication.h"
using namespace arm_compute::experimental::dynamic_fusion;
using namespace arm_compute::test::validation::utils;
@@ -69,17 +78,17 @@ TEST_CASE(Conv2d, framework::DatasetMode::ALL)
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Fuse conv2d
Conv2dAttributes conv2d_attr{};
- TensorInfo input_info = sketch.create_tensor_info(t_input_shape, 1, data_type, data_layout);
- TensorInfo weight_info = sketch.create_tensor_info(TensorInfo(t_weight_shape, 1, data_type, data_layout));
+ TensorInfo input_info = context.create_tensor_info(t_input_shape, 1, data_type, data_layout);
+ TensorInfo weight_info = context.create_tensor_info(TensorInfo(t_weight_shape, 1, data_type, data_layout));
ITensorInfo *conv_out_info = GpuConv2d::create_op(sketch, &input_info, &weight_info, nullptr, conv2d_attr);
- TensorInfo dst_info = sketch.create_tensor_info();
+ TensorInfo dst_info = context.create_tensor_info();
GpuOutput::create_op(sketch, conv_out_info, &dst_info);
// Configure runtime
@@ -156,15 +165,15 @@ TEST_CASE(Add_Output_Add_Output, framework::DatasetMode::ALL)
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- TensorInfo in_0_info = sketch.create_tensor_info(t_input_shape, 1, data_type);
- TensorInfo in_1_info = sketch.create_tensor_info(t_input_shape, 1, data_type);
- TensorInfo in_2_info = sketch.create_tensor_info(t_input_shape, 1, data_type);
+ TensorInfo in_0_info = context.create_tensor_info(t_input_shape, 1, data_type);
+ TensorInfo in_1_info = context.create_tensor_info(t_input_shape, 1, data_type);
+ TensorInfo in_2_info = context.create_tensor_info(t_input_shape, 1, data_type);
- TensorInfo out_0_info = sketch.create_tensor_info();
- TensorInfo out_1_info = sketch.create_tensor_info();
+ TensorInfo out_0_info = context.create_tensor_info();
+ TensorInfo out_1_info = context.create_tensor_info();
ITensorInfo *ans_0_info = GpuAdd::create_op(sketch, &in_0_info, &in_1_info);
GpuOutput::create_op(sketch, ans_0_info, &out_0_info);
@@ -253,15 +262,15 @@ TEST_CASE(Add_Output_Add_Cast_Cast_Output, framework::DatasetMode::ALL)
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- TensorInfo in_0_info = sketch.create_tensor_info(t_input_shape, 1, data_type);
- TensorInfo in_1_info = sketch.create_tensor_info(t_input_shape, 1, data_type);
- TensorInfo in_2_info = sketch.create_tensor_info(t_input_shape, 1, data_type);
+ TensorInfo in_0_info = context.create_tensor_info(t_input_shape, 1, data_type);
+ TensorInfo in_1_info = context.create_tensor_info(t_input_shape, 1, data_type);
+ TensorInfo in_2_info = context.create_tensor_info(t_input_shape, 1, data_type);
- TensorInfo out_0_info = sketch.create_tensor_info();
- TensorInfo out_1_info = sketch.create_tensor_info();
+ TensorInfo out_0_info = context.create_tensor_info();
+ TensorInfo out_1_info = context.create_tensor_info();
CastAttributes cast_0_attr;
cast_0_attr.data_type(DataType::S32).convert_policy(ConvertPolicy::SATURATE);
@@ -348,6 +357,211 @@ TEST_CASE(Add_Output_Add_Cast_Cast_Output, framework::DatasetMode::ALL)
validate(CLAccessor(t_out_0), ref_t_out_0, tolerance_add_f32);
validate(CLAccessor(t_out_1), ref_t_out_1, tolerance_cast_f32);
}
+
+TEST_CASE(Conv2d_Sigmoid_DepthwiseConv2d_Mul, framework::DatasetMode::ALL)
+{
+ // (tensor0)
+ // |
+ // ======|============================================== Sketch 0
+ // | (tensor1) +---- (tensor2)
+ // | | | |
+ // +-- input -- weights -- biases --+ |
+ // | | |
+ // | Conv2d | |
+ // | | |
+ // +----------- output -------------+ |
+ // | |
+ // +-- input ---+ |
+ // | | |
+ // | Sigmoid | |
+ // | | |
+ // +-- output --+ |
+ // | |
+ // +-- input ---+ |
+ // | | |
+ // | Output | |
+ // | | |
+ // +-- output --+ |
+ // | |
+ // (tensor5) |
+ // | |
+ // +--------+ |
+ // ======|=============================|================ Sketch 1
+ // | (tensor3) (tensor4) |
+ // | | | |
+ // +-- input -- weights -- biases --+ |
+ // | | |
+ // | DepthwiseConv2d | |
+ // | | |
+ // +----------- output -------------+ |
+ // | |
+ // +--+ +----------------+
+ // | |
+ // +-- lhs -- rhs --+
+ // | |
+ // | Multiply |
+ // | |
+ // +---- output ----+
+ // |
+ // +-- input ---+
+ // | |
+ // | Output |
+ // | |
+ // +-- output --+
+ // |
+ // (tensor6)
+
+ TensorShape conv2d_src_shape(10, 20, 30);
+ TensorShape conv2d_wei_shape(10, 3, 3, 5);
+ TensorShape conv2d_bia_shape(5);
+ TensorShape conv2d_dst_shape(5, 18, 28);
+ TensorShape dwc_wei_shape(5, 3, 3);
+ TensorShape dwc_bia_shape(5);
+ TensorShape dwc_dst_shape(5, 16, 26);
+
+ // Initialize the context.
+ CLScheduler::get().default_reinit();
+
+ auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
+ GpuWorkloadContext context(&cl_compile_ctx);
+
+ auto tensor0_info = context.create_tensor_info(conv2d_src_shape, 1, DataType::F32, DataLayout::NHWC);
+
+ // Create the first sketch: conv2d + cast + output.
+ GpuWorkloadSketch sketch0(&context);
+
+ Conv2dAttributes conv2d_attr;
+ auto tensor1_info = context.create_tensor_info(conv2d_wei_shape, 1, DataType::F32, DataLayout::NHWC);
+ auto tensor2_info = context.create_tensor_info(conv2d_bia_shape, 1, DataType::F32, DataLayout::NHWC);
+ ARM_COMPUTE_EXPECT(GpuConv2d::validate_op(sketch0, &tensor0_info, &tensor1_info, &tensor2_info, conv2d_attr), framework::LogLevel::ERRORS);
+ auto ans_info = GpuConv2d::create_op(sketch0, &tensor0_info, &tensor1_info, &tensor2_info, conv2d_attr);
+
+ ARM_COMPUTE_EXPECT(GpuSigmoid::validate_op(sketch0, ans_info), framework::LogLevel::ERRORS);
+ ans_info = GpuSigmoid::create_op(sketch0, ans_info);
+
+ DepthwiseConv2dAttributes dwc_attr;
+ auto tensor3_info = context.create_tensor_info(dwc_wei_shape, 1, DataType::F32, DataLayout::NHWC);
+ auto tensor4_info = context.create_tensor_info(dwc_bia_shape, 1, DataType::F32, DataLayout::NHWC);
+ ARM_COMPUTE_EXPECT(!GpuDepthwiseConv2d::validate_op(sketch0, ans_info, &tensor3_info, &tensor4_info, dwc_attr), framework::LogLevel::ERRORS);
+
+ auto tensor5_info = context.create_tensor_info();
+ ARM_COMPUTE_EXPECT(GpuOutput::validate_op(sketch0, ans_info, &tensor5_info), framework::LogLevel::ERRORS);
+ GpuOutput::create_op(sketch0, ans_info, &tensor5_info);
+
+ // Create the first workload runtime.
+ ClWorkloadRuntime runtime0;
+ runtime0.configure(sketch0);
+
+ // Create the second sketch: dwc + sigmoid + output.
+ GpuWorkloadSketch sketch1(&context);
+
+ ARM_COMPUTE_EXPECT(GpuDepthwiseConv2d::validate_op(sketch1, &tensor5_info, &tensor3_info, &tensor4_info, dwc_attr), framework::LogLevel::ERRORS);
+ ans_info = GpuDepthwiseConv2d::create_op(sketch1, &tensor5_info, &tensor3_info, &tensor4_info, dwc_attr);
+
+ ARM_COMPUTE_EXPECT(GpuMul::validate_op(sketch1, ans_info, &tensor2_info), framework::LogLevel::ERRORS);
+ ans_info = GpuMul::create_op(sketch1, ans_info, &tensor2_info);
+
+ auto tensor6_info = context.create_tensor_info();
+ ARM_COMPUTE_EXPECT(GpuOutput::validate_op(sketch1, ans_info, &tensor6_info), framework::LogLevel::ERRORS);
+ GpuOutput::create_op(sketch1, ans_info, &tensor6_info);
+
+ // Create the second workload runtime.
+ ClWorkloadRuntime runtime1;
+ runtime1.configure(sketch1);
+
+ // Create the user tensors.
+ CLTensor tensor0;
+ CLTensor tensor1;
+ CLTensor tensor2;
+ CLTensor tensor3;
+ CLTensor tensor4;
+ CLTensor tensor5;
+ CLTensor tensor6;
+
+ tensor0.allocator()->init(tensor0_info);
+ tensor1.allocator()->init(tensor1_info);
+ tensor2.allocator()->init(tensor2_info);
+ tensor3.allocator()->init(tensor3_info);
+ tensor4.allocator()->init(tensor4_info);
+ tensor5.allocator()->init(tensor5_info);
+ tensor6.allocator()->init(tensor6_info);
+
+ tensor0.allocator()->allocate();
+ tensor1.allocator()->allocate();
+ tensor2.allocator()->allocate();
+ tensor3.allocator()->allocate();
+ tensor4.allocator()->allocate();
+ tensor5.allocator()->allocate();
+ tensor6.allocator()->allocate();
+
+ // Allocate the auxiliary tensors.
+ for(auto &data : runtime0.get_auxiliary_tensors())
+ {
+ auto tensor = std::get<0>(data);
+ auto &tensor_info = std::get<1>(data);
+ auto mem_req = std::get<2>(data);
+
+ tensor->allocator()->init(tensor_info, mem_req.alignment);
+ tensor->allocator()->allocate();
+ }
+
+ for(auto &data : runtime1.get_auxiliary_tensors())
+ {
+ auto tensor = std::get<0>(data);
+ auto &tensor_info = std::get<1>(data);
+ auto mem_req = std::get<2>(data);
+
+ tensor->allocator()->init(tensor_info, mem_req.alignment);
+ tensor->allocator()->allocate();
+ }
+
+ // Fill the input tensors with random data.
+ fill<float>(CLAccessor(tensor0), 0, library.get());
+ fill<float>(CLAccessor(tensor1), 1, library.get());
+ fill<float>(CLAccessor(tensor2), 2, library.get());
+ fill<float>(CLAccessor(tensor3), 3, library.get());
+ fill<float>(CLAccessor(tensor4), 4, library.get());
+
+ // Run each runtime.
+ runtime0.run({ &tensor0, &tensor1, &tensor2, &tensor5 });
+ runtime1.run({ &tensor5, &tensor3, &tensor4, &tensor2, &tensor6 });
+
+ // Compute the reference result.
+ SimpleTensor<float> ref_conv2d_src(conv2d_src_shape, DataType::F32, 1, QuantizationInfo(), DataLayout::NHWC);
+ SimpleTensor<float> ref_conv2d_wei(conv2d_wei_shape, DataType::F32, 1, QuantizationInfo(), DataLayout::NHWC);
+ SimpleTensor<float> ref_conv2d_bia(conv2d_bia_shape, DataType::F32, 1, QuantizationInfo(), DataLayout::NHWC);
+ SimpleTensor<float> ref_dwc_wei(dwc_wei_shape, DataType::F32, 1, QuantizationInfo(), DataLayout::NHWC);
+ SimpleTensor<float> ref_dwc_bia(dwc_bia_shape, DataType::F32, 1, QuantizationInfo(), DataLayout::NHWC);
+
+ fill<float>(ref_conv2d_src, 0, library.get());
+ fill<float>(ref_conv2d_wei, 1, library.get());
+ fill<float>(ref_conv2d_bia, 2, library.get());
+ fill<float>(ref_dwc_wei, 3, library.get());
+ fill<float>(ref_dwc_bia, 4, library.get());
+
+ PermutationVector nhwc_to_nchw(1, 2, 0);
+
+ auto conv2d_dst_shape_nchw = conv2d_dst_shape;
+ permute(conv2d_dst_shape_nchw, nhwc_to_nchw);
+ const auto ref_conv2d_src_nchw = reference::permute(ref_conv2d_src, nhwc_to_nchw);
+ const auto ref_conv2d_wei_nchw = reference::permute(ref_conv2d_wei, nhwc_to_nchw);
+ const auto ref_conv2d_bia_nchw = reference::permute(ref_conv2d_bia, nhwc_to_nchw);
+ const auto ref_conv2d_dst_nchw = reference::convolution_layer(ref_conv2d_src_nchw, ref_conv2d_wei_nchw, ref_conv2d_bia_nchw, conv2d_dst_shape_nchw, PadStrideInfo());
+
+ const auto ref_sigmoid_dst_nchw = reference::activation_layer(ref_conv2d_dst_nchw, ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC));
+
+ auto dwc_dst_shape_nchw = dwc_dst_shape;
+ permute(dwc_dst_shape_nchw, nhwc_to_nchw);
+ const auto ref_dwc_wei_nchw = reference::permute(ref_dwc_wei, nhwc_to_nchw);
+ const auto ref_dwc_bia_nchw = reference::permute(ref_dwc_bia, nhwc_to_nchw);
+ const auto ref_dwc_dst_nchw = reference::depthwise_convolution(ref_sigmoid_dst_nchw, ref_dwc_wei_nchw, ref_dwc_bia_nchw, dwc_dst_shape_nchw, PadStrideInfo(), 1);
+
+ const auto ref_mul_dst_nchw = reference::pixel_wise_multiplication<float, float, float>(ref_dwc_dst_nchw, ref_conv2d_bia_nchw, 1.0, ConvertPolicy::SATURATE, RoundingPolicy::TO_NEAREST_UP, DataType::F32);
+
+ constexpr RelativeTolerance<float> tolerance(0.001f);
+ validate(CLAccessor(tensor6), ref_mul_dst_nchw, tolerance);
+}
+
TEST_SUITE(Invalid_Fusion_Should_Fail)
TEST_CASE(Multiple_Complex_Ops_0, framework::DatasetMode::ALL)
{
@@ -368,12 +582,12 @@ TEST_CASE(Multiple_Complex_Ops_0, framework::DatasetMode::ALL)
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Create tensor infos
- TensorInfo input_info = sketch.create_tensor_info(t_input_shape, 1, data_type, data_layout);
- TensorInfo weight_info = sketch.create_tensor_info(TensorInfo(t_weight_shape, 1, data_type, data_layout));
+ TensorInfo input_info = context.create_tensor_info(t_input_shape, 1, data_type, data_layout);
+ TensorInfo weight_info = context.create_tensor_info(TensorInfo(t_weight_shape, 1, data_type, data_layout));
ITensorInfo *dst_info;
// Fuse conv2d into the workload
@@ -386,7 +600,7 @@ TEST_CASE(Multiple_Complex_Ops_0, framework::DatasetMode::ALL)
}
// Create tensor infos
- TensorInfo weight_info_2 = sketch.create_tensor_info(t_weight_info);
+ TensorInfo weight_info_2 = context.create_tensor_info(t_weight_info);
// Fuse conv2d into the workload
{
diff --git a/tests/validation/dynamic_fusion/gpu/cl/Add.cpp b/tests/validation/dynamic_fusion/gpu/cl/Add.cpp
index 0034b0f07f..d9a3d9533c 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/Add.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/Add.cpp
@@ -87,12 +87,12 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(
{
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Validate Elementwise Add
- auto lhs_info = sketch.create_tensor_info(input1_info);
- auto rhs_info = sketch.create_tensor_info(input2_info);
+ auto lhs_info = context.create_tensor_info(input1_info);
+ auto rhs_info = context.create_tensor_info(input2_info);
bool res = bool(GpuAdd::validate_op(sketch, &lhs_info, &rhs_info));
ARM_COMPUTE_EXPECT(res == expected, framework::LogLevel::ERRORS);
diff --git a/tests/validation/dynamic_fusion/gpu/cl/Clamp.cpp b/tests/validation/dynamic_fusion/gpu/cl/Clamp.cpp
index 177c02c2c7..dc46dd594e 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/Clamp.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/Clamp.cpp
@@ -69,11 +69,11 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
{
// Create a new workload sketch
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Fuse Clamp
- const TensorInfo src_info = sketch.create_tensor_info(input_info);
+ const TensorInfo src_info = context.create_tensor_info(input_info);
ClampAttributes attributes {};
attributes.min_val(min_val)
diff --git a/tests/validation/dynamic_fusion/gpu/cl/DepthwiseConv2d.cpp b/tests/validation/dynamic_fusion/gpu/cl/DepthwiseConv2d.cpp
index b6331d70c8..7ab7c8a3fc 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/DepthwiseConv2d.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/DepthwiseConv2d.cpp
@@ -242,12 +242,12 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(zi
input_info, weights_info, biases_info, padding, stride, depth_multiplier, dilation, expected)
{
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
- const TensorInfo sketch_weights_info = sketch.create_tensor_info(weights_info);
- const TensorInfo sketch_biases_info = sketch.create_tensor_info(biases_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
+ const TensorInfo sketch_weights_info = context.create_tensor_info(weights_info);
+ const TensorInfo sketch_biases_info = context.create_tensor_info(biases_info);
DepthwiseConv2dAttributes attributes {};
attributes.pad(padding)
diff --git a/tests/validation/dynamic_fusion/gpu/cl/DirectConv2d.cpp b/tests/validation/dynamic_fusion/gpu/cl/DirectConv2d.cpp
index cccad182ca..f27a1796c9 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/DirectConv2d.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/DirectConv2d.cpp
@@ -157,12 +157,12 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
input_info, weights_info, biases_info, conv2d_attrs, expected)
{
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
- const TensorInfo sketch_weights_info = sketch.create_tensor_info(weights_info);
- const TensorInfo sketch_biases_info = sketch.create_tensor_info(biases_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
+ const TensorInfo sketch_weights_info = context.create_tensor_info(weights_info);
+ const TensorInfo sketch_biases_info = context.create_tensor_info(biases_info);
bool is_valid = bool(GpuConv2d::validate_op(sketch, &sketch_input_info, &sketch_weights_info, &sketch_biases_info, conv2d_attrs));
ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
}
diff --git a/tests/validation/dynamic_fusion/gpu/cl/Mul.cpp b/tests/validation/dynamic_fusion/gpu/cl/Mul.cpp
index a9e8f9c15f..2da2b9eabd 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/Mul.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/Mul.cpp
@@ -102,12 +102,12 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(
{
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Validate Elementwise Mul
- auto lhs_info = sketch.create_tensor_info(input1_info);
- auto rhs_info = sketch.create_tensor_info(input2_info);
+ auto lhs_info = context.create_tensor_info(input1_info);
+ auto rhs_info = context.create_tensor_info(input2_info);
bool res = bool(GpuMul::validate_op(sketch, &lhs_info, &rhs_info));
ARM_COMPUTE_EXPECT(res == expected, framework::LogLevel::ERRORS);
diff --git a/tests/validation/dynamic_fusion/gpu/cl/Pool2d.cpp b/tests/validation/dynamic_fusion/gpu/cl/Pool2d.cpp
index a7772aef4d..f4478db42b 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/Pool2d.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/Pool2d.cpp
@@ -101,15 +101,15 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(
{
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Declare GpuPool2d settings
const GpuPool2dSettings &settings = GpuPool2dSettings().mixed_precision(false);
// Validate Pool2d Configuration
- auto src_info = sketch.create_tensor_info(input_info);
- auto dst_info = sketch.create_tensor_info(output_info);
+ auto src_info = context.create_tensor_info(input_info);
+ auto dst_info = context.create_tensor_info(output_info);
bool res = bool(GpuPool2d::validate_op(sketch, &src_info, &dst_info, pool2d_attr, settings));
ARM_COMPUTE_EXPECT(res == expected, framework::LogLevel::ERRORS);
}
diff --git a/tests/validation/dynamic_fusion/gpu/cl/Reshape.cpp b/tests/validation/dynamic_fusion/gpu/cl/Reshape.cpp
index 6d88be448e..bdaa1be531 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/Reshape.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/Reshape.cpp
@@ -53,13 +53,13 @@ input_info, output_shape, expected)
{
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Create sketch tensors
TensorShape input_shape = input_info.tensor_shape();
ARM_COMPUTE_UNUSED(input_shape);
- TensorInfo src_info = sketch.create_tensor_info(input_info);
+ TensorInfo src_info = context.create_tensor_info(input_info);
ReshapeAttributes attributes;
attributes.shape(output_shape);
diff --git a/tests/validation/dynamic_fusion/gpu/cl/Resize.cpp b/tests/validation/dynamic_fusion/gpu/cl/Resize.cpp
index 696be54c92..5f99cd6d78 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/Resize.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/Resize.cpp
@@ -95,10 +95,10 @@ TEST_CASE(NullPtr, framework::DatasetMode::ALL)
const TensorInfo output_info = TensorInfo{ default_output_shape, 1, default_data_type, default_data_layout };
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
// nullptr is given as input
Status status = GpuResize::validate_op(sketch, nullptr, ResizeAttributes());
@@ -135,10 +135,10 @@ TEST_CASE(SupportDataType, framework::DatasetMode::ALL)
const TensorInfo input_info = TensorInfo{ default_input_shape, 1, kv.first, default_data_layout };
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
ResizeAttributes attributes;
attributes.output_width(default_output_shape[0]); // shape is not important unless it's empty
@@ -157,10 +157,10 @@ TEST_CASE(MismatchingDataType, framework::DatasetMode::ALL)
const TensorInfo output_info = TensorInfo{ default_output_shape, 1, non_default_data_type, default_data_layout };
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
Status status = GpuResize::validate_op(sketch, &sketch_input_info, ResizeAttributes());
ARM_COMPUTE_EXPECT(bool(status) == false, framework::LogLevel::ERRORS);
@@ -177,10 +177,10 @@ TEST_CASE(AlignedCornerNotSupported, framework::DatasetMode::ALL)
const TensorInfo output_info = TensorInfo{ default_output_shape, 1, default_data_type, default_data_layout };
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
ResizeAttributes attributes{};
attributes.interpolation_policy(interpolation_policy)
@@ -198,10 +198,10 @@ TEST_CASE(UnsupportedInterpolationPolicy, framework::DatasetMode::ALL)
constexpr auto interpolation_policy = InterpolationPolicy::AREA;
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
ResizeAttributes attributes{};
attributes.interpolation_policy(interpolation_policy);
@@ -217,10 +217,10 @@ TEST_CASE(UnsupportedLayout, framework::DatasetMode::ALL)
constexpr auto interpolation_policy = InterpolationPolicy::BILINEAR;
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
- const TensorInfo sketch_input_info = sketch.create_tensor_info(input_info);
+ const TensorInfo sketch_input_info = context.create_tensor_info(input_info);
ResizeAttributes attributes{};
attributes.interpolation_policy(interpolation_policy);
diff --git a/tests/validation/dynamic_fusion/gpu/cl/Sigmoid.cpp b/tests/validation/dynamic_fusion/gpu/cl/Sigmoid.cpp
index aace23eff4..5fd11807bc 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/Sigmoid.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/Sigmoid.cpp
@@ -61,11 +61,11 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(
{
// Create a new workload sketch
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Fuse sigmoid
- const TensorInfo src_info = sketch.create_tensor_info(input_info);
+ const TensorInfo src_info = context.create_tensor_info(input_info);
const bool res = static_cast<bool>(GpuSigmoid::validate_op(sketch, &src_info));
ARM_COMPUTE_EXPECT(res == expected, framework::LogLevel::ERRORS);
diff --git a/tests/validation/dynamic_fusion/gpu/cl/Softmax.cpp b/tests/validation/dynamic_fusion/gpu/cl/Softmax.cpp
index d09454e05b..e8314d700d 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/Softmax.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/Softmax.cpp
@@ -104,13 +104,13 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(
{
// Create a new workload sketch
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
SoftmaxAttributes softmax_attr{};
softmax_attr.axis(axis).beta(beta).is_log_softmax(false);
- TensorInfo src_info = sketch.create_tensor_info(input_info);
- TensorInfo dst_info = sketch.create_tensor_info(output_info);
+ TensorInfo src_info = context.create_tensor_info(input_info);
+ TensorInfo dst_info = context.create_tensor_info(output_info);
const bool res = static_cast<bool>(GpuSoftmax::validate_op(sketch, &src_info, &dst_info, softmax_attr));
ARM_COMPUTE_EXPECT(res == expected, framework::LogLevel::ERRORS);
}
diff --git a/tests/validation/dynamic_fusion/gpu/cl/Sub.cpp b/tests/validation/dynamic_fusion/gpu/cl/Sub.cpp
index 977e0110da..0bb05c2961 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/Sub.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/Sub.cpp
@@ -89,12 +89,12 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(
{
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Validate Elementwise Sub
- auto lhs_info = sketch.create_tensor_info(input1_info);
- auto rhs_info = sketch.create_tensor_info(input2_info);
+ auto lhs_info = context.create_tensor_info(input1_info);
+ auto rhs_info = context.create_tensor_info(input2_info);
bool res = bool(GpuSub::validate_op(sketch, &lhs_info, &rhs_info));
ARM_COMPUTE_EXPECT(res == expected, framework::LogLevel::ERRORS);
diff --git a/tests/validation/dynamic_fusion/gpu/cl/Tanh.cpp b/tests/validation/dynamic_fusion/gpu/cl/Tanh.cpp
index 183cd079a3..00c92fbfc2 100644
--- a/tests/validation/dynamic_fusion/gpu/cl/Tanh.cpp
+++ b/tests/validation/dynamic_fusion/gpu/cl/Tanh.cpp
@@ -61,11 +61,11 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(
{
// Create a new workload sketch
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Fuse tanh
- const TensorInfo src_info = sketch.create_tensor_info(input_info);
+ const TensorInfo src_info = context.create_tensor_info(input_info);
const bool res = static_cast<bool>(GpuTanh::validate_op(sketch, &src_info));
ARM_COMPUTE_EXPECT(res == expected, framework::LogLevel::ERRORS);
diff --git a/tests/validation/fixtures/dynamic_fusion/gpu/cl/DepthwiseConv2dFixture.h b/tests/validation/fixtures/dynamic_fusion/gpu/cl/DepthwiseConv2dFixture.h
index b15de71707..bea1d9bf4b 100644
--- a/tests/validation/fixtures/dynamic_fusion/gpu/cl/DepthwiseConv2dFixture.h
+++ b/tests/validation/fixtures/dynamic_fusion/gpu/cl/DepthwiseConv2dFixture.h
@@ -126,14 +126,14 @@ protected:
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Create sketch tensors
- TensorInfo input_info = sketch.create_tensor_info(TensorInfo(input_shape, 1, _data_type, _data_layout));
- TensorInfo weight_info = sketch.create_tensor_info(TensorInfo(weights_shape, 1, _data_type, _data_layout));
- TensorInfo bias_info = sketch.create_tensor_info(TensorInfo(bias_shape, 1, _data_type, _data_layout));
- TensorInfo dst_info = sketch.create_tensor_info();
+ TensorInfo input_info = context.create_tensor_info(TensorInfo(input_shape, 1, _data_type, _data_layout));
+ TensorInfo weight_info = context.create_tensor_info(TensorInfo(weights_shape, 1, _data_type, _data_layout));
+ TensorInfo bias_info = context.create_tensor_info(TensorInfo(bias_shape, 1, _data_type, _data_layout));
+ TensorInfo dst_info = context.create_tensor_info();
ITensorInfo *ans_info = FunctionType::create_op(sketch, &input_info, &weight_info, &bias_info, dwc_conv2d_attr);
GpuOutput::create_op(sketch, ans_info, &dst_info);
diff --git a/tests/validation/fixtures/dynamic_fusion/gpu/cl/DirectConv2dFixture.h b/tests/validation/fixtures/dynamic_fusion/gpu/cl/DirectConv2dFixture.h
index d9ce4dff18..81dfc2b8e2 100644
--- a/tests/validation/fixtures/dynamic_fusion/gpu/cl/DirectConv2dFixture.h
+++ b/tests/validation/fixtures/dynamic_fusion/gpu/cl/DirectConv2dFixture.h
@@ -115,14 +115,14 @@ protected:
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Create sketch tensors
- TensorInfo input_info = sketch.create_tensor_info(TensorInfo(input_shape, 1, _data_type, _data_layout));
- TensorInfo weight_info = sketch.create_tensor_info(TensorInfo(weights_shape, 1, _data_type, _data_layout));
- TensorInfo bias_info = sketch.create_tensor_info(TensorInfo(bias_shape, 1, _data_type, _data_layout));
- TensorInfo dst_info = sketch.create_tensor_info();
+ TensorInfo input_info = context.create_tensor_info(TensorInfo(input_shape, 1, _data_type, _data_layout));
+ TensorInfo weight_info = context.create_tensor_info(TensorInfo(weights_shape, 1, _data_type, _data_layout));
+ TensorInfo bias_info = context.create_tensor_info(TensorInfo(bias_shape, 1, _data_type, _data_layout));
+ TensorInfo dst_info = context.create_tensor_info();
ITensorInfo *ans_info = FunctionType::create_op(sketch, &input_info, &weight_info, &bias_info, conv2d_attr);
GpuOutput::create_op(sketch, ans_info, &dst_info);
@@ -256,14 +256,14 @@ protected:
permute(output_shape, PermutationVector(2U, 0U, 1U));
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Create sketch tensors
- auto input_info = sketch.create_tensor_info(TensorInfo(input_shape, 1, data_type, data_layout));
- auto weight_info = sketch.create_tensor_info(TensorInfo(weights_shape, 1, data_type, data_layout));
- auto bias_info = sketch.create_tensor_info(TensorInfo(bias_shape, 1, bias_data_type, data_layout));
- auto dst_info = sketch.create_tensor_info();
+ auto input_info = context.create_tensor_info(TensorInfo(input_shape, 1, data_type, data_layout));
+ auto weight_info = context.create_tensor_info(TensorInfo(weights_shape, 1, data_type, data_layout));
+ auto bias_info = context.create_tensor_info(TensorInfo(bias_shape, 1, bias_data_type, data_layout));
+ auto dst_info = context.create_tensor_info();
ITensorInfo *ans_info = FunctionType::create_op(sketch, &input_info, &weight_info, &bias_info, conv2d_attr);
GpuOutput::create_op(sketch, ans_info, &dst_info);
diff --git a/tests/validation/fixtures/dynamic_fusion/gpu/cl/ElementwiseBinaryFixture.h b/tests/validation/fixtures/dynamic_fusion/gpu/cl/ElementwiseBinaryFixture.h
index b0680c0e4a..22deff1f24 100644
--- a/tests/validation/fixtures/dynamic_fusion/gpu/cl/ElementwiseBinaryFixture.h
+++ b/tests/validation/fixtures/dynamic_fusion/gpu/cl/ElementwiseBinaryFixture.h
@@ -99,13 +99,13 @@ protected:
{
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Fuse first element wise binary Op
- TensorInfo lhs_info = sketch.create_tensor_info(TensorInfo(shape0, 1, _data_type));
- TensorInfo rhs_info = sketch.create_tensor_info(TensorInfo(shape1, 1, _data_type));
- TensorInfo dst_info = sketch.create_tensor_info();
+ TensorInfo lhs_info = context.create_tensor_info(TensorInfo(shape0, 1, _data_type));
+ TensorInfo rhs_info = context.create_tensor_info(TensorInfo(shape1, 1, _data_type));
+ TensorInfo dst_info = context.create_tensor_info();
TensorInfo rhs_info_fuse;
@@ -113,7 +113,7 @@ protected:
if(_fuse)
{
- rhs_info_fuse = sketch.create_tensor_info(TensorInfo(shape2, 1, _data_type));
+ rhs_info_fuse = context.create_tensor_info(TensorInfo(shape2, 1, _data_type));
ITensorInfo *ans2_info = FunctionType::create_op(sketch, ans_info, &rhs_info_fuse);
GpuOutput::create_op(sketch, ans2_info, &dst_info);
}
diff --git a/tests/validation/fixtures/dynamic_fusion/gpu/cl/Pool2dFixture.h b/tests/validation/fixtures/dynamic_fusion/gpu/cl/Pool2dFixture.h
index efb5cf1e74..249f57aceb 100644
--- a/tests/validation/fixtures/dynamic_fusion/gpu/cl/Pool2dFixture.h
+++ b/tests/validation/fixtures/dynamic_fusion/gpu/cl/Pool2dFixture.h
@@ -91,12 +91,12 @@ protected:
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Create sketch tensors
- auto input_info = sketch.create_tensor_info(TensorInfo(input_shape, 1, data_type, DataLayout::NHWC));
- auto dst_info = sketch.create_tensor_info();
+ auto input_info = context.create_tensor_info(TensorInfo(input_shape, 1, data_type, DataLayout::NHWC));
+ auto dst_info = context.create_tensor_info();
// Create Pool2dSettings
GpuPool2dSettings pool_settings = GpuPool2dSettings().mixed_precision(mixed_precision);
diff --git a/tests/validation/fixtures/dynamic_fusion/operators/ActivationFixture.h b/tests/validation/fixtures/dynamic_fusion/operators/ActivationFixture.h
index 9656c497ea..3fb2cc2b7c 100644
--- a/tests/validation/fixtures/dynamic_fusion/operators/ActivationFixture.h
+++ b/tests/validation/fixtures/dynamic_fusion/operators/ActivationFixture.h
@@ -102,12 +102,12 @@ protected:
{
// Create a new workload sketch
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Create sketch tensors
- TensorInfo src_info = sketch.create_tensor_info(TensorInfo(shape, 1, _data_type));
- TensorInfo dst_info = sketch.create_tensor_info(TensorInfo(shape, 1, _data_type));
+ TensorInfo src_info = context.create_tensor_info(TensorInfo(shape, 1, _data_type));
+ TensorInfo dst_info = context.create_tensor_info(TensorInfo(shape, 1, _data_type));
ITensorInfo *ans_0_info = FunctionType::create_op(sketch, &src_info, args...);
if(_fuse)
diff --git a/tests/validation/fixtures/dynamic_fusion/operators/CastFixture.h b/tests/validation/fixtures/dynamic_fusion/operators/CastFixture.h
index cd39ec0a06..8a8e2b0c9a 100644
--- a/tests/validation/fixtures/dynamic_fusion/operators/CastFixture.h
+++ b/tests/validation/fixtures/dynamic_fusion/operators/CastFixture.h
@@ -112,12 +112,12 @@ protected:
{
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Create sketch tensors
- TensorInfo src_info = sketch.create_tensor_info(TensorInfo(shape, 1, dt_in, DataLayout::NCHW)); // layout is not important
- TensorInfo dst_info = sketch.create_tensor_info();
+ TensorInfo src_info = context.create_tensor_info(TensorInfo(shape, 1, dt_in, DataLayout::NCHW)); // layout is not important
+ TensorInfo dst_info = context.create_tensor_info();
CastAttributes attributes;
attributes.convert_policy(policy).data_type(dt_out);
diff --git a/tests/validation/fixtures/dynamic_fusion/operators/ClampFixture.h b/tests/validation/fixtures/dynamic_fusion/operators/ClampFixture.h
index a1fd22582f..cafd28f7b4 100644
--- a/tests/validation/fixtures/dynamic_fusion/operators/ClampFixture.h
+++ b/tests/validation/fixtures/dynamic_fusion/operators/ClampFixture.h
@@ -104,12 +104,12 @@ protected:
{
// Create a new workload sketch
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Create sketch tensors
- TensorInfo src_info = sketch.create_tensor_info(TensorInfo(shape, 1, _data_type));
- TensorInfo dst_info = sketch.create_tensor_info(TensorInfo(shape, 1, _data_type));
+ TensorInfo src_info = context.create_tensor_info(TensorInfo(shape, 1, _data_type));
+ TensorInfo dst_info = context.create_tensor_info(TensorInfo(shape, 1, _data_type));
ITensorInfo *ans_0_info = FunctionType::create_op(sketch, &src_info, attributes);
if(_fuse)
diff --git a/tests/validation/fixtures/dynamic_fusion/operators/MulFixture.h b/tests/validation/fixtures/dynamic_fusion/operators/MulFixture.h
index 0530707c38..a0d6bc6ed5 100644
--- a/tests/validation/fixtures/dynamic_fusion/operators/MulFixture.h
+++ b/tests/validation/fixtures/dynamic_fusion/operators/MulFixture.h
@@ -1,26 +1,26 @@
/*
-* Copyright (c) 2023 Arm Limited.
-*
-* SPDX-License-Identifier: MIT
-*
-* Permission is hereby granted, free of charge, to any person obtaining a copy
-* of this software and associated documentation files (the "Software"), to
-* deal in the Software without restriction, including without limitation the
-* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-* sell copies of the Software, and to permit persons to whom the Software is
-* furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included in all
-* copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-* SOFTWARE.
-*/
+ * Copyright (c) 2023 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
#ifndef TESTS_VALIDATION_FIXTURES_DYNAMIC_FUSION_OPERATORS_MULFIXTURE
#define TESTS_VALIDATION_FIXTURES_DYNAMIC_FUSION_OPERATORS_MULFIXTURE
@@ -75,13 +75,13 @@ protected:
{
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Fuse first multiplication op
- TensorInfo lhs_info = sketch.create_tensor_info(TensorInfo(shape0, 1, _data_type));
- TensorInfo rhs_info = sketch.create_tensor_info(TensorInfo(shape1, 1, _data_type));
- TensorInfo dst_info = sketch.create_tensor_info();
+ TensorInfo lhs_info = context.create_tensor_info(TensorInfo(shape0, 1, _data_type));
+ TensorInfo rhs_info = context.create_tensor_info(TensorInfo(shape1, 1, _data_type));
+ TensorInfo dst_info = context.create_tensor_info();
TensorInfo rhs_info_fuse;
@@ -89,7 +89,7 @@ protected:
if(_fuse)
{
- rhs_info_fuse = sketch.create_tensor_info(TensorInfo(shape2, 1, _data_type));
+ rhs_info_fuse = context.create_tensor_info(TensorInfo(shape2, 1, _data_type));
ITensorInfo *ans2_info = FunctionType::create_op(sketch, ans_info, &rhs_info_fuse);
GpuOutput::create_op(sketch, ans2_info, &dst_info);
}
diff --git a/tests/validation/fixtures/dynamic_fusion/operators/ReshapeFixture.h b/tests/validation/fixtures/dynamic_fusion/operators/ReshapeFixture.h
index e0b62d093f..88c04de35a 100644
--- a/tests/validation/fixtures/dynamic_fusion/operators/ReshapeFixture.h
+++ b/tests/validation/fixtures/dynamic_fusion/operators/ReshapeFixture.h
@@ -71,12 +71,12 @@ protected:
// Create a new workload sketch
auto cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- auto gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ auto context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Create sketch tensors
- TensorInfo src_info = sketch.create_tensor_info(TensorInfo(input_shape, 1, data_type));
- TensorInfo dst_info = sketch.create_tensor_info(TensorInfo(output_shape, 1, data_type));
+ TensorInfo src_info = context.create_tensor_info(TensorInfo(input_shape, 1, data_type));
+ TensorInfo dst_info = context.create_tensor_info(TensorInfo(output_shape, 1, data_type));
ReshapeAttributes attributes;
attributes.shape(output_shape);
diff --git a/tests/validation/fixtures/dynamic_fusion/operators/ResizeFixture.h b/tests/validation/fixtures/dynamic_fusion/operators/ResizeFixture.h
index 581a3e8947..62ef053dca 100644
--- a/tests/validation/fixtures/dynamic_fusion/operators/ResizeFixture.h
+++ b/tests/validation/fixtures/dynamic_fusion/operators/ResizeFixture.h
@@ -137,13 +137,13 @@ protected:
// Create a new workload sketch
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
// Create sketch tensors
- TensorInfo src_info = sketch.create_tensor_info(TensorInfo(shape, 1, _data_type, _data_layout));
+ TensorInfo src_info = context.create_tensor_info(TensorInfo(shape, 1, _data_type, _data_layout));
src_info.set_quantization_info(_input_quantization_info);
- TensorInfo dst_info = sketch.create_tensor_info();
+ TensorInfo dst_info = context.create_tensor_info();
ResizeAttributes attributes;
attributes.align_corners(_align_corners).sampling_policy(_sampling_policy).interpolation_policy(_interpolation_policy).output_width(_output_width).output_height(_output_height);
diff --git a/tests/validation/fixtures/dynamic_fusion/operators/SoftmaxFixture.h b/tests/validation/fixtures/dynamic_fusion/operators/SoftmaxFixture.h
index 38177114e6..0f50e8e12f 100644
--- a/tests/validation/fixtures/dynamic_fusion/operators/SoftmaxFixture.h
+++ b/tests/validation/fixtures/dynamic_fusion/operators/SoftmaxFixture.h
@@ -82,13 +82,13 @@ protected:
{
// Create a new workload sketch
CLCompileContext cl_compile_ctx = CLKernelLibrary::get().get_compile_context();
- GpuWorkloadContext gpu_ctx = GpuWorkloadContext{ &cl_compile_ctx };
- GpuWorkloadSketch sketch{ &gpu_ctx };
+ GpuWorkloadContext context = GpuWorkloadContext{ &cl_compile_ctx };
+ GpuWorkloadSketch sketch{ &context };
SoftmaxAttributes softmax_attr{};
softmax_attr.axis(axis).beta(beta).is_log_softmax(is_log);
- TensorInfo src_info = sketch.create_tensor_info(shape, 1, data_type);
- TensorInfo dst_info = sketch.create_tensor_info(shape, 1, data_type);
+ TensorInfo src_info = context.create_tensor_info(shape, 1, data_type);
+ TensorInfo dst_info = context.create_tensor_info(shape, 1, data_type);
FunctionType::create_op(sketch, &src_info, &dst_info, softmax_attr);
// Configure runtime