Convert specific tuning mode to the one for ARMNN 56/252756/3
authorInki Dae <inki.dae@samsung.com>
Fri, 29 Jan 2021 08:24:55 +0000 (17:24 +0900)
committerInki Dae <inki.dae@samsung.com>
Tue, 2 Feb 2021 09:51:12 +0000 (18:51 +0900)
Change-Id: I2a0d2bcd3b6846971720b542c78823069a92484b
Signed-off-by: Inki Dae <inki.dae@samsung.com>
src/inference_engine_armnn.cpp
src/inference_engine_armnn_private.h

index a4e2433eb6cc4061278bd447136740823993adaf..f2e2d075e75d8006c818a032c05ef73a40fd6390 100644 (file)
@@ -306,7 +306,7 @@ namespace ARMNNImpl
                                {
                                        "GpuAcc",
                                        {
-                                               {"TuningLevel", static_cast<int>(mCLTuner.tuning_mode)},
+                                               {"TuningLevel", static_cast<int>(ConvertTuningType(mCLTuner.tuning_mode))},
                                                {"TuningFile", tune_path.c_str()}
                                        }
                                }
@@ -548,6 +548,36 @@ namespace ARMNNImpl
                                                  armnn::Compute::GpuAcc) != mAccelType.end());
        }
 
+       armnn::IGpuAccTunedParameters::TuningLevel InferenceARMNN::ConvertTuningType(inference_engine_cltuner_mode_e tuning_mode)
+       {
+               armnn::IGpuAccTunedParameters::TuningLevel armnn_tuning_level = armnn::IGpuAccTunedParameters::TuningLevel::Rapid;
+
+               switch (tuning_mode) {
+               case INFERENCE_ENGINE_CLTUNER_READ:
+                       // In case of CLTuner update mode, Rapid is used as UseOnly and it means read mode.
+                       armnn_tuning_level = armnn::IGpuAccTunedParameters::TuningLevel::Rapid;
+                       break;
+               case INFERENCE_ENGINE_CLTUNER_RAPID:
+                       armnn_tuning_level = armnn::IGpuAccTunedParameters::TuningLevel::Rapid;
+                       break;
+               case INFERENCE_ENGINE_CLTUNER_NORMAL:
+                       armnn_tuning_level = armnn::IGpuAccTunedParameters::TuningLevel::Normal;
+                       break;
+               case INFERENCE_ENGINE_CLTUNER_EXHAUSTIVE:
+                       armnn_tuning_level = armnn::IGpuAccTunedParameters::TuningLevel::Exhaustive;
+                       break;
+               default:
+                       // There must not be this case because a given tuning_mode is checked
+                       // by inference engine interface framework.
+                       LOGE("Invalid tuning type.");
+                       break;
+               }
+
+               LOGI("Tuning mode is %d", static_cast<int>(armnn_tuning_level));
+
+               return armnn_tuning_level;
+       }
+
        int InferenceARMNN::Run(
                        std::vector<inference_engine_tensor_buffer> &input_buffers,
                        std::vector<inference_engine_tensor_buffer> &output_buffers)
index cf589d352f1492db682abcbf69679e4daed97ce1..69bd93f822e4b810dc88f029ce04ca0f9022713e 100644 (file)
@@ -91,6 +91,7 @@ namespace ARMNNImpl
                                std::vector<inference_engine_tensor_buffer> &input_buffers,
                                std::vector<inference_engine_tensor_buffer> &output_buffers);
                bool UseGpuAcc(void);
+               armnn::IGpuAccTunedParameters::TuningLevel ConvertTuningType(inference_engine_cltuner_mode_e tuning_mode);
 
                std::vector<armnn::BackendId> mAccelType;