Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright © 2017-2024 Arm Ltd and Contributors. All rights reserved.
# Copyright © 2017-2025 Arm Ltd and Contributors. All rights reserved.
# Copyright © 2020 NXP
# SPDX-License-Identifier: MIT
#
Expand Down Expand Up @@ -387,8 +387,6 @@ list(APPEND armnn_sources
src/armnn/Profiling.hpp
src/armnn/Runtime.cpp
src/armnn/Runtime.hpp
src/armnn/RangeTracker.cpp
src/armnn/RangeTracker.hpp
src/armnn/ResolveType.hpp
src/armnn/SerializeLayerParameters.cpp
src/armnn/SerializeLayerParameters.hpp
Expand Down
2 changes: 1 addition & 1 deletion scripts/get_compute_library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CMD=$( basename "$0" )
#DEFAULT_CLFRAMEWORKREVISION="branches/arm_compute_24_08" # Release 24.08
#
# For pinning to a revision use this:
DEFAULT_CLFRAMEWORKREVISION="f1be55c81f7f580fbbfd88894bc3e79af3185743" #fix: gemm_hybrid_quantized.hpp was passing incorrect K size to the kernel.
DEFAULT_CLFRAMEWORKREVISION="7d6fc756b2a9dfd8776be1c5c17ba45e2652c9fc" #Update release version and SONAME"
usage() {
echo -e "get_compute_library.sh: Clones the Arm Compute Library (ACL) repo from the ML Platform server and checks out
the pinned version of ACL based on the SHA string defined at the top of this script (DEFAULT_CLFRAMEWORKREVISION).
Expand Down
79 changes: 0 additions & 79 deletions src/armnn/RangeTracker.cpp

This file was deleted.

63 changes: 0 additions & 63 deletions src/armnn/RangeTracker.hpp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,41 +1,11 @@
//
// Copyright © 2022-2024 Arm Ltd and Contributors. All rights reserved.
// Copyright © 2022-2025 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include "ElementwiseBinaryOperator.hpp"
#include "TosaRescaleOperatorUtils.hpp"

void AddRescaleOp(const string &inputName,
const string &outputName,
std::vector<TosaSerializationTensor*>& tensors,
const std::vector<const TensorInfo*>& inputs,
const std::vector<const TensorInfo*>& outputs,
std::vector<TosaSerializationOperator*>& operators)
{
double scale_alpha = inputs[1]->GetQuantizationScale() / outputs[0]->GetQuantizationScale();
int32_t input_zp = inputs[1]->GetQuantizationOffset();
int32_t output_zp = outputs[0]->GetQuantizationOffset();

TosaSerializationOperator* rescaleOp = nullptr;
CreateRescaleTosaOperator(inputName,
outputName,
scale_alpha,
input_zp,
output_zp,
false,
false,
true,
true,
&rescaleOp);

std::vector<int32_t> inputShape = GetTosaTensorShape(inputs[1]->GetShape());
tensors.push_back(new TosaSerializationTensor(outputName,
inputShape,
DType_INT32, {}));
operators.push_back(rescaleOp);
}

TosaSerializationBasicBlock* ConvertElementwiseBinaryToTosaOperator(const Layer* layer,
const LayerType type,
const std::vector<const TensorInfo*>& inputs,
Expand Down Expand Up @@ -102,8 +72,39 @@ TosaSerializationBasicBlock* ConvertElementwiseBinaryToTosaOperator(const Layer*
bool isMulOp = (type == LayerType::Multiplication) || isMulDesc ? true : false;
if (isInputInt8 && !isMulOp)
{
AddRescaleOp(input0Name, input0ElemenwiseBinaryName, tensors, inputs, outputs, operators);
AddRescaleOp(input1Name, input1ElemenwiseBinaryName, tensors, inputs, outputs, operators);
TosaSerializationOperator* rescaleOp0 = nullptr;
CreateRescaleTosaOperator(input0Name,
input0ElemenwiseBinaryName,
inputs[0]->GetQuantizationScale() / outputs[0]->GetQuantizationScale(),
inputs[0]->GetQuantizationOffset(),
0,
false,
false,
true,
true,
&rescaleOp0);
tensors.push_back(new TosaSerializationTensor(input0ElemenwiseBinaryName,
GetTosaTensorShape(inputs[0]->GetShape()),
DType_INT32,
{}));
operators.push_back(rescaleOp0);

TosaSerializationOperator* rescaleOp1 = nullptr;
CreateRescaleTosaOperator(input1Name,
input1ElemenwiseBinaryName,
inputs[1]->GetQuantizationScale() / outputs[0]->GetQuantizationScale(),
inputs[1]->GetQuantizationOffset(),
0,
false,
false,
true,
true,
&rescaleOp1);
tensors.push_back(new TosaSerializationTensor(input1ElemenwiseBinaryName,
GetTosaTensorShape(inputs[1]->GetShape()),
DType_INT32,
{}));
operators.push_back(rescaleOp1);
}

std::string& elementwiseInput0Str = isInputInt8 ? input0ElemenwiseBinaryName : input0Name;
Expand Down Expand Up @@ -213,7 +214,28 @@ TosaSerializationBasicBlock* ConvertElementwiseBinaryToTosaOperator(const Layer*
// from DType_INT32 to DType_INT8 when the input is DType_INT8
if (inputDType0 == DType_INT8)
{
AddRescaleOp(outputElemenwiseBinaryName, outputName, tensors, inputs, outputs, operators);
// double output_rescale_scale = in_lhs_scale * in_rhs_scale / output_scale;
float input0QScale = inputs[0]->IsQuantized()?inputs[0]->GetQuantizationScale():1.0f;
float input1QScale = inputs[1]->IsQuantized()?inputs[1]->GetQuantizationScale():1.0f;
float outputQScale = outputs[0]->IsQuantized()?outputs[0]->GetQuantizationScale():1.0f;
double combinedQScale = input0QScale * input1QScale / outputQScale;

TosaSerializationOperator* rescaleOp = nullptr;
CreateRescaleTosaOperator(outputElemenwiseBinaryName,
outputName,
combinedQScale,
0,
outputs[0]->GetQuantizationOffset(),
false,
false,
true,
true,
&rescaleOp);
tensors.push_back(new TosaSerializationTensor(outputName,
GetTosaTensorShape(outputs[0]->GetShape()),
DType_INT8,
{}));
operators.push_back(rescaleOp);
}

return new TosaSerializationBasicBlock(blockName, // name
Expand Down
Loading