aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGian Marco Iodice <gianmarco.iodice@arm.com>2021-04-12 17:34:33 +0100
committerGian Marco Iodice <gianmarco.iodice@arm.com>2021-04-16 11:49:52 +0000
commit379549191246f7742d8175edd88d8cff8de3feda (patch)
treef7fb4586307c56f4c13375ec02c03e73049aadbd
parentebbb6f9e2735f903a4cb75c23ab7c80797079c25 (diff)
downloadComputeLibrary-379549191246f7742d8175edd88d8cff8de3feda.tar.gz
Add GEMM heuristic for Mali-G78
- Replace std::map with a basic container with std::array Change-Id: I76f53ca61676ca0e5136ce61a3f3adb10e22b4c3 Signed-off-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5441 Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--src/core/CL/ICLGEMMKernelConfiguration.h54
-rw-r--r--src/core/CL/gemm/native/CLGEMMDefaultConfigNativeBifrost.cpp76
-rw-r--r--src/core/CL/gemm/native/CLGEMMDefaultConfigNativeMidgard.cpp22
-rw-r--r--src/core/CL/gemm/native/CLGEMMDefaultConfigNativeValhall.cpp32
-rw-r--r--src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedBifrost.cpp74
-rw-r--r--src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedValhall.cpp378
-rw-r--r--src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedValhall.h4
-rw-r--r--src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyBifrost.cpp106
-rw-r--r--src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyValhall.cpp389
-rw-r--r--src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyValhall.h4
-rw-r--r--src/runtime/CL/gemm/CLGEMMDefaultTypeValhall.cpp90
-rw-r--r--src/runtime/CL/gemm/CLGEMMDefaultTypeValhall.h4
12 files changed, 928 insertions, 305 deletions
diff --git a/src/core/CL/ICLGEMMKernelConfiguration.h b/src/core/CL/ICLGEMMKernelConfiguration.h
index ac0e7ab7ff..886905ecd0 100644
--- a/src/core/CL/ICLGEMMKernelConfiguration.h
+++ b/src/core/CL/ICLGEMMKernelConfiguration.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020 Arm Limited.
+ * Copyright (c) 2019-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -27,8 +27,60 @@
#include "arm_compute/core/GPUTarget.h"
#include "arm_compute/core/Types.h"
+#include <array>
namespace arm_compute
{
+/** Basic container for the OpenCL GEMM configuration functions */
+template <class T>
+class CLGEMMConfigArray
+{
+public:
+ /** Alias for F32 index */
+ static constexpr size_t DT_F32 = 0;
+ /** Alias for F16 index */
+ static constexpr size_t DT_F16 = 1;
+ /** Alias for Int8 index */
+ static constexpr size_t DT_INT8 = 2;
+
+ /** Constructor
+ *
+ * @param[in] func_f32 Function to call for GEMM F32
+ * @param[in] func_f16 Function to call for GEMM F16
+ * @param[in] func_int8 Function to call for GEMM Int8 (QASYMM8, QASYMM8_SIGNED, QSYMM8_PER_CHANNEL)
+ *
+ */
+ CLGEMMConfigArray(T func_f32, T func_f16, T func_int8)
+ : _configs{ func_f32, func_f16, func_int8 }
+ {
+ }
+
+ /** Method to return the GEMM configuration function based on data type
+ *
+ * @param[in] data_type Input data type
+ *
+ * @return the valid function otherwise it returns nullptr if the data type is not valid
+ */
+ T get_function(DataType data_type)
+ {
+ switch(data_type)
+ {
+ case DataType::F32:
+ return _configs.at(DT_F32);
+ case DataType::F16:
+ return _configs.at(DT_F16);
+ case DataType::QASYMM8:
+ case DataType::QASYMM8_SIGNED:
+ case DataType::QSYMM8_PER_CHANNEL:
+ return _configs.at(DT_INT8);
+ default:
+ return nullptr;
+ }
+ }
+
+private:
+ std::array<T, 3> _configs;
+};
+
/** Basic interface for the GEMM kernel configuration */
class ICLGEMMKernelConfiguration
{
diff --git a/src/core/CL/gemm/native/CLGEMMDefaultConfigNativeBifrost.cpp b/src/core/CL/gemm/native/CLGEMMDefaultConfigNativeBifrost.cpp
index b769802663..52023dd835 100644
--- a/src/core/CL/gemm/native/CLGEMMDefaultConfigNativeBifrost.cpp
+++ b/src/core/CL/gemm/native/CLGEMMDefaultConfigNativeBifrost.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020 Arm Limited.
+ * Copyright (c) 2019-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -28,7 +28,6 @@
#include "arm_compute/core/GPUTarget.h"
#include "src/core/CL/gemm/CLGEMMHelpers.h"
-#include <map>
#include <utility>
namespace arm_compute
@@ -45,66 +44,35 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigNativeBifrost
using ConfigurationFunctionExecutorPtr = std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> (CLGEMMDefaultConfigNativeBifrost::*)(unsigned int m, unsigned int n, unsigned int k,
unsigned int b);
- // Configurations for Mali-G71
- static std::map<DataType, ConfigurationFunctionExecutorPtr> gemm_configs_G71 =
- {
- { DataType::F32, &CLGEMMDefaultConfigNativeBifrost::configure_G71_f32 },
- { DataType::QASYMM8, &CLGEMMDefaultConfigNativeBifrost::configure_G71_u8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigNativeBifrost::configure_G71_u8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigNativeBifrost::configure_G71_u8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigNativeBifrost::configure_G71_u8 }
- };
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G71(&CLGEMMDefaultConfigNativeBifrost::configure_G71_f32,
+ &CLGEMMDefaultConfigNativeBifrost::configure_G71_f32, // We use the F32 heuristic
+ &CLGEMMDefaultConfigNativeBifrost::configure_G71_u8);
- // Configurations for Mali-G76
- static std::map<DataType, ConfigurationFunctionExecutorPtr> gemm_configs_G76 =
- {
- { DataType::F32, &CLGEMMDefaultConfigNativeBifrost::configure_G76_f32 },
- { DataType::QASYMM8, &CLGEMMDefaultConfigNativeBifrost::configure_G76_u8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigNativeBifrost::configure_G76_u8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigNativeBifrost::configure_G76_u8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigNativeBifrost::configure_G76_u8 }
- };
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G76(&CLGEMMDefaultConfigNativeBifrost::configure_G76_f32,
+ &CLGEMMDefaultConfigNativeBifrost::configure_G76_f32, // We use the F32 heuristic
+ &CLGEMMDefaultConfigNativeBifrost::configure_G76_u8);
- // Default configurations
- static std::map<DataType, ConfigurationFunctionExecutorPtr> gemm_configs_default =
- {
- { DataType::F32, &CLGEMMDefaultConfigNativeBifrost::configure_default_f32 },
- { DataType::QASYMM8, &CLGEMMDefaultConfigNativeBifrost::configure_default_u8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigNativeBifrost::configure_default_u8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigNativeBifrost::configure_default_u8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigNativeBifrost::configure_default_u8 }
- };
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G7x(&CLGEMMDefaultConfigNativeBifrost::configure_default_f32,
+ &CLGEMMDefaultConfigNativeBifrost::configure_default_f32, // We use the F32 heuristic
+ &CLGEMMDefaultConfigNativeBifrost::configure_default_u8);
+
+ ConfigurationFunctionExecutorPtr func = nullptr;
switch(_target)
{
- case GPUTarget::G71:
- if(gemm_configs_G71.find(data_type) != gemm_configs_G71.end())
- {
- return (this->*gemm_configs_G71[data_type])(m, n, k, b);
- }
- else
- {
- ARM_COMPUTE_ERROR("Not supported data type");
- }
case GPUTarget::G76:
- if(gemm_configs_G76.find(data_type) != gemm_configs_G76.end())
- {
- return (this->*gemm_configs_G76[data_type])(m, n, k, b);
- }
- else
- {
- ARM_COMPUTE_ERROR("Not supported data type");
- }
+ func = configs_G76.get_function(data_type);
+ break;
+ case GPUTarget::G71:
+ func = configs_G71.get_function(data_type);
+ break;
default:
- if(gemm_configs_default.find(data_type) != gemm_configs_default.end())
- {
- return (this->*gemm_configs_default[data_type])(m, n, k, b);
- }
- else
- {
- ARM_COMPUTE_ERROR("Not supported data type");
- }
+ func = configs_G7x.get_function(data_type);
+ break;
}
+
+ ARM_COMPUTE_ERROR_ON_MSG(func == nullptr, "Data type not support for GEMM");
+ return (this->*func)(m, n, k, b);
}
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigNativeBifrost::configure_G71_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b)
diff --git a/src/core/CL/gemm/native/CLGEMMDefaultConfigNativeMidgard.cpp b/src/core/CL/gemm/native/CLGEMMDefaultConfigNativeMidgard.cpp
index 18a899047a..cf9bb1828f 100644
--- a/src/core/CL/gemm/native/CLGEMMDefaultConfigNativeMidgard.cpp
+++ b/src/core/CL/gemm/native/CLGEMMDefaultConfigNativeMidgard.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Arm Limited.
+ * Copyright (c) 2020-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -28,7 +28,6 @@
#include "arm_compute/core/GPUTarget.h"
#include "src/core/CL/gemm/CLGEMMHelpers.h"
-#include <map>
#include <utility>
namespace arm_compute
@@ -45,20 +44,13 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigNativeMidgard
using ConfigurationFunctionExecutorPtr = std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> (CLGEMMDefaultConfigNativeMidgard::*)(unsigned int m, unsigned int n, unsigned int k,
unsigned int b);
- // Configurations for Midgard architectures
- static std::map<DataType, ConfigurationFunctionExecutorPtr> default_configs =
- {
- { DataType::QASYMM8, &CLGEMMDefaultConfigNativeMidgard::default_q8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigNativeMidgard::default_q8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigNativeMidgard::default_q8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigNativeMidgard::default_q8 }
- };
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_default(nullptr,
+ nullptr,
+ &CLGEMMDefaultConfigNativeMidgard::default_q8);
- if(default_configs.find(data_type) != default_configs.end())
- {
- return (this->*default_configs[data_type])(m, n, k, b);
- }
- ARM_COMPUTE_ERROR("Not supported data type");
+ auto func = configs_default.get_function(data_type);
+ ARM_COMPUTE_ERROR_ON_MSG(func == nullptr, "Data type not support for GEMM");
+ return (this->*func)(m, n, k, b);
}
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigNativeMidgard::default_q8(unsigned int m, unsigned int n, unsigned int k, unsigned int b)
diff --git a/src/core/CL/gemm/native/CLGEMMDefaultConfigNativeValhall.cpp b/src/core/CL/gemm/native/CLGEMMDefaultConfigNativeValhall.cpp
index ab5aa11bf8..3b55be747f 100644
--- a/src/core/CL/gemm/native/CLGEMMDefaultConfigNativeValhall.cpp
+++ b/src/core/CL/gemm/native/CLGEMMDefaultConfigNativeValhall.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Arm Limited.
+ * Copyright (c) 2020-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -28,7 +28,6 @@
#include "arm_compute/core/GPUTarget.h"
#include "src/core/CL/gemm/CLGEMMHelpers.h"
-#include <map>
#include <utility>
namespace arm_compute
@@ -45,30 +44,13 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigNativeValhall
using ConfigurationFunctionExecutorPtr = std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> (CLGEMMDefaultConfigNativeValhall::*)(unsigned int m, unsigned int n, unsigned int k,
unsigned int b);
- // Configurations for Mali-G77
- static std::map<DataType, ConfigurationFunctionExecutorPtr> gemm_configs_G77 =
- {
- { DataType::F32, &CLGEMMDefaultConfigNativeValhall::configure_G77_f32 },
- { DataType::F16, &CLGEMMDefaultConfigNativeValhall::configure_G77_f16 },
- { DataType::QASYMM8, &CLGEMMDefaultConfigNativeValhall::configure_G77_u8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigNativeValhall::configure_G77_u8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigNativeValhall::configure_G77_u8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigNativeValhall::configure_G77_u8 }
- };
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_default(&CLGEMMDefaultConfigNativeValhall::configure_G77_f32,
+ &CLGEMMDefaultConfigNativeValhall::configure_G77_f16,
+ &CLGEMMDefaultConfigNativeValhall::configure_G77_u8);
- switch(_target)
- {
- case GPUTarget::G77:
- default:
- if(gemm_configs_G77.find(data_type) != gemm_configs_G77.end())
- {
- return (this->*gemm_configs_G77[data_type])(m, n, k, b);
- }
- else
- {
- ARM_COMPUTE_ERROR("Not supported data type");
- }
- }
+ auto func = configs_default.get_function(data_type);
+ ARM_COMPUTE_ERROR_ON_MSG(func == nullptr, "Data type not support for GEMM");
+ return (this->*func)(m, n, k, b);
}
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigNativeValhall::configure_G77_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b)
diff --git a/src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedBifrost.cpp b/src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedBifrost.cpp
index 749d125c01..5877ab96e7 100644
--- a/src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedBifrost.cpp
+++ b/src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedBifrost.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020 Arm Limited.
+ * Copyright (c) 2019-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -31,7 +31,6 @@
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "src/core/CL/gemm/CLGEMMHelpers.h"
-#include <map>
#include <utility>
namespace arm_compute
@@ -49,60 +48,35 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedBifro
{
using ConfigurationFunctionExecutorPtr = std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> (CLGEMMDefaultConfigReshapedBifrost::*)(unsigned int m, unsigned int n, unsigned int k, unsigned int b);
- // Configurations for Mali-G76
- static std::map<DataType, ConfigurationFunctionExecutorPtr> gemm_configs_G76 =
- {
- { DataType::F32, &CLGEMMDefaultConfigReshapedBifrost::configure_G76_f32 },
- { DataType::F16, &CLGEMMDefaultConfigReshapedBifrost::configure_G76_f16 },
- { DataType::QASYMM8, &CLGEMMDefaultConfigReshapedBifrost::configure_G76_u8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigReshapedBifrost::configure_G76_u8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigReshapedBifrost::configure_G76_u8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigReshapedBifrost::configure_G76_u8 }
- };
-
- // Configurations for Mali-G52
- static std::map<DataType, ConfigurationFunctionExecutorPtr> gemm_configs_G52 =
- {
- { DataType::F32, &CLGEMMDefaultConfigReshapedBifrost::configure_G52_f32 },
- { DataType::F16, &CLGEMMDefaultConfigReshapedBifrost::configure_G52_f16 },
- { DataType::QASYMM8, &CLGEMMDefaultConfigReshapedBifrost::configure_G7x_u8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigReshapedBifrost::configure_G7x_u8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigReshapedBifrost::configure_G7x_u8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigReshapedBifrost::configure_G7x_u8 }
- };
-
- // Configurations for Mali-G7x
- static std::map<DataType, ConfigurationFunctionExecutorPtr> gemm_configs_G7x =
- {
- { DataType::F32, &CLGEMMDefaultConfigReshapedBifrost::configure_G7x_f32 },
- { DataType::F16, &CLGEMMDefaultConfigReshapedBifrost::configure_G7x_f16 },
- { DataType::QASYMM8, &CLGEMMDefaultConfigReshapedBifrost::configure_G7x_u8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigReshapedBifrost::configure_G7x_u8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigReshapedBifrost::configure_G7x_u8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigReshapedBifrost::configure_G7x_u8 }
- };
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G7x(&CLGEMMDefaultConfigReshapedBifrost::configure_G7x_f32,
+ &CLGEMMDefaultConfigReshapedBifrost::configure_G7x_f16,
+ &CLGEMMDefaultConfigReshapedBifrost::configure_G7x_u8);
+
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G52(&CLGEMMDefaultConfigReshapedBifrost::configure_G52_f32,
+ &CLGEMMDefaultConfigReshapedBifrost::configure_G52_f16,
+ &CLGEMMDefaultConfigReshapedBifrost::configure_G7x_u8);
+
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G76(&CLGEMMDefaultConfigReshapedBifrost::configure_G76_f32,
+ &CLGEMMDefaultConfigReshapedBifrost::configure_G76_f16,
+ &CLGEMMDefaultConfigReshapedBifrost::configure_G76_u8);
+
+ ConfigurationFunctionExecutorPtr func = nullptr;
switch(_target)
{
case GPUTarget::G76:
- if(gemm_configs_G76.find(data_type) != gemm_configs_G76.end())
- {
- return (this->*gemm_configs_G76[data_type])(m, n, k, b);
- }
- else
- {
- ARM_COMPUTE_ERROR("Not supported data type");
- }
+ func = configs_G76.get_function(data_type);
+ break;
+ case GPUTarget::G52:
+ func = configs_G52.get_function(data_type);
+ break;
default:
- if(gemm_configs_G7x.find(data_type) != gemm_configs_G7x.end())
- {
- return (this->*gemm_configs_G7x[data_type])(m, n, k, b);
- }
- else
- {
- ARM_COMPUTE_ERROR("Not supported data type");
- }
+ func = configs_G7x.get_function(data_type);
+ break;
}
+
+ ARM_COMPUTE_ERROR_ON_MSG(func == nullptr, "Data type not support for GEMM");
+ return (this->*func)(m, n, k, b);
}
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedBifrost::configure_G7x_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b)
diff --git a/src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedValhall.cpp b/src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedValhall.cpp
index 13c139e201..b07092ab83 100644
--- a/src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedValhall.cpp
+++ b/src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedValhall.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Arm Limited.
+ * Copyright (c) 2020-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -28,7 +28,6 @@
#include "arm_compute/core/GPUTarget.h"
#include "src/core/CL/gemm/CLGEMMHelpers.h"
-#include <map>
#include <utility>
namespace arm_compute
@@ -44,30 +43,29 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValha
{
using ConfigurationFunctionExecutorPtr = std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> (CLGEMMDefaultConfigReshapedValhall::*)(unsigned int m, unsigned int n, unsigned int k, unsigned int b);
- // Configurations for Mali-G77
- static std::map<DataType, ConfigurationFunctionExecutorPtr> gemm_configs_G77 =
- {
- { DataType::F32, &CLGEMMDefaultConfigReshapedValhall::configure_G77_f32 },
- { DataType::F16, &CLGEMMDefaultConfigReshapedValhall::configure_G77_f16 },
- { DataType::QASYMM8, &CLGEMMDefaultConfigReshapedValhall::configure_G77_u8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigReshapedValhall::configure_G77_u8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigReshapedValhall::configure_G77_u8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigReshapedValhall::configure_G77_u8 }
- };
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G77(&CLGEMMDefaultConfigReshapedValhall::configure_G77_f32,
+ &CLGEMMDefaultConfigReshapedValhall::configure_G77_f16,
+ &CLGEMMDefaultConfigReshapedValhall::configure_G77_u8);
+
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G78(&CLGEMMDefaultConfigReshapedValhall::configure_G78_f32,
+ &CLGEMMDefaultConfigReshapedValhall::configure_G78_f16,
+ &CLGEMMDefaultConfigReshapedValhall::configure_G77_u8);
+
+ ConfigurationFunctionExecutorPtr func = nullptr;
switch(_target)
{
+ case GPUTarget::G78:
+ func = configs_G78.get_function(data_type);
+ break;
case GPUTarget::G77:
default:
- if(gemm_configs_G77.find(data_type) != gemm_configs_G77.end())
- {
- return (this->*gemm_configs_G77[data_type])(m, n, k, b);
- }
- else
- {
- ARM_COMPUTE_ERROR("Not supported data type");
- }
+ func = configs_G77.get_function(data_type);
+ break;
}
+
+ ARM_COMPUTE_ERROR_ON_MSG(func == nullptr, "Data type not support for GEMM");
+ return (this->*func)(m, n, k, b);
}
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValhall::configure_G77_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b)
@@ -77,11 +75,11 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValha
if(n <= 4)
{
- return configure_lhs_rhs_info(m, n, 4, 2, 8, 16, 16, true, false, false, true);
+ return configure_lhs_rhs_info(m, n, 4, 2, 8, 16, 16, 1, 0, 0, 1);
}
else
{
- return configure_lhs_rhs_info(m, n, 5, 4, 4, 2, 16, false, true, false, true);
+ return configure_lhs_rhs_info(m, n, 5, 4, 4, 2, 16, 0, 1, 0, 1);
}
}
@@ -100,13 +98,13 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValha
GEMMLHSMatrixInfo lhs_info_img;
GEMMRHSMatrixInfo rhs_info_img;
- std::tie(lhs_info_buf, rhs_info_buf) = configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 4, false, false, true, false, false);
+ std::tie(lhs_info_buf, rhs_info_buf) = configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 4, 0, 0, 1, 0, 0);
if(r_mk <= 0.11824845522642136)
{
if(workload <= 880.0)
{
- return configure_lhs_rhs_info(m, n, 2, 4, 4, 1, 4, false, false, true, false, false);
+ return configure_lhs_rhs_info(m, n, 2, 4, 4, 1, 4, 0, 0, 1, 0, 0);
}
else
{
@@ -114,11 +112,11 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValha
{
if(workload <= 1726.4000244140625)
{
- return configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 2, false, false, true, false, false);
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 2, 0, 0, 1, 0, 0);
}
else
{
- std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 1, false, true, true, false, true);
+ std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 1, 0, 1, 1, 0, 1);
return select_lhs_rhs_info(std::make_pair(lhs_info_img, rhs_info_img),
std::make_pair(lhs_info_buf, rhs_info_buf),
@@ -129,11 +127,11 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValha
{
if(workload <= 1241.6000366210938)
{
- return configure_lhs_rhs_info(m, n, 2, 4, 4, 1, 4, false, false, true, false, false);
+ return configure_lhs_rhs_info(m, n, 2, 4, 4, 1, 4, 0, 0, 1, 0, 0);
}
else
{
- return configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 4, false, false, true, false, false);
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 4, 0, 0, 1, 0, 0);
}
}
}
@@ -146,7 +144,7 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValha
{
if(r_mn <= 2.545312523841858)
{
- std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 1, false, true, true, false, true);
+ std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 1, 0, 1, 1, 0, 1);
return select_lhs_rhs_info(std::make_pair(lhs_info_img, rhs_info_img),
std::make_pair(lhs_info_buf, rhs_info_buf),
@@ -154,14 +152,14 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValha
}
else
{
- return configure_lhs_rhs_info(m, n, 2, 4, 4, 1, 4, false, false, true, false, false);
+ return configure_lhs_rhs_info(m, n, 2, 4, 4, 1, 4, 0, 0, 1, 0, 0);
}
}
else
{
if(workload <= 2881.199951171875)
{
- std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 2, false, false, true, false, true);
+ std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 2, 0, 0, 1, 0, 1);
return select_lhs_rhs_info(std::make_pair(lhs_info_img, rhs_info_img),
std::make_pair(lhs_info_buf, rhs_info_buf),
@@ -169,7 +167,7 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValha
}
else
{
- std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 1, false, true, true, false, true);
+ std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 1, 0, 1, 1, 0, 1);
return select_lhs_rhs_info(std::make_pair(lhs_info_img, rhs_info_img),
std::make_pair(lhs_info_buf, rhs_info_buf),
@@ -183,7 +181,7 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValha
{
if(r_mn <= 6.010416746139526)
{
- std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 1, false, true, true, false, true);
+ std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 1, 0, 1, 1, 0, 1);
return select_lhs_rhs_info(std::make_pair(lhs_info_img, rhs_info_img),
std::make_pair(lhs_info_buf, rhs_info_buf),
@@ -191,7 +189,7 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValha
}
else
{
- std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 1, true, false, true, false, true);
+ std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 1, 1, 0, 1, 0, 1);
return select_lhs_rhs_info(std::make_pair(lhs_info_img, rhs_info_img),
std::make_pair(lhs_info_buf, rhs_info_buf),
@@ -200,7 +198,7 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValha
}
else
{
- std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 1, true, false, true, false, true);
+ std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 1, 1, 0, 1, 0, 1);
return select_lhs_rhs_info(std::make_pair(lhs_info_img, rhs_info_img),
std::make_pair(lhs_info_buf, rhs_info_buf),
@@ -210,6 +208,312 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValha
}
}
+std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValhall::configure_G78_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b)
+{
+ const float r_mn = static_cast<float>(m) / static_cast<float>(n);
+ const float r_mk = static_cast<float>(m) / static_cast<float>(k);
+ const float r_nk = static_cast<float>(n) / static_cast<float>(k);
+ const float workload = (static_cast<float>(m) * static_cast<float>(n) * static_cast<float>(b)) / 20.0f;
+
+ if(workload <= 1288.0000f)
+ {
+ if(workload <= 505.6000f)
+ {
+ if(r_mn <= 0.4466f)
+ {
+ if(r_nk <= 0.2384f)
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 8, 4, 4, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 2, 2, 4, 2, 2, 0, 0, 1, 0, 0);
+ }
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 2, 2, 4, 2, 2, 0, 0, 1, 0, 0);
+ }
+ }
+ else
+ {
+ if(r_mn <= 0.2250f)
+ {
+ if(r_mn <= 0.1599f)
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 8, 4, 4, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ }
+ else
+ {
+ if(r_mk <= 0.7609f)
+ {
+ if(r_mn <= 2.5453f)
+ {
+ if(workload <= 1089.6000f)
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 8, 4, 4, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 8, 2, 4, 0, 0, 1, 0, 1);
+ }
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 16, 4, 4, 0, 0, 1, 0, 1);
+ }
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 8, 4, 4, 0, 0, 1, 0, 1);
+ }
+ }
+ }
+ }
+ else
+ {
+ if(workload <= 5434.4001f)
+ {
+ if(workload <= 1603.2000f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ if(r_nk <= 0.6192f)
+ {
+ if(r_mn <= 16.1016f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ if(workload <= 2750.0000f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ if(r_mk <= 6.3151f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 4, 0, 0, 0, 1, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ }
+ }
+ }
+ else
+ {
+ if(r_mk <= 0.0387f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 4, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ if(r_mk <= 2.5859f)
+ {
+ if(r_mk <= 0.2734f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 4, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if(r_mk <= 25.7500f)
+ {
+ if(r_mk <= 0.3615f)
+ {
+ if(r_mn <= 0.0913f)
+ {
+ if(r_mk <= 0.0683f)
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 4, 2, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 8, 4, 4, 0, 0, 1, 0, 1);
+ }
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ }
+ else
+ {
+ if(workload <= 11174.3999f)
+ {
+ if(r_mk <= 0.8047f)
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ if(workload <= 7185.5999f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 4, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 4, 2, 0, 0, 1, 0, 1);
+ }
+ }
+ }
+ else
+ {
+ if(workload <= 17917.5000f)
+ {
+ if(r_mk <= 1.5078f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 4, 0, 0, 1, 0, 1);
+ }
+ }
+ else
+ {
+ if(workload <= 34449.6016f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 2, 4, 0, 0, 1, 0, 1);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if(r_mk <= 331.1111f)
+ {
+ if(workload <= 53397.5996f)
+ {
+ if(r_mn <= 57.8063f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 4, 0, 0, 0, 1, 1);
+ }
+ }
+ else
+ {
+ if(r_nk <= 0.9211f)
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 4, 2, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 4, 0, 0, 0, 1, 1);
+ }
+ }
+ }
+ else
+ {
+ if(workload <= 38070.4004f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 4, 4, 0, 0, 0, 1, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ }
+ }
+ }
+ }
+}
+
+std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValhall::configure_G78_f16(unsigned int m, unsigned int n, unsigned int k, unsigned int b)
+{
+ const float r_mn = static_cast<float>(m) / static_cast<float>(n);
+ const float r_nk = static_cast<float>(n) / static_cast<float>(k);
+ const float workload = (static_cast<float>(m) * static_cast<float>(n) * static_cast<float>(b)) / 20.0f;
+
+ if(workload <= 801.6000f)
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 1, 1, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ if(r_mn <= 0.1211f)
+ {
+ if(workload <= 3296.0000f)
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ if(r_nk <= 1.0625f)
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 2, 4, 0, 0, 1, 0, 1);
+ }
+ }
+ }
+ else
+ {
+ if(workload <= 5068.8000f)
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 1, 1, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ if(r_nk <= 0.2361f)
+ {
+ if(workload <= 12630.0000f)
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 1, 1, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 2, 1, 0, 0, 1, 0, 1);
+ }
+ }
+ else
+ {
+ if(workload <= 178790.3984f)
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 2, 2, 0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 8, 4, 4, 1, 1, 0, 0, 1, 0, 1);
+ }
+ }
+ }
+ }
+ }
+}
+
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValhall::configure_G77_u8(unsigned int m, unsigned int n, unsigned int k, unsigned int b)
{
ARM_COMPUTE_UNUSED(k);
@@ -217,11 +521,11 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedValha
if(n <= 4)
{
- return configure_lhs_rhs_info(m, n, 4, 2, 16, 4, 1, false, false, false, true);
+ return configure_lhs_rhs_info(m, n, 4, 2, 16, 4, 1, 0, 0, 0, 1);
}
else
{
- return configure_lhs_rhs_info(m, n, 4, 4, 16, 2, 2, false, true, false, true);
+ return configure_lhs_rhs_info(m, n, 4, 4, 16, 2, 2, 0, 1, 0, 1);
}
}
} // namespace cl_gemm
diff --git a/src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedValhall.h b/src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedValhall.h
index 2ce6482c46..52b83b09b6 100644
--- a/src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedValhall.h
+++ b/src/core/CL/gemm/reshaped/CLGEMMDefaultConfigReshapedValhall.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Arm Limited.
+ * Copyright (c) 2020-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -46,6 +46,8 @@ public:
private:
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> configure_G77_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b);
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> configure_G77_f16(unsigned int m, unsigned int n, unsigned int k, unsigned int b);
+ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> configure_G78_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b);
+ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> configure_G78_f16(unsigned int m, unsigned int n, unsigned int k, unsigned int b);
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> configure_G77_u8(unsigned int m, unsigned int n, unsigned int k, unsigned int b);
};
} // namespace cl_gemm
diff --git a/src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyBifrost.cpp b/src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyBifrost.cpp
index 7e6ef72f34..3645a0e141 100644
--- a/src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyBifrost.cpp
+++ b/src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyBifrost.cpp
@@ -31,7 +31,6 @@
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "src/core/CL/gemm/CLGEMMHelpers.h"
-#include <map>
#include <utility>
namespace arm_compute
@@ -50,89 +49,42 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOn
using ConfigurationFunctionExecutorPtr = std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> (CLGEMMDefaultConfigReshapedRHSOnlyBifrost::*)(unsigned int m, unsigned int n, unsigned int k,
unsigned int b);
- // Configurations for Mali-G51
- static std::map<DataType, ConfigurationFunctionExecutorPtr> gemm_configs_G51 =
- {
- { DataType::F32, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G51_f32 },
- { DataType::F16, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G51_f16 },
- { DataType::QASYMM8, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G51_u8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G51_u8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G51_u8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G51_u8 }
- };
-
- // Configurations for Mali-G52
- static std::map<DataType, ConfigurationFunctionExecutorPtr> gemm_configs_G52 =
- {
- { DataType::F32, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G52_f32 },
- { DataType::F16, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G52_f16 },
- { DataType::QASYMM8, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_u8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_u8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_u8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_u8 }
- };
-
- // Configurations for Mali-G76
- static std::map<DataType, ConfigurationFunctionExecutorPtr> gemm_configs_G76 =
- {
- { DataType::F32, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G76_f32 },
- { DataType::F16, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G76_f16 },
- { DataType::QASYMM8, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G76_u8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G76_u8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G76_u8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G76_u8 }
- };
-
- // Configurations for Mali-G7x
- static std::map<DataType, ConfigurationFunctionExecutorPtr> gemm_configs_G7x =
- {
- { DataType::F32, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_f32 },
- { DataType::F16, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_f16 },
- { DataType::QASYMM8, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_u8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_u8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_u8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_u8 }
- };
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G51(&CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G51_f32,
+ &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G51_f16,
+ &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G51_u8);
+
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G52(&CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G52_f32,
+ &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G52_f16,
+ &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_u8);
+
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G76(&CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G76_f32,
+ &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G76_f16,
+ &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G76_u8);
+
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G7x(&CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_f32,
+ &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_f16,
+ &CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_u8);
+
+ ConfigurationFunctionExecutorPtr func = nullptr;
switch(_target)
{
case GPUTarget::G76:
- if(gemm_configs_G76.find(data_type) != gemm_configs_G76.end())
- {
- return (this->*gemm_configs_G76[data_type])(m, n, k, b);
- }
- else
- {
- ARM_COMPUTE_ERROR("Not supported data type");
- }
- case GPUTarget::G52:
- if(gemm_configs_G52.find(data_type) != gemm_configs_G52.end())
- {
- return (this->*gemm_configs_G52[data_type])(m, n, k, b);
- }
- else
- {
- ARM_COMPUTE_ERROR("Not supported data type");
- }
+ func = configs_G76.get_function(data_type);
+ break;
case GPUTarget::G51:
- if(gemm_configs_G51.find(data_type) != gemm_configs_G51.end())
- {
- return (this->*gemm_configs_G51[data_type])(m, n, k, b);
- }
- else
- {
- ARM_COMPUTE_ERROR("Not supported data type");
- }
+ func = configs_G51.get_function(data_type);
+ break;
+ case GPUTarget::G52:
+ func = configs_G52.get_function(data_type);
+ break;
default:
- if(gemm_configs_G7x.find(data_type) != gemm_configs_G7x.end())
- {
- return (this->*gemm_configs_G7x[data_type])(m, n, k, b);
- }
- else
- {
- ARM_COMPUTE_ERROR("Not supported data type");
- }
+ func = configs_G7x.get_function(data_type);
+ break;
}
+
+ ARM_COMPUTE_ERROR_ON_MSG(func == nullptr, "Data type not support for GEMM");
+ return (this->*func)(m, n, k, b);
}
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOnlyBifrost::configure_G7x_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b)
diff --git a/src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyValhall.cpp b/src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyValhall.cpp
index a0d38e44ae..a3f0509eda 100644
--- a/src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyValhall.cpp
+++ b/src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyValhall.cpp
@@ -31,7 +31,6 @@
#include "arm_compute/core/utils/misc/ShapeCalculator.h"
#include "src/core/CL/gemm/CLGEMMHelpers.h"
-#include <map>
#include <utility>
namespace arm_compute
@@ -50,30 +49,29 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOn
using ConfigurationFunctionExecutorPtr = std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> (CLGEMMDefaultConfigReshapedRHSOnlyValhall::*)(unsigned int m, unsigned int n, unsigned int k,
unsigned int b);
- // Configurations for Mali-G77
- static std::map<DataType, ConfigurationFunctionExecutorPtr> gemm_configs_G77 =
- {
- { DataType::F32, &CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G77_f32 },
- { DataType::F16, &CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G77_f16 },
- { DataType::QASYMM8, &CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G77_u8 },
- { DataType::QSYMM8, &CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G77_u8 },
- { DataType::QASYMM8_SIGNED, &CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G77_u8 },
- { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G77_u8 }
- };
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G77(&CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G77_f32,
+ &CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G77_f16,
+ &CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G77_u8);
+
+ CLGEMMConfigArray<ConfigurationFunctionExecutorPtr> configs_G78(&CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G78_f32,
+ &CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G78_f16,
+ &CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G77_u8);
+
+ ConfigurationFunctionExecutorPtr func = nullptr;
switch(_target)
{
+ case GPUTarget::G78:
+ func = configs_G78.get_function(data_type);
+ break;
case GPUTarget::G77:
default:
- if(gemm_configs_G77.find(data_type) != gemm_configs_G77.end())
- {
- return (this->*gemm_configs_G77[data_type])(m, n, k, b);
- }
- else
- {
- ARM_COMPUTE_ERROR("Not supported data type");
- }
+ func = configs_G77.get_function(data_type);
+ break;
}
+
+ ARM_COMPUTE_ERROR_ON_MSG(func == nullptr, "Data type not support for GEMM");
+ return (this->*func)(m, n, k, b);
}
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G77_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b)
@@ -93,8 +91,8 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOn
GEMMRHSMatrixInfo rhs_info_img;
const unsigned int h0 = std::max(n / 4, 1U);
- std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 1, 4, 8, 1, 16, false, true, false, false, true);
- std::tie(lhs_info_buf, rhs_info_buf) = configure_lhs_rhs_info(m, n, 1, 4, 4, 1, h0, false, true, false, true, false);
+ std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 1, 4, 8, 1, 16, 0, 1, 0, 0, 1);
+ std::tie(lhs_info_buf, rhs_info_buf) = configure_lhs_rhs_info(m, n, 1, 4, 4, 1, h0, 0, 1, 0, 1, 0);
return select_lhs_rhs_info(std::make_pair(lhs_info_img, rhs_info_img),
std::make_pair(lhs_info_buf, rhs_info_buf),
@@ -102,18 +100,18 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOn
}
else
{
- return configure_lhs_rhs_info(m, n, 1, 2, 16, 1, 8, false, true, false, false, false);
+ return configure_lhs_rhs_info(m, n, 1, 2, 16, 1, 8, 0, 1, 0, 0, 0);
}
}
else
{
if(r_mk <= 0.020312500186264515)
{
- return configure_lhs_rhs_info(m, n, 1, 2, 16, 1, 4, false, true, false, false, false);
+ return configure_lhs_rhs_info(m, n, 1, 2, 16, 1, 4, 0, 1, 0, 0, 0);
}
else
{
- return configure_lhs_rhs_info(m, n, 1, 4, 16, 1, 16, false, true, false, true, false);
+ return configure_lhs_rhs_info(m, n, 1, 4, 16, 1, 16, 0, 1, 0, 1, 0);
}
}
}
@@ -127,7 +125,7 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOn
{
if(workload <= 747.1999816894531)
{
- return configure_lhs_rhs_info(m, n, 2, 2, 4, 1, 8, false, true, false, true, false);
+ return configure_lhs_rhs_info(m, n, 2, 2, 4, 1, 8, 0, 1, 0, 1, 0);
}
else
{
@@ -135,8 +133,8 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOn
GEMMRHSMatrixInfo rhs_info_buf;
GEMMLHSMatrixInfo lhs_info_img;
GEMMRHSMatrixInfo rhs_info_img;
- std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 2, 4, 8, 1, 2, false, false, false, true, true);
- std::tie(lhs_info_buf, rhs_info_buf) = configure_lhs_rhs_info(m, n, 2, 2, 4, 1, 8, false, true, false, true, false);
+ std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 2, 4, 8, 1, 2, 0, 0, 0, 1, 1);
+ std::tie(lhs_info_buf, rhs_info_buf) = configure_lhs_rhs_info(m, n, 2, 2, 4, 1, 8, 0, 1, 0, 1, 0);
return select_lhs_rhs_info(std::make_pair(lhs_info_img, rhs_info_img),
std::make_pair(lhs_info_buf, rhs_info_buf),
@@ -149,7 +147,7 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOn
{
if(r_mk <= 0.028125000186264515)
{
- return configure_lhs_rhs_info(m, n, 2, 2, 4, 1, 8, false, true, false, true, false);
+ return configure_lhs_rhs_info(m, n, 2, 2, 4, 1, 8, 0, 1, 0, 1, 0);
}
else
{
@@ -157,8 +155,8 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOn
GEMMRHSMatrixInfo rhs_info_buf;
GEMMLHSMatrixInfo lhs_info_img;
GEMMRHSMatrixInfo rhs_info_img;
- std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 2, 4, 8, 1, 2, false, false, false, true, true);
- std::tie(lhs_info_buf, rhs_info_buf) = configure_lhs_rhs_info(m, n, 2, 2, 4, 1, 8, false, true, false, true, false);
+ std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 2, 4, 8, 1, 2, 0, 0, 0, 1, 1);
+ std::tie(lhs_info_buf, rhs_info_buf) = configure_lhs_rhs_info(m, n, 2, 2, 4, 1, 8, 0, 1, 0, 1, 0);
return select_lhs_rhs_info(std::make_pair(lhs_info_img, rhs_info_img),
std::make_pair(lhs_info_buf, rhs_info_buf),
@@ -171,8 +169,8 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOn
GEMMRHSMatrixInfo rhs_info_buf;
GEMMLHSMatrixInfo lhs_info_img;
GEMMRHSMatrixInfo rhs_info_img;
- std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 1, 2, false, true, false, false, true);
- std::tie(lhs_info_buf, rhs_info_buf) = configure_lhs_rhs_info(m, n, 4, 4, 4, 1, 16, false, true, false, true, false);
+ std::tie(lhs_info_img, rhs_info_img) = configure_lhs_rhs_info(m, n, 4, 4, 4, 1, 2, 0, 1, 0, 0, 1);
+ std::tie(lhs_info_buf, rhs_info_buf) = configure_lhs_rhs_info(m, n, 4, 4, 4, 1, 16, 0, 1, 0, 1, 0);
return select_lhs_rhs_info(std::make_pair(lhs_info_img, rhs_info_img),
std::make_pair(lhs_info_buf, rhs_info_buf),
@@ -192,11 +190,11 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOn
const unsigned int h0 = std::max(n / 2, 1U);
if(n <= 836.0)
{
- return configure_lhs_rhs_info(m, n, 1, 2, 16, 1, h0, false, true, false, true, false);
+ return configure_lhs_rhs_info(m, n, 1, 2, 16, 1, h0, 0, 1, 0, 1, 0);
}
else
{
- return configure_lhs_rhs_info(m, n, 1, 2, 8, 1, h0, false, true, false, true, false);
+ return configure_lhs_rhs_info(m, n, 1, 2, 8, 1, h0, 0, 1, 0, 1, 0);
}
}
else if(m < 128)
@@ -204,11 +202,11 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOn
const int h0 = std::max(std::min(static_cast<int>(n / 4), static_cast<int>(256)), static_cast<int>(1));
if(k >= 512)
{
- return configure_lhs_rhs_info(m, n, 2, 4, 16, 1, h0, false, true, false, false);
+ return configure_lhs_rhs_info(m, n, 2, 4, 16, 1, h0, 0, 1, 0, 0);
}
else
{
- return configure_lhs_rhs_info(m, n, 2, 4, 8, 1, h0, false, true, false, false);
+ return configure_lhs_rhs_info(m, n, 2, 4, 8, 1, h0, 0, 1, 0, 0);
}
}
else
@@ -216,17 +214,17 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOn
const int h0 = std::max(std::min(static_cast<int>(n / 4), static_cast<int>(256)), static_cast<int>(1));
if(n >= 64)
{
- return configure_lhs_rhs_info(m, n, 4, 8, 4, 1, h0, false, true, false, false);
+ return configure_lhs_rhs_info(m, n, 4, 8, 4, 1, h0, 0, 1, 0, 0);
}
else
{
if(k >= 512)
{
- return configure_lhs_rhs_info(m, n, 2, 4, 16, 1, h0, false, true, false, false);
+ return configure_lhs_rhs_info(m, n, 2, 4, 16, 1, h0, 0, 1, 0, 0);
}
else
{
- return configure_lhs_rhs_info(m, n, 2, 4, 8, 1, h0, false, true, false, false);
+ return configure_lhs_rhs_info(m, n, 2, 4, 8, 1, h0, 0, 1, 0, 0);
}
}
}
@@ -240,18 +238,325 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOn
if(m == 1)
{
const unsigned int h0 = std::max(n / 2, 1U);
- return configure_lhs_rhs_info(m, n, 1, 4, 16, 1, h0, false, true, false, true);
+ return configure_lhs_rhs_info(m, n, 1, 4, 16, 1, h0, 0, 1, 0, 1);
}
else
{
const int h0 = std::max(std::min(static_cast<int>(n / 4), static_cast<int>(256)), static_cast<int>(1));
if(m >= 28)
{
- return configure_lhs_rhs_info(m, n, 4, 4, 16, 1, h0, false, true, false, true);
+ return configure_lhs_rhs_info(m, n, 4, 4, 16, 1, h0, 0, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 16, 1, h0, 0, 1, 0, 1);
+ }
+ }
+}
+
+std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G78_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b)
+{
+ const float r_mn = static_cast<float>(m) / static_cast<float>(n);
+ const float r_mk = static_cast<float>(m) / static_cast<float>(k);
+ const float r_nk = static_cast<float>(n) / static_cast<float>(k);
+ const float workload = (static_cast<float>(m) * static_cast<float>(n) * static_cast<float>(b)) / 20.0f;
+
+ if(m == 1)
+ {
+ if(workload <= 278.7000f)
+ {
+ if(workload <= 7.5000f)
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 8, 1, 2, 0, 1, 1, 0, 0);
+ }
+ else
+ {
+ if(r_mn <= 0.0031f)
+ {
+ if(workload <= 256.6000f)
+ {
+ if(workload <= 16.7500f)
+ {
+ if(r_nk <= 1.6671f)
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 2, 1, 32, 0, 0, 0, 1, 0);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 8, 1, 2, 0, 1, 1, 0, 0);
+ }
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 2, 1, 32, 0, 0, 0, 1, 0);
+ }
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 2, 1, 32, 0, 0, 0, 1, 0);
+ }
+ }
+ else
+ {
+ if(r_mk <= 0.0027f)
+ {
+ if(r_mk <= 0.0014f)
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 2, 1, 32, 0, 0, 0, 1, 0);
+ }
+ else
+ {
+ if(workload <= 8.9500f)
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 8, 1, 2, 0, 1, 1, 0, 0);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 2, 1, 32, 0, 0, 0, 1, 0);
+ }
+ }
+ }
+ else
+ {
+ if(workload <= 14.1500f)
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 8, 1, 2, 0, 1, 1, 0, 0);
+ }
+ else
+ {
+ if(r_mk <= 0.0041f)
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 2, 1, 32, 0, 0, 0, 1, 0);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 8, 1, 2, 0, 1, 1, 0, 0);
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if(workload <= 363.7000f)
+ {
+ if(r_mk <= 0.0031f)
+ {
+ return configure_lhs_rhs_info(m, n, 1, 4, 2, 1, 32, 0, 1, 0, 1, 0);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 1, 4, 4, 1, 32, 0, 1, 0, 1, 0);
+ }
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 1, 4, 2, 1, 32, 0, 1, 0, 1, 0);
+ }
+ }
+ }
+ else
+ {
+ if(workload <= 1384.8000f)
+ {
+ if(workload <= 704.0000f)
+ {
+ return configure_lhs_rhs_info(m, n, 2, 2, 4, 1, 32, 0, 1, 0, 1, 0);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 8, 1, 4, 0, 0, 0, 1, 1);
+ }
+ }
+ else
+ {
+ if(workload <= 16761.6006f)
+ {
+ if(r_mn <= 187.1250f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 4, 1, 16, 0, 0, 0, 1, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 8, 1, 4, 0, 0, 0, 1, 1);
+ }
+ }
+ else
+ {
+ if(r_mk <= 432.4630f)
+ {
+ return configure_lhs_rhs_info(m, n, 5, 4, 4, 1, 16, 0, 0, 0, 1, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 4, 1, 16, 0, 1, 0, 1, 1);
+ }
+ }
+ }
+ }
+}
+
+std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> CLGEMMDefaultConfigReshapedRHSOnlyValhall::configure_G78_f16(unsigned int m, unsigned int n, unsigned int k, unsigned int b)
+{
+ const float r_mn = static_cast<float>(m) / static_cast<float>(n);
+ const float r_mk = static_cast<float>(m) / static_cast<float>(k);
+ const float r_nk = static_cast<float>(n) / static_cast<float>(k);
+ const float workload = (static_cast<float>(m) * static_cast<float>(n) * static_cast<float>(b)) / 20.0f;
+
+ if(m == 1)
+ {
+ if(r_mn <= 0.0038f)
+ {
+ if(workload <= 353.9000f)
+ {
+ if(workload <= 278.7000f)
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 4, 1, 32, 0, 0, 1, 0, 0);
+ }
+ else
+ {
+ if(r_mk <= 0.0004f)
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 4, 1, 32, 0, 0, 1, 0, 0);
+ }
+ else
+ {
+ if(r_mk <= 0.0030f)
+ {
+ return configure_lhs_rhs_info(m, n, 1, 8, 4, 1, 8, 0, 1, 1, 0, 1);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 4, 1, 32, 0, 0, 1, 0, 0);
+ }
+ }
+ }
+ }
+ else
+ {
+ if(r_nk <= 1.9384f)
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 4, 1, 32, 0, 0, 1, 0, 0);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 1, 8, 4, 1, 8, 0, 1, 1, 0, 1);
+ }
+ }
}
else
{
- return configure_lhs_rhs_info(m, n, 2, 4, 16, 1, h0, false, true, false, true);
+ if(r_nk <= 1.0368f)
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 16, 1, 32, 0, 0, 1, 0, 0);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 1, 2, 4, 1, 32, 0, 0, 1, 0, 0);
+ }
+ }
+ }
+ else
+ {
+ if(workload <= 1422.4000f)
+ {
+ if(workload <= 704.0000f)
+ {
+ return configure_lhs_rhs_info(m, n, 2, 2, 8, 1, 32, 0, 0, 1, 0, 0);
+ }
+ else
+ {
+ if(workload <= 1197.6000f)
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 8, 1, 8, 0, 1, 1, 0, 1);
+ }
+ else
+ {
+ if(workload <= 1241.6000f)
+ {
+ return configure_lhs_rhs_info(m, n, 2, 8, 8, 1, 16, 0, 1, 1, 0, 0);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 8, 1, 8, 0, 1, 1, 0, 1);
+ }
+ }
+ }
+ }
+ else
+ {
+ if(workload <= 2769.6000f)
+ {
+ if(workload <= 1846.4000f)
+ {
+ if(r_mn <= 2.4927f)
+ {
+ return configure_lhs_rhs_info(m, n, 2, 8, 8, 1, 16, 0, 1, 1, 0, 0);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 8, 1, 32, 0, 1, 1, 0, 0);
+ }
+ }
+ else
+ {
+ if(r_mn <= 0.6261f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 8, 1, 32, 0, 1, 1, 0, 0);
+ }
+ else
+ {
+ if(r_mk <= 3.4453f)
+ {
+ if(r_mn <= 1.4135f)
+ {
+ return configure_lhs_rhs_info(m, n, 2, 8, 8, 1, 16, 0, 1, 1, 0, 0);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 8, 1, 32, 0, 1, 1, 0, 0);
+ }
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 2, 8, 8, 1, 16, 0, 1, 1, 0, 0);
+ }
+ }
+ }
+ }
+ else
+ {
+ if(r_nk <= 0.0302f)
+ {
+ return configure_lhs_rhs_info(m, n, 2, 4, 8, 1, 8, 0, 1, 1, 0, 1);
+ }
+ else
+ {
+ if(r_mk <= 181.3750f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 8, 1, 32, 0, 1, 1, 0, 0);
+ }
+ else
+ {
+ if(workload <= 28035.2002f)
+ {
+ return configure_lhs_rhs_info(m, n, 2, 8, 8, 1, 16, 0, 1, 1, 0, 0);
+ }
+ else
+ {
+ if(r_mk <= 808.6667f)
+ {
+ return configure_lhs_rhs_info(m, n, 4, 4, 8, 1, 32, 0, 1, 1, 0, 0);
+ }
+ else
+ {
+ return configure_lhs_rhs_info(m, n, 2, 8, 8, 1, 16, 0, 1, 1, 0, 0);
+ }
+ }
+ }
+ }
+ }
}
}
}
diff --git a/src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyValhall.h b/src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyValhall.h
index 94c6a43c21..a3b556c441 100644
--- a/src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyValhall.h
+++ b/src/core/CL/gemm/reshaped_only_rhs/CLGEMMDefaultConfigReshapedRHSOnlyValhall.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Arm Limited.
+ * Copyright (c) 2020-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -46,6 +46,8 @@ public:
private:
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> configure_G77_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b);
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> configure_G77_f16(unsigned int m, unsigned int n, unsigned int k, unsigned int b);
+ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> configure_G78_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b);
+ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> configure_G78_f16(unsigned int m, unsigned int n, unsigned int k, unsigned int b);
std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> configure_G77_u8(unsigned int m, unsigned int n, unsigned int k, unsigned int b);
};
} // namespace cl_gemm
diff --git a/src/runtime/CL/gemm/CLGEMMDefaultTypeValhall.cpp b/src/runtime/CL/gemm/CLGEMMDefaultTypeValhall.cpp
index ad74368889..0f754276c7 100644
--- a/src/runtime/CL/gemm/CLGEMMDefaultTypeValhall.cpp
+++ b/src/runtime/CL/gemm/CLGEMMDefaultTypeValhall.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Arm Limited.
+ * Copyright (c) 2020-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -68,10 +68,27 @@ CLGEMMKernelType CLGEMMDefaultTypeValhall::select_kernel(const CLGEMMKernelSelec
{ DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultTypeValhall::default_q8 }
};
+ // Mali-G78 configurations
+ static std::map<DataType, FunctionExecutorPtr> gemm_g78_configs =
+ {
+ { DataType::F32, &CLGEMMDefaultTypeValhall::g78_f32 },
+ { DataType::F16, &CLGEMMDefaultTypeValhall::g78_f16 },
+ { DataType::QASYMM8, &CLGEMMDefaultTypeValhall::default_q8 },
+ { DataType::QASYMM8_SIGNED, &CLGEMMDefaultTypeValhall::default_q8 },
+ { DataType::QSYMM8, &CLGEMMDefaultTypeValhall::default_q8 },
+ { DataType::QSYMM8_PER_CHANNEL, &CLGEMMDefaultTypeValhall::default_q8 }
+ };
+
const DataType data_type = params.data_type;
switch(_target)
{
+ case GPUTarget::G78:
+ if(gemm_g78_configs.find(data_type) != gemm_g78_configs.end())
+ {
+ return (this->*gemm_g78_configs[data_type])(params.m, params.n, params.k, params.b, params.is_rhs_constant);
+ }
+ ARM_COMPUTE_ERROR("Not supported data type");
case GPUTarget::G77:
if(gemm_g77_configs.find(data_type) != gemm_g77_configs.end())
{
@@ -218,5 +235,76 @@ CLGEMMKernelType CLGEMMDefaultTypeValhall::default_q8(unsigned int m, unsigned i
return CLGEMMKernelType::NATIVE;
}
}
+
+CLGEMMKernelType CLGEMMDefaultTypeValhall::g78_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool is_rhs_constant)
+{
+ ARM_COMPUTE_UNUSED(b);
+
+ if(!is_rhs_constant)
+ {
+ return CLGEMMKernelType::NATIVE_V1;
+ }
+
+ if(m == 1)
+ {
+ return CLGEMMKernelType::RESHAPED_ONLY_RHS;
+ }
+
+ if(n <= 272.0000f)
+ {
+ return CLGEMMKernelType::RESHAPED_ONLY_RHS;
+ }
+ else
+ {
+ if(k <= 471.0000f)
+ {
+ return CLGEMMKernelType::RESHAPED_ONLY_RHS;
+ }
+ else
+ {
+ if(m <= 72.5000f)
+ {
+ return CLGEMMKernelType::RESHAPED_ONLY_RHS;
+ }
+ else
+ {
+ if(m <= 90.5000f)
+ {
+ return CLGEMMKernelType::RESHAPED;
+ }
+ else
+ {
+ if(k <= 2448.0000f)
+ {
+ if(n <= 756.0000f)
+ {
+ return CLGEMMKernelType::RESHAPED_ONLY_RHS;
+ }
+ else
+ {
+ return CLGEMMKernelType::RESHAPED;
+ }
+ }
+ else
+ {
+ return CLGEMMKernelType::RESHAPED;
+ }
+ }
+ }
+ }
+ }
+}
+
+CLGEMMKernelType CLGEMMDefaultTypeValhall::g78_f16(unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool is_rhs_constant)
+{
+ ARM_COMPUTE_UNUSED(m, n, k, b);
+
+ if(!is_rhs_constant)
+ {
+ return CLGEMMKernelType::NATIVE_V1;
+ }
+
+ return CLGEMMKernelType::RESHAPED_ONLY_RHS;
+}
} // namespace cl_gemm
} // namespace arm_compute
diff --git a/src/runtime/CL/gemm/CLGEMMDefaultTypeValhall.h b/src/runtime/CL/gemm/CLGEMMDefaultTypeValhall.h
index 2fae838cc3..c88fbcf557 100644
--- a/src/runtime/CL/gemm/CLGEMMDefaultTypeValhall.h
+++ b/src/runtime/CL/gemm/CLGEMMDefaultTypeValhall.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020 Arm Limited.
+ * Copyright (c) 2020-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -48,6 +48,8 @@ private:
CLGEMMKernelType default_f16(unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool is_rhs_constant);
CLGEMMKernelType default_q8(unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool is_rhs_constant);
CLGEMMKernelType g77_f16(unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool is_rhs_constant);
+ CLGEMMKernelType g78_f32(unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool is_rhs_constant);
+ CLGEMMKernelType g78_f16(unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool is_rhs_constant);
};
} // namespace cl_gemm
} // namespace arm_compute