diff options
author | Ryan OShea <ryan.oshea3@arm.com> | 2022-11-07 16:20:48 +0000 |
---|---|---|
committer | ryan.oshea3 <ryan.oshea3@arm.com> | 2022-11-16 15:22:50 +0000 |
commit | 31441595009182c985dacbedc70c41ee6664d070 (patch) | |
tree | 248a85295aeff4022c9b395fc97748b0a0aa6b35 /src/armnn/layers | |
parent | bd18eab07a8f30492de1e462b1815189014cb8d5 (diff) | |
download | armnn-31441595009182c985dacbedc70c41ee6664d070.tar.gz |
IVGCVSW-7214 Disable BF16-Turbo-Mode and remove conversion layers
- Remove Bf16ToFp32 Conversion Layer
- Remove Fp32ToBf16 Conversion Layer
- Remove B16 Conversion tests
* Throw exception if m_ReduceFp32ToBf16 optimzer option is set to true
* Provide comments to enable fast math in order to use bf16
* Update docs to inform users to enable fast math for bf16
Execute Network Changes
* Require bf16_turbo_mode to also have fast_math_enabled set to true
- Remove setting m_ReduceFp32ToBf16 optimizer option
Signed-off-by: Ryan OShea <ryan.oshea3@arm.com>
Change-Id: Ibaa6da9d29c96a1ce32ff5196b0847fde9f04a1c
Diffstat (limited to 'src/armnn/layers')
-rw-r--r-- | src/armnn/layers/ConvertBf16ToFp32Layer.cpp | 55 | ||||
-rw-r--r-- | src/armnn/layers/ConvertBf16ToFp32Layer.hpp | 42 | ||||
-rw-r--r-- | src/armnn/layers/ConvertFp32ToBf16Layer.cpp | 56 | ||||
-rw-r--r-- | src/armnn/layers/ConvertFp32ToBf16Layer.hpp | 42 |
4 files changed, 0 insertions, 195 deletions
diff --git a/src/armnn/layers/ConvertBf16ToFp32Layer.cpp b/src/armnn/layers/ConvertBf16ToFp32Layer.cpp deleted file mode 100644 index a0958e36cb..0000000000 --- a/src/armnn/layers/ConvertBf16ToFp32Layer.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// -// Copyright © 2020 Arm Ltd and Contributors. All rights reserved. -// SPDX-License-Identifier: MIT -// - -#include "ConvertBf16ToFp32Layer.hpp" -#include "LayerCloneBase.hpp" - -#include <armnn/TypesUtils.hpp> - -#include <armnn/backends/WorkloadData.hpp> -#include <armnn/backends/WorkloadFactory.hpp> - -namespace armnn -{ - -ConvertBf16ToFp32Layer::ConvertBf16ToFp32Layer(const char* name) - : Layer(1, 1, LayerType::ConvertBf16ToFp32, name) -{ -} - -std::unique_ptr<IWorkload> ConvertBf16ToFp32Layer::CreateWorkload(const IWorkloadFactory& factory) const -{ - ConvertBf16ToFp32QueueDescriptor descriptor; - SetAdditionalInfo(descriptor); - - return factory.CreateWorkload(LayerType::ConvertBf16ToFp32, descriptor, PrepInfoAndDesc(descriptor)); -} - -ConvertBf16ToFp32Layer* ConvertBf16ToFp32Layer::Clone(Graph& graph) const -{ - return CloneBase<ConvertBf16ToFp32Layer>(graph, GetName()); -} - -void ConvertBf16ToFp32Layer::ValidateTensorShapesFromInputs() -{ - VerifyLayerConnections(1, CHECK_LOCATION()); - - const TensorShape& outputShape = GetOutputSlot(0).GetTensorInfo().GetShape(); - - VerifyShapeInferenceType(outputShape, m_ShapeInferenceMethod); - - auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() }); - - ARMNN_ASSERT(inferredShapes.size() == 1); - - ValidateAndCopyShape(outputShape, inferredShapes[0], m_ShapeInferenceMethod, "ConvertBf16ToFp32Layer"); -} - -void ConvertBf16ToFp32Layer::ExecuteStrategy(IStrategy& strategy) const -{ - strategy.ExecuteStrategy(this, GetParameters(), {}, GetName()); -} - -} // namespace armnn diff --git a/src/armnn/layers/ConvertBf16ToFp32Layer.hpp b/src/armnn/layers/ConvertBf16ToFp32Layer.hpp deleted file mode 100644 index 71312758e4..0000000000 --- a/src/armnn/layers/ConvertBf16ToFp32Layer.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// -// Copyright © 2020 Arm Ltd and Contributors. All rights reserved. -// SPDX-License-Identifier: MIT -// - -#pragma once - -#include <Layer.hpp> - -namespace armnn -{ - -/// This layer converts data type BFloat16 to Float32. -class ConvertBf16ToFp32Layer : public Layer -{ -public: - /// Makes a workload for the ConvertBf16ToFp32 type. - /// @param [in] factory The workload factory which will create the workload. - /// @return A pointer to the created workload, or nullptr if not created. - virtual std::unique_ptr<IWorkload> CreateWorkload(const IWorkloadFactory& factory) const override; - - /// Creates a dynamically-allocated copy of this layer. - /// @param [in] graph The graph into which this layer is being cloned. - ConvertBf16ToFp32Layer* Clone(Graph& graph) const override; - - /// Check if the input tensor shape(s) - /// will lead to a valid configuration of @ref ConvertBf16ToFp32Layer. - /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated. - void ValidateTensorShapesFromInputs() override; - - void ExecuteStrategy(IStrategy& strategy) const override; - -protected: - /// Constructor to create a ConvertBf16ToFp32Layer. - /// @param [in] name Optional name for the layer. - ConvertBf16ToFp32Layer(const char* name); - - /// Default destructor - ~ConvertBf16ToFp32Layer() = default; -}; - -} // namespace diff --git a/src/armnn/layers/ConvertFp32ToBf16Layer.cpp b/src/armnn/layers/ConvertFp32ToBf16Layer.cpp deleted file mode 100644 index 7c98eea239..0000000000 --- a/src/armnn/layers/ConvertFp32ToBf16Layer.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// -// Copyright © 2020 Arm Ltd and Contributors. All rights reserved. -// SPDX-License-Identifier: MIT -// - -#include "ConvertFp32ToBf16Layer.hpp" -#include "LayerCloneBase.hpp" - -#include <armnn/TypesUtils.hpp> - -#include <armnn/backends/WorkloadData.hpp> -#include <armnn/backends/WorkloadFactory.hpp> - -namespace armnn -{ - -ConvertFp32ToBf16Layer::ConvertFp32ToBf16Layer(const char* name) - : Layer(1, 1, LayerType::ConvertFp32ToBf16, name) -{ -} - -std::unique_ptr<IWorkload> ConvertFp32ToBf16Layer::CreateWorkload(const IWorkloadFactory& factory) const -{ - ConvertFp32ToBf16QueueDescriptor descriptor; - SetAdditionalInfo(descriptor); - - return factory.CreateWorkload(LayerType::ConvertFp32ToBf16, descriptor, PrepInfoAndDesc(descriptor)); -} - -ConvertFp32ToBf16Layer* ConvertFp32ToBf16Layer::Clone(Graph& graph) const -{ - return CloneBase<ConvertFp32ToBf16Layer>(graph, GetName()); -} - -void ConvertFp32ToBf16Layer::ValidateTensorShapesFromInputs() -{ - - VerifyLayerConnections(1, CHECK_LOCATION()); - - const TensorShape& outputShape = GetOutputSlot(0).GetTensorInfo().GetShape(); - - VerifyShapeInferenceType(outputShape, m_ShapeInferenceMethod); - - auto inferredShapes = InferOutputShapes({ GetInputSlot(0).GetConnection()->GetTensorInfo().GetShape() }); - - ARMNN_ASSERT(inferredShapes.size() == 1); - - ValidateAndCopyShape(outputShape, inferredShapes[0], m_ShapeInferenceMethod, "LayerName"); -} - -void ConvertFp32ToBf16Layer::ExecuteStrategy(IStrategy& strategy) const -{ - strategy.ExecuteStrategy(this, GetParameters(), {}, GetName()); -} - -} // namespace armnn diff --git a/src/armnn/layers/ConvertFp32ToBf16Layer.hpp b/src/armnn/layers/ConvertFp32ToBf16Layer.hpp deleted file mode 100644 index 71de4fbcda..0000000000 --- a/src/armnn/layers/ConvertFp32ToBf16Layer.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// -// Copyright © 2020 Arm Ltd and Contributors. All rights reserved. -// SPDX-License-Identifier: MIT -// - -#pragma once - -#include <Layer.hpp> - -namespace armnn -{ - -/// This layer converts data type Float32 to BFloat16. -class ConvertFp32ToBf16Layer : public Layer -{ -public: - /// Makes a workload for the ConvertFp32ToBf16Layer type. - /// @param [in] factory The workload factory which will create the workload. - /// @return A pointer to the created workload, or nullptr if not created. - virtual std::unique_ptr<IWorkload> CreateWorkload(const IWorkloadFactory& factory) const override; - - /// Creates a dynamically-allocated copy of this layer. - /// @param [in] graph The graph into which this layer is being cloned. - ConvertFp32ToBf16Layer* Clone(Graph& graph) const override; - - /// Check if the input tensor shape(s) - /// will lead to a valid configuration of @ref ConvertFp32ToBf16Layer. - /// @param [in] shapeInferenceMethod Indicates if output shape shall be overwritten or just validated. - void ValidateTensorShapesFromInputs() override; - - void ExecuteStrategy(IStrategy& strategy) const override; - -protected: - /// Constructor to create a ConvertFp32ToBf16Layer. - /// @param [in] name Optional name for the layer. - ConvertFp32ToBf16Layer(const char* name); - - /// Default destructor - ~ConvertFp32ToBf16Layer() = default; -}; - -} // namespace |