!4899 change to thread pool implemented by C

Merge pull request !4899 from wangzhe/master
This commit is contained in:
mindspore-ci-bot 2020-08-26 21:20:32 +08:00 committed by Gitee
commit 43a61e46af
122 changed files with 1120 additions and 889 deletions

View File

@ -166,7 +166,6 @@ if (BUILD_DEVICE)
add_compile_definitions(ENABLE_ARM32)
endif ()
if (PLATFORM_ARM64)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8.2-a+dotprod+fp16")
add_compile_definitions(ENABLE_ARM64)
if (ENABLE_FP16)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8.2-a+dotprod+fp16")

View File

@ -20,6 +20,7 @@
#include <string>
#include <memory>
#include "include/ms_tensor.h"
#include "include/thread_pool_config.h"
namespace mindspore::lite {
/// \brief Allocator defined a memory pool for malloc memory and free memory dynamically.
@ -27,13 +28,6 @@ namespace mindspore::lite {
/// \note List public class and interface for reference.
class Allocator;
/// \brief CpuBindMode defined for holding bind cpu strategy argument.
enum CpuBindMode {
MID_CPU = -1, /**< bind middle cpu first */
HIGHER_CPU = 1, /**< bind higher cpu first */
NO_BIND = 0 /**< no bind */
};
/// \brief DeviceType defined for holding user's preferred backend.
typedef enum {
DT_CPU, /**< CPU device type */

View File

@ -0,0 +1,35 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_LITE_INCLUDE_THREAD_POOL_CONFIG_H_
#define MINDSPORE_LITE_INCLUDE_THREAD_POOL_CONFIG_H_
/// \brief CpuBindMode defined for holding bind cpu strategy argument.
typedef enum Mode {
MID_CPU = -1, /**< bind middle cpu first */
HIGHER_CPU = 1, /**< bind higher cpu first */
NO_BIND = 0 /**< no bind */
} CpuBindMode;
/// \brief ThreadPoolId defined for specifying which thread pool to use.
typedef enum Id {
THREAD_POOL_DEFAULT = 0, /**< default thread pool id */
THREAD_POOL_SECOND = 1, /**< the second thread pool id */
THREAD_POOL_THIRD = 2, /**< the third thread pool id */
THREAD_POOL_FOURTH = 3 /**< the fourth thread pool id */
} ThreadPoolId;
#endif // LITE_MINDSPORE_LITE_INCLUDE_THREAD_POOL_CONFIG_H_

View File

@ -3,7 +3,7 @@ set(LITE_SRC
${CMAKE_CURRENT_SOURCE_DIR}/common/ms_tensor_utils.cc
${CMAKE_CURRENT_SOURCE_DIR}/runtime/allocator.cc
${CMAKE_CURRENT_SOURCE_DIR}/runtime/runtime_api.cc
${CMAKE_CURRENT_SOURCE_DIR}/runtime/thread_pool.cc
${CMAKE_CURRENT_SOURCE_DIR}/runtime/thread_pool.c
${CMAKE_CURRENT_SOURCE_DIR}/runtime/workspace_pool.cc
${CMAKE_CURRENT_SOURCE_DIR}/ir/tensor.cc
${CMAKE_CURRENT_SOURCE_DIR}/context.cc

View File

@ -247,7 +247,6 @@ std::vector<mindspore::tensor::MSTensor *> LiteSession::GetInputs() const { retu
int LiteSession::RunGraph(const session::KernelCallBack &before, const session::KernelCallBack &after) {
MS_EXCEPTION_IF_NULL(this->context_);
SetMaxWokerNum(context_->thread_num_);
if (before == nullptr && after == nullptr) {
return executor->Run(this->inputs_, this->outputs_, this->kernels_, this->context_->allocator.get());
} else {
@ -264,7 +263,7 @@ int LiteSession::Init(Context *context) {
}
this->context_->float16_priority = context->float16_priority;
this->context_->cpu_bind_mode_ = context->cpu_bind_mode_;
ConfigThreadPool(context->cpu_bind_mode_, context->thread_num_);
ConfigThreadPool(THREAD_POOL_DEFAULT, context->thread_num_, context->cpu_bind_mode_);
auto ret = KernelRegistry::GetInstance()->Init();
if (ret != RET_OK) {
MS_LOG(ERROR) << "KernelRegistry Init Failed.";
@ -283,7 +282,7 @@ int LiteSession::Init(Context *context) {
void LiteSession::BindThread(bool if_bind) {
if (this->context_->cpu_bind_mode_ != NO_BIND) {
DoAllThreadBind(if_bind, static_cast<int>(this->context_->cpu_bind_mode_));
BindThreads(THREAD_POOL_DEFAULT, if_bind, this->context_->cpu_bind_mode_);
}
}

View File

@ -153,7 +153,7 @@ int PriorBoxCPUKernel::PriorBoxImpl(int task_id) {
return ret;
}
int RunPriorBox(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int RunPriorBox(void *cdata, int task_id) {
auto prior_box = reinterpret_cast<PriorBoxCPUKernel *>(cdata);
auto error_code = prior_box->PriorBoxImpl(task_id);
@ -170,7 +170,7 @@ int PriorBoxCPUKernel::Run() {
MS_LOG(ERROR) << "Prepare fail! Ret error code[" << prepare_ret << "]";
return prepare_ret;
}
int error_code = LiteBackendParallelLaunch(RunPriorBox, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, RunPriorBox, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "PriorBox run error, error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -95,7 +95,7 @@ int QuantDTypeCastCPUKernel::QuantDTypeCast(int task_id) {
return RET_OK;
}
int QuantDTypeCastRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int QuantDTypeCastRun(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<QuantDTypeCastCPUKernel *>(cdata);
auto ret = g_kernel->QuantDTypeCast(task_id);
if (ret != RET_OK) {
@ -119,7 +119,7 @@ int QuantDTypeCastCPUKernel::Run() {
int8_ptr_ = reinterpret_cast<int8_t *>(out_tensors_[0]->Data());
}
auto ret = LiteBackendParallelLaunch(QuantDTypeCastRun, this, thread_n_num_);
auto ret = ParallelLaunch(THREAD_POOL_DEFAULT, QuantDTypeCastRun, this, thread_n_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "Scale error error_code[" << ret << "]";
return RET_ERROR;

View File

@ -92,7 +92,7 @@ int ActivationFp16CPUKernel::DoActivation(int task_id) {
return error_code;
}
int ActivationRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ActivationRun(void *cdata, int task_id) {
auto activation_kernel = reinterpret_cast<ActivationFp16CPUKernel *>(cdata);
auto error_code = activation_kernel->DoActivation(task_id);
if (error_code != RET_OK) {
@ -115,7 +115,7 @@ int ActivationFp16CPUKernel::Run() {
return ret;
}
int error_code = LiteBackendParallelLaunch(ActivationRun, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ActivationRun, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Activation function error error_code[" << error_code << "]";
FreeTmpBuffer();

View File

@ -362,7 +362,7 @@ int ArithmeticFP16CPUKernel::DoArithmetic(int task_id) {
return RET_OK;
}
static int ArithmeticsRun_Fp16(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int ArithmeticsRun_Fp16(void *cdata, int task_id) {
auto arithmetic_kernel = reinterpret_cast<ArithmeticFP16CPUKernel *>(cdata);
auto error_code = arithmetic_kernel->DoArithmetic(task_id);
if (error_code != RET_OK) {
@ -413,7 +413,7 @@ int ArithmeticFP16CPUKernel::Run() {
Float32ToFloat16(reinterpret_cast<float *>(in_tensors_[1]->Data()), input1_fp16_,
arithmeticParameter_->in_elements_num1_);
}
ret = LiteBackendParallelLaunch(ArithmeticsRun_Fp16, this, context_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ArithmeticsRun_Fp16, this, context_->thread_num_);
return ret;
}

View File

@ -65,7 +65,7 @@ int BatchnormFp16CPUKernel::Run() {
input_ = in_tensors_.at(0)->Data();
output_ = out_tensors_.at(0)->Data();
}
ret = LiteBackendParallelLaunch(BatchNormRun, this, op_parameter_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, BatchNormRun, this, op_parameter_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "BatchnormRun error error_code[" << ret << "]";
}

View File

@ -30,13 +30,13 @@ using mindspore::schema::PrimitiveType_Cast;
namespace mindspore::kernel {
namespace {
int CastRun(int thread_id, LiteParallelGroupEnv *penv, void *cdata) {
int CastRun(void *cdata, int task_id) {
if (cdata == nullptr) {
MS_LOG(ERROR) << "input cdata is nullptr!";
return RET_ERROR;
}
return reinterpret_cast<CastFp16CPUKernel *>(cdata)->DoCast(thread_id);
return reinterpret_cast<CastFp16CPUKernel *>(cdata)->DoCast(task_id);
}
} // namespace
@ -91,7 +91,7 @@ int CastFp16CPUKernel::Run() {
if (data_num_ == 0) {
return RET_OK;
}
return LiteBackendParallelLaunch(CastRun, this, op_parameter_->thread_num_);
return ParallelLaunch(THREAD_POOL_DEFAULT, CastRun, this, op_parameter_->thread_num_);
}
kernel::LiteKernel *CpuCastFp16KernelCreator(const std::vector<lite::tensor::Tensor *> &inputs,

View File

@ -194,7 +194,7 @@ int Convolution1x1FP16CPUKernel::RunImpl(int task_id) {
return RET_OK;
}
static int Convolution1x1Fp16Impl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int Convolution1x1Fp16Impl(void *cdata, int task_id) {
auto conv = reinterpret_cast<Convolution1x1FP16CPUKernel *>(cdata);
auto error_code = conv->RunImpl(task_id);
if (error_code != RET_OK) {
@ -222,7 +222,7 @@ int Convolution1x1FP16CPUKernel::Run() {
execute_input_ + batch_index * conv_param_->input_h_ * conv_param_->input_w_ * conv_param_->input_channel_,
execute_output_ + batch_index * matmul_param_->row_ * matmul_param_->col_);
int error_code = LiteBackendParallelLaunch(Convolution1x1Fp16Impl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, Convolution1x1Fp16Impl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "conv1x1 fp16 error error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -197,7 +197,7 @@ int Convolution3x3FP16CPUKernel::RunImpl(int task_id) {
return RET_OK;
}
static int Convolution3x3Fp16Impl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int Convolution3x3Fp16Impl(void *cdata, int task_id) {
auto conv = reinterpret_cast<Convolution3x3FP16CPUKernel *>(cdata);
auto error_code = conv->RunImpl(task_id);
if (error_code != RET_OK) {
@ -251,7 +251,7 @@ int Convolution3x3FP16CPUKernel::Run() {
int in_channel = conv_param_->input_channel_;
PackNHWCToNHWC8Fp16(reinterpret_cast<void *>(execute_input_), nhwc4_input_, in_batch, in_h * in_w, in_channel);
int error_code = LiteBackendParallelLaunch(Convolution3x3Fp16Impl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, Convolution3x3Fp16Impl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "conv3x3 fp16 error error_code[" << error_code << "]";
FreeTmpBuffer();

View File

@ -98,7 +98,7 @@ int ConvolutionDepthwiseFp16CPUKernel::Execute(int task_id) {
return RET_OK;
}
static int ConvDwFp16Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int ConvDwFp16Run(void *cdata, int task_id) {
auto conv_dw_fp16 = reinterpret_cast<ConvolutionDepthwiseFp16CPUKernel *>(cdata);
auto ret = conv_dw_fp16->Execute(task_id);
if (ret != RET_OK) {
@ -125,7 +125,7 @@ int ConvolutionDepthwiseFp16CPUKernel::Run() {
return ret;
}
ret = LiteBackendParallelLaunch(ConvDwFp16Run, this, conv_param_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ConvDwFp16Run, this, conv_param_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "ConvDwFp16Run error: error_code[" << ret << "]";
return RET_ERROR;

View File

@ -129,7 +129,7 @@ int ConvolutionDepthwiseSWFp16CPUKernel::Execute(int task_id) {
return RET_OK;
}
static int ConvDwSWFp16Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int ConvDwSWFp16Run(void *cdata, int task_id) {
auto conv_dw_fp16 = reinterpret_cast<ConvolutionDepthwiseSWFp16CPUKernel *>(cdata);
auto ret = conv_dw_fp16->Execute(task_id);
if (ret != RET_OK) {
@ -171,7 +171,7 @@ int ConvolutionDepthwiseSWFp16CPUKernel::Run() {
packed_output_ = execute_output_;
}
ret = LiteBackendParallelLaunch(ConvDwSWFp16Run, this, conv_param_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ConvDwSWFp16Run, this, conv_param_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "ConvDwSWFp16Run error: error_code[" << ret << "]";
return RET_ERROR;

View File

@ -177,7 +177,7 @@ int ConvolutionFP16CPUKernel::RunImpl(int task_id) {
return RET_OK;
}
static int ConvolutionFp16Impl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int ConvolutionFp16Impl(void *cdata, int task_id) {
auto conv = reinterpret_cast<ConvolutionFP16CPUKernel *>(cdata);
auto error_code = conv->RunImpl(task_id);
if (error_code != RET_OK) {
@ -206,7 +206,7 @@ int ConvolutionFP16CPUKernel::Run() {
int in_channel = conv_param_->input_channel_;
convert_func_(reinterpret_cast<void *>(execute_input_), nhwc4_input_, in_batch, in_h * in_w, in_channel);
int error_code = LiteBackendParallelLaunch(ConvolutionFp16Impl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ConvolutionFp16Impl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "conv fp16 error error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -186,7 +186,7 @@ int ConvolutionSWFP16CPUKernel::RunImpl(int task_id) {
return RET_OK;
}
static int ConvolutionSWFp16Impl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int ConvolutionSWFp16Impl(void *cdata, int task_id) {
auto conv = reinterpret_cast<ConvolutionSWFP16CPUKernel *>(cdata);
auto error_code = conv->RunImpl(task_id);
if (error_code != RET_OK) {
@ -219,7 +219,7 @@ int ConvolutionSWFP16CPUKernel::Run() {
int in_channel = conv_param_->input_channel_;
convert_func_(reinterpret_cast<void *>(execute_input_), nhwc4_input_, in_batch, in_h * in_w, in_channel);
int error_code = LiteBackendParallelLaunch(ConvolutionSWFp16Impl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ConvolutionSWFp16Impl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "conv fp16 error error_code[" << error_code << "]";
FreeTmpBuffer();

View File

@ -347,7 +347,7 @@ int ConvolutionWinogradFP16CPUKernel::RunImpl(int task_id) {
return RET_OK;
}
static int ConvolutionWinogradFp16Impl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int ConvolutionWinogradFp16Impl(void *cdata, int task_id) {
auto conv = reinterpret_cast<ConvolutionWinogradFP16CPUKernel *>(cdata);
auto error_code = conv->RunImpl(task_id);
if (error_code != RET_OK) {
@ -404,7 +404,7 @@ int ConvolutionWinogradFP16CPUKernel::Run() {
int in_channel = conv_param_->input_channel_;
PackNHWCToNHWC8Fp16(execute_input_, nhwc4_input_, in_batch, in_h * in_w, in_channel);
int error_code = LiteBackendParallelLaunch(ConvolutionWinogradFp16Impl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ConvolutionWinogradFp16Impl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "conv winograd error error_code[" << error_code << "]";
FreeTmpBuffer();

View File

@ -137,7 +137,7 @@ int DeconvolutionDepthwiseFp16CPUKernel::Execute(int task_id) {
return RET_OK;
}
static int DeconvDwFp16Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int DeconvDwFp16Run(void *cdata, int task_id) {
auto deconv_dw_fp16 = reinterpret_cast<DeconvolutionDepthwiseFp16CPUKernel *>(cdata);
auto ret = deconv_dw_fp16->Execute(task_id);
if (ret != RET_OK) {
@ -178,7 +178,7 @@ int DeconvolutionDepthwiseFp16CPUKernel::Run() {
if (!need_align_) {
packed_output_ = execute_output_;
}
ret = LiteBackendParallelLaunch(DeconvDwFp16Run, this, conv_param_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, DeconvDwFp16Run, this, conv_param_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "DeconvDwFp16Run error: error_code[" << ret << "]";
return RET_ERROR;

View File

@ -137,7 +137,7 @@ void DeConvolutionFp16CPUKernel::FreeRunBuf() {
return;
}
static int DeConvFp16Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int DeConvFp16Run(void *cdata, int task_id) {
auto deconv = reinterpret_cast<DeConvolutionFp16CPUKernel *>(cdata);
auto error_code = deconv->DoDeconv(task_id);
if (error_code != RET_OK) {
@ -188,7 +188,7 @@ int DeConvolutionFp16CPUKernel::Run() {
for (int batch_index = 0; batch_index < conv_param_->input_batch_; batch_index++) {
RowMajor2Col16MajorFp16(execute_input_, pack_input_, input_plane_, conv_param_->input_channel_);
error_code = LiteBackendParallelLaunch(DeConvFp16Run, this, thread_count_);
error_code = ParallelLaunch(THREAD_POOL_DEFAULT, DeConvFp16Run, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "deconv fp32 run error! error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -89,7 +89,7 @@ int PoolingFp16CPUKernel::RunImpl(int task_id) {
return RET_OK;
}
static int PoolingFp16Impl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int PoolingFp16Impl(void *cdata, int task_id) {
auto pooling = reinterpret_cast<PoolingFp16CPUKernel *>(cdata);
auto error_code = pooling->RunImpl(task_id);
if (error_code != RET_OK) {
@ -109,7 +109,7 @@ int PoolingFp16CPUKernel::Run() {
auto input_ptr = reinterpret_cast<float *>(in_tensors_.at(kInputIndex)->Data());
Float32ToFloat16(input_ptr, fp16_input_, ele_num);
int error_code = LiteBackendParallelLaunch(PoolingFp16Impl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, PoolingFp16Impl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "pooling error error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -67,7 +67,7 @@ int ReduceFp16CPUKernel::CallReduceUnit(int task_id) {
return ret;
}
static int ReduceImpl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int ReduceImpl(void *cdata, int task_id) {
auto reduce = reinterpret_cast<ReduceFp16CPUKernel *>(cdata);
auto error_code = reduce->CallReduceUnit(task_id);
if (error_code != RET_OK) {
@ -112,7 +112,7 @@ int ReduceFp16CPUKernel::Run() {
inner_size_ *= tmp_shape_[k];
}
axis_size_ = tmp_shape_[axis];
auto error_code = LiteBackendParallelLaunch(ReduceImpl, this, context_->thread_num_);
auto error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ReduceImpl, this, context_->thread_num_);
if (error_code != RET_OK) {
FreeTmpBuffer();
MS_LOG(ERROR) << "Reduce run error, error_code[" << error_code << "]";

View File

@ -63,7 +63,7 @@ int SplitFp16CPUKernel::Split(int task_id) {
return RET_OK;
}
static int SplitRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int SplitRun(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<SplitFp16CPUKernel *>(cdata);
auto ret = g_kernel->Split(task_id);
if (ret != RET_OK) {
@ -97,7 +97,7 @@ int SplitFp16CPUKernel::Run() {
output_ptr_[i] = reinterpret_cast<float16_t *>(out_tensors_.at(i)->Data());
}
}
ret = LiteBackendParallelLaunch(SplitRun, this, thread_n_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, SplitRun, this, thread_n_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "split error error_code[" << ret << "]";
return RET_ERROR;

View File

@ -117,7 +117,7 @@ int TransposeFp16CPUKernel::TransposeParallel(int task_id) {
return RET_OK;
}
static int TransposeRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
static int TransposeRun(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<TransposeFp16CPUKernel *>(cdata);
auto ret = g_kernel->TransposeParallel(task_id);
if (ret != RET_OK) {
@ -162,7 +162,7 @@ int TransposeFp16CPUKernel::Run() {
in_shape_ = const_cast<int *>(in_tensor->shape().data());
out_shape_ = const_cast<int *>(out_tensor->shape().data());
ret = LiteBackendParallelLaunch(TransposeRun, this, thread_h_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, TransposeRun, this, thread_h_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "Tranpose error error_code[" << ret << "]";
FreeFp16Buffer();

View File

@ -67,7 +67,7 @@ int ActivationCPUKernel::DoActivation(int task_id) {
return RET_OK;
}
int ActivationRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ActivationRun(void *cdata, int task_id) {
auto activation_kernel = reinterpret_cast<ActivationCPUKernel *>(cdata);
auto error_code = activation_kernel->DoActivation(task_id);
if (error_code != RET_OK) {
@ -83,7 +83,7 @@ int ActivationCPUKernel::Run() {
MS_LOG(ERROR) << "Prepare failed.";
return ret;
}
int error_code = LiteBackendParallelLaunch(ActivationRun, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ActivationRun, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Activation function error error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -28,13 +28,13 @@ using mindspore::schema::PrimitiveType_AddN;
namespace mindspore::kernel {
namespace {
int AddNLaunch(int thread_id, LiteParallelGroupEnv *penv, void *cdata) {
int AddNLaunch(void *cdata, int task_id) {
if (cdata == nullptr) {
MS_LOG(ERROR) << "Input cdata is nullptr!";
return RET_NULL_PTR;
}
auto kernel = reinterpret_cast<AddNCPUKernel *>(cdata);
return kernel->AddNParallelRun(thread_id);
return kernel->AddNParallelRun(task_id);
}
} // namespace
@ -74,7 +74,7 @@ int AddNCPUKernel::Run() {
in1_addr_ = input0_data;
in2_addr_ = input1_data;
out_addr_ = output_data;
ret = LiteBackendParallelLaunch(AddNLaunch, this, op_parameter_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, AddNLaunch, this, op_parameter_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "addn launch fail!ret: " << ret;
return RET_ERROR;
@ -82,7 +82,7 @@ int AddNCPUKernel::Run() {
for (size_t i = 2; i < in_tensors_.size(); ++i) {
in1_addr_ = reinterpret_cast<float *>(in_tensors_[i]->Data());
in2_addr_ = output_data;
ret = LiteBackendParallelLaunch(AddNLaunch, this, op_parameter_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, AddNLaunch, this, op_parameter_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "addn launch fail!ret: " << ret << ", input index: " << i;
return RET_ERROR;

View File

@ -163,7 +163,7 @@ int ArithmeticCPUKernel::DoArithmetic(int task_id) {
return RET_OK;
}
int ArithmeticsRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ArithmeticsRun(void *cdata, int task_id) {
auto arithmetic_kernel = reinterpret_cast<ArithmeticCPUKernel *>(cdata);
auto error_code = arithmetic_kernel->DoArithmetic(task_id);
if (error_code != RET_OK) {
@ -193,7 +193,7 @@ int ArithmeticCPUKernel::Run() {
ComputeStrides(arithmeticParameter_->out_shape_, arithmeticParameter_->out_strides_, arithmeticParameter_->ndim_);
}
int error_code = LiteBackendParallelLaunch(ArithmeticsRun, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ArithmeticsRun, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Arithmetic function error error_code[" << error_code << "]";

View File

@ -41,7 +41,7 @@ int ArithmeticSelfCPUKernel::ReSize() {
return RET_OK;
}
int ArithmeticSelfRuns(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ArithmeticSelfRuns(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<ArithmeticSelfCPUKernel *>(cdata);
auto ret = g_kernel->DoArithmeticSelf(task_id);
if (ret != RET_OK) {
@ -80,7 +80,7 @@ int ArithmeticSelfCPUKernel::Run() {
auto out_tensor = out_tensors_.at(0);
in_ptr_ = reinterpret_cast<float *>(input_tensor->Data());
out_ptr_ = reinterpret_cast<float *>(out_tensor->Data());
ret = LiteBackendParallelLaunch(ArithmeticSelfRuns, this, thread_sz_count_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ArithmeticSelfRuns, this, thread_sz_count_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "ArithmeticSelfRun error error_code[" << ret << "]";
return ret;

View File

@ -75,7 +75,7 @@ int BatchnormCPUKernel::Run() {
MS_LOG(ERROR) << "Prepare fail! Ret error code: " << ret;
return ret;
}
ret = LiteBackendParallelLaunch(BatchNormRun, this, op_parameter_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, BatchNormRun, this, op_parameter_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "BatchnormRun error error_code[" << ret << "]";
}
@ -88,7 +88,7 @@ int BatchnormCPUKernel::DoExecute(int task_id) {
return mindspore::lite::RET_OK;
}
int BatchNormRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int BatchNormRun(void *cdata, int task_id) {
auto kernel = reinterpret_cast<BatchnormCPUKernel *>(cdata);
auto ret = kernel->DoExecute(task_id);
if (ret != RET_OK) {

View File

@ -48,7 +48,7 @@ class BatchnormCPUKernel : public LiteKernel {
void *variance_ = nullptr;
};
int BatchNormRun(int task_id, LiteParallelGroupEnv *penv, void *cdata);
int BatchNormRun(void *cdata, int task_id);
} // namespace mindspore::kernel
#endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_FP32_BATCHNORM_H_

View File

@ -30,13 +30,13 @@ using mindspore::schema::PrimitiveType_Cast;
namespace mindspore::kernel {
namespace {
int CastRun(int thread_id, LiteParallelGroupEnv *penv, void *cdata) {
int CastRun(void *cdata, int task_id) {
if (cdata == nullptr) {
MS_LOG(ERROR) << "input cdata is nullptr!";
return RET_ERROR;
}
return reinterpret_cast<CastCPUKernel *>(cdata)->DoCast(thread_id);
return reinterpret_cast<CastCPUKernel *>(cdata)->DoCast(task_id);
}
} // namespace
@ -111,7 +111,7 @@ int CastCPUKernel::Run() {
if (data_num_ == 0) {
return RET_OK;
}
return LiteBackendParallelLaunch(CastRun, this, op_parameter_->thread_num_);
return ParallelLaunch(THREAD_POOL_DEFAULT, CastRun, this, op_parameter_->thread_num_);
}
kernel::LiteKernel *CpuCastFp32KernelCreator(const std::vector<lite::tensor::Tensor *> &inputs,

View File

@ -41,7 +41,7 @@ int ConstantOfShapeCPUKernel::DoExecute(int task_id) {
return RET_OK;
}
int ConstantOfShapeRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ConstantOfShapeRun(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<ConstantOfShapeCPUKernel *>(cdata);
auto ret = g_kernel->DoExecute(task_id);
if (ret != RET_OK) {
@ -62,7 +62,7 @@ int ConstantOfShapeCPUKernel::Run() {
param_->unit_ = UP_DIV(param_->element_sz_, thread_num);
param_->op_parameter_.thread_num_ = thread_num;
out_ptr_ = reinterpret_cast<float *>(out_tensors_.front()->Data());
auto ret = LiteBackendParallelLaunch(ConstantOfShapeRun, this, thread_num);
auto ret = ParallelLaunch(THREAD_POOL_DEFAULT, ConstantOfShapeRun, this, thread_num);
if (ret != RET_OK) {
MS_LOG(ERROR) << "ConstantOfShapeRun error error_code[" << ret << "]";
return ret;

View File

@ -172,7 +172,7 @@ int ConvolutionCPUKernel::RunImpl(int task_id) {
return RET_OK;
}
int ConvolutionImpl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ConvolutionImpl(void *cdata, int task_id) {
auto conv = reinterpret_cast<ConvolutionCPUKernel *>(cdata);
auto error_code = conv->RunImpl(task_id);
if (error_code != RET_OK) {
@ -200,7 +200,7 @@ int ConvolutionCPUKernel::Run() {
PackNHWCToNHWC4Fp32(ori_input_data, nhwc4_input_, conv_param_->input_batch_,
conv_param_->input_h_ * conv_param_->input_w_, conv_param_->input_channel_);
int error_code = LiteBackendParallelLaunch(ConvolutionImpl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ConvolutionImpl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "conv error error_code[" << error_code << "]";
FreeTmpBuffer();

View File

@ -149,7 +149,7 @@ int Convolution1x1CPUKernel::DoConv1x1(int task_id) {
return RET_OK;
}
int Convolution1x1Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int Convolution1x1Run(void *cdata, int task_id) {
auto conv1x1 = reinterpret_cast<Convolution1x1CPUKernel *>(cdata);
auto error_code = conv1x1->DoConv1x1(task_id);
if (error_code != RET_OK) {
@ -179,7 +179,7 @@ int Convolution1x1CPUKernel::Run() {
Pre1x1Trans(src_in + batch_index * conv_param_->input_h_ * conv_param_->input_w_ * conv_param_->input_channel_,
src_out + batch_index * matmul_param_->row_ * matmul_param_->col_);
int error_code = LiteBackendParallelLaunch(Convolution1x1Run, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, Convolution1x1Run, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "conv1x1 strassen error error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -208,7 +208,7 @@ int Convolution3x3CPUKernel::RunImpl(int task_id) {
return RET_OK;
}
int Convolution3x3Impl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int Convolution3x3Impl(void *cdata, int task_id) {
auto conv3x3 = reinterpret_cast<Convolution3x3CPUKernel *>(cdata);
auto error_code = conv3x3->RunImpl(task_id);
if (error_code != RET_OK) {
@ -258,7 +258,7 @@ int Convolution3x3CPUKernel::Run() {
PackNHWCToNHWC4Fp32(ori_input_data, nhwc4_input_, conv_param_->input_batch_,
conv_param_->input_h_ * conv_param_->input_w_, conv_param_->input_channel_);
int error_code = LiteBackendParallelLaunch(Convolution3x3Impl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, Convolution3x3Impl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "conv3x3 error error_code[" << error_code << "]";
FreeTmpBuffer();

View File

@ -89,7 +89,7 @@ int ConvolutionDepthwiseCPUKernel::Execute(int task_id) {
return RET_OK;
}
int ConvDwRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ConvDwRun(void *cdata, int task_id) {
auto conv_dw = reinterpret_cast<ConvolutionDepthwiseCPUKernel *>(cdata);
auto ret = conv_dw->Execute(task_id);
if (ret != RET_OK) {
@ -116,7 +116,7 @@ int ConvolutionDepthwiseCPUKernel::Run() {
auto output_tensor = out_tensors_.at(kOutputIndex);
output_ptr_ = reinterpret_cast<float *>(output_tensor->Data());
ret = LiteBackendParallelLaunch(ConvDwRun, this, conv_param_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ConvDwRun, this, conv_param_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "ConvDwRun error: error_code[" << ret << "]";
return RET_ERROR;

View File

@ -123,7 +123,7 @@ int ConvolutionDepthwiseSWCPUKernel::Execute(int task_id) {
return RET_OK;
}
int ConvDwSWRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ConvDwSWRun(void *cdata, int task_id) {
auto conv_dw = reinterpret_cast<ConvolutionDepthwiseSWCPUKernel *>(cdata);
auto ret = conv_dw->Execute(task_id);
if (ret != RET_OK) {
@ -167,7 +167,7 @@ int ConvolutionDepthwiseSWCPUKernel::Run() {
packed_output_ = output_ptr;
}
ret = LiteBackendParallelLaunch(ConvDwSWRun, this, conv_param_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ConvDwSWRun, this, conv_param_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "ConvDwSWRun error: error_code[" << ret << "]";
return RET_ERROR;

View File

@ -159,7 +159,7 @@ int ConvolutionSWCPUKernel::RunImpl(int task_id) {
return RET_OK;
}
int ConvolutionSWImpl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ConvolutionSWImpl(void *cdata, int task_id) {
auto conv = reinterpret_cast<ConvolutionSWCPUKernel *>(cdata);
auto error_code = conv->RunImpl(task_id);
if (error_code != RET_OK) {
@ -187,7 +187,7 @@ int ConvolutionSWCPUKernel::Run() {
PackNHWCToNHWC4Fp32(ori_input_data, nhwc4_input_, conv_param_->input_batch_,
conv_param_->input_h_ * conv_param_->input_w_, conv_param_->input_channel_);
int error_code = LiteBackendParallelLaunch(ConvolutionSWImpl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ConvolutionSWImpl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "conv error error_code[" << error_code << "]";
FreeTmpBuffer();

View File

@ -338,7 +338,7 @@ int ConvolutionWinogradCPUKernel::RunImpl(int task_id) {
return RET_OK;
}
int ConvolutionWinogradImpl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ConvolutionWinogradImpl(void *cdata, int task_id) {
auto conv = reinterpret_cast<ConvolutionWinogradCPUKernel *>(cdata);
auto error_code = conv->RunImpl(task_id);
if (error_code != RET_OK) {
@ -390,7 +390,7 @@ int ConvolutionWinogradCPUKernel::Run() {
PackNHWCToNHWC4Fp32(ori_input_data, nhwc4_input_, conv_param_->input_batch_,
conv_param_->input_h_ * conv_param_->input_w_, conv_param_->input_channel_);
int error_code = LiteBackendParallelLaunch(ConvolutionWinogradImpl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ConvolutionWinogradImpl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "conv winograd error error_code[" << error_code << "]";
FreeTmpBuffer();

View File

@ -30,13 +30,13 @@ using mindspore::schema::PrimitiveType_Crop;
namespace mindspore::kernel {
namespace {
int CropLaunch(int thread_id, LiteParallelGroupEnv *penv, void *cdata) {
int CropLaunch(void *cdata, int task_id) {
if (cdata == nullptr) {
MS_LOG(ERROR) << "Input cdata is nullptr!";
return RET_NULL_PTR;
}
auto kernel = reinterpret_cast<CropCPUKernel *>(cdata);
return kernel->CropParallelRun(thread_id);
return kernel->CropParallelRun(task_id);
}
} // namespace
@ -68,7 +68,7 @@ int CropCPUKernel::Run() {
return RET_OK;
}
auto ret = LiteBackendParallelLaunch(CropLaunch, this, param->op_parameter_.thread_num_);
auto ret = ParallelLaunch(THREAD_POOL_DEFAULT, CropLaunch, this, param->op_parameter_.thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "Crop launch fail!ret: " << ret;
return RET_ERROR;

View File

@ -109,7 +109,7 @@ int DeConvolutionCPUKernel::InitParam() {
return RET_OK;
}
int DeConvFp32Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int DeConvFp32Run(void *cdata, int task_id) {
auto deconv = reinterpret_cast<DeConvolutionCPUKernel *>(cdata);
auto error_code = deconv->DoDeconv(task_id);
if (error_code != RET_OK) {
@ -194,7 +194,7 @@ int DeConvolutionCPUKernel::Run() {
RowMajor2Col12Major(input_ptr_, pack_input_, input_plane_, conv_param_->input_channel_);
error_code = LiteBackendParallelLaunch(DeConvFp32Run, this, thread_count_);
error_code = ParallelLaunch(THREAD_POOL_DEFAULT, DeConvFp32Run, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "deconv fp32 run error! error_code[" << error_code << "]";
return error_code;

View File

@ -134,7 +134,7 @@ int DeconvolutionDepthwiseCPUKernel::Execute(int task_id) {
return RET_OK;
}
int DeconvDwRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int DeconvDwRun(void *cdata, int task_id) {
auto deconv_dw = reinterpret_cast<DeconvolutionDepthwiseCPUKernel *>(cdata);
auto ret = deconv_dw->Execute(task_id);
if (ret != RET_OK) {
@ -178,7 +178,7 @@ int DeconvolutionDepthwiseCPUKernel::Run() {
packed_output_ = output_addr;
}
ret = LiteBackendParallelLaunch(DeconvDwRun, this, conv_param_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, DeconvDwRun, this, conv_param_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "DeconvDwRun error: error_code[" << ret << "]";
return RET_ERROR;

View File

@ -46,7 +46,7 @@ int EluCPUKernel::DoExcute(int task_id) {
return RET_OK;
}
int EluRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int EluRun(void *cdata, int task_id) {
auto EluData = reinterpret_cast<EluCPUKernel *>(cdata);
auto ret = EluData->DoExcute(task_id);
if (ret != RET_OK) {
@ -65,7 +65,7 @@ int EluCPUKernel::Run() {
input_addr = reinterpret_cast<float *>(in_tensors_.front()->Data());
output_addr = reinterpret_cast<float *>(out_tensors_.front()->Data());
auto ret = LiteBackendParallelLaunch(EluRun, this, elu_parameter_->thread_num_);
auto ret = ParallelLaunch(THREAD_POOL_DEFAULT, EluRun, this, elu_parameter_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "Elu error: error_code[" << ret << "]";
return RET_ERROR;

View File

@ -61,7 +61,7 @@ int EmbeddingLookupCPUKernel::DoExcute(int task_id) {
return RET_OK;
}
int EmbeddingLookupRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int EmbeddingLookupRun(void *cdata, int task_id) {
auto EmbeddingLookupData = reinterpret_cast<EmbeddingLookupCPUKernel *>(cdata);
auto ret = EmbeddingLookupData->DoExcute(task_id);
if (ret != RET_OK) {
@ -102,7 +102,7 @@ int EmbeddingLookupCPUKernel::Run() {
output_addr_ = reinterpret_cast<float *>(out_tensors_.front()->Data());
ids_addr_ = reinterpret_cast<int *>(in_tensors_.back()->Data());
auto ret = LiteBackendParallelLaunch(EmbeddingLookupRun, this, embedding_lookup_parameter_->thread_num);
auto ret = ParallelLaunch(THREAD_POOL_DEFAULT, EmbeddingLookupRun, this, embedding_lookup_parameter_->thread_num);
context_->allocator->Free(input_addr_);
context_->allocator->Free(embedding_lookup_parameter_->is_regulated_);
if (ret != RET_OK) {

View File

@ -56,7 +56,7 @@ int ExpandDimsCPUKernel::DoExpandDims(int task_id) {
return RET_OK;
}
int ExpandDimsRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ExpandDimsRun(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<ExpandDimsCPUKernel *>(cdata);
auto ret = g_kernel->DoExpandDims(task_id);
if (ret != RET_OK) {
@ -74,7 +74,7 @@ int ExpandDimsCPUKernel::Run() {
}
in_ptr_ = reinterpret_cast<float *>(in_tensors_.at(0)->Data());
out_ptr_ = reinterpret_cast<float *>(out_tensors_.at(0)->Data());
auto ret = LiteBackendParallelLaunch(ExpandDimsRun, this, thread_sz_count_);
auto ret = ParallelLaunch(THREAD_POOL_DEFAULT, ExpandDimsRun, this, thread_sz_count_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "ExpandDimsRun error error_code[" << ret << "]";
return ret;

View File

@ -56,7 +56,7 @@ int FillCPUKernel::DoFill(int task_id) {
return RET_OK;
}
int FillRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int FillRun(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<FillCPUKernel *>(cdata);
auto ret = g_kernel->DoFill(task_id);
if (ret != RET_OK) {
@ -77,7 +77,7 @@ int FillCPUKernel::Run() {
auto fill_data = reinterpret_cast<float *>(fillData->Data());
src_data_ = fill_data[0];
out_ptr_ = reinterpret_cast<float *>(output->Data());
auto ret = LiteBackendParallelLaunch(FillRun, this, thread_sz_count_);
auto ret = ParallelLaunch(THREAD_POOL_DEFAULT, FillRun, this, thread_sz_count_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "FillRun error error_code[" << ret << "]";
return ret;

View File

@ -94,7 +94,7 @@ void FullconnectionCPUKernel::InitMatrixB(float *src_ptr, float *dst_ptr) {
RowMajor2Col8Major(src_ptr, dst_ptr, fc_param_->col_, fc_param_->deep_);
}
int FcFp32MatmulRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int FcFp32MatmulRun(void *cdata, int task_id) {
auto fc = reinterpret_cast<FullconnectionCPUKernel *>(cdata);
auto error_code = fc->DoMatmul(task_id);
if (error_code != RET_OK) {
@ -129,7 +129,7 @@ int FullconnectionCPUKernel::Run() {
if (!fc_param_->a_const_) InitMatrixA(a_ptr, a_c12_ptr_);
if (!fc_param_->b_const_) InitMatrixB(b_ptr, b_r8_ptr_);
LiteBackendParallelLaunch(FcFp32MatmulRun, this, thread_count_);
ParallelLaunch(THREAD_POOL_DEFAULT, FcFp32MatmulRun, this, thread_count_);
return RET_OK;
}

View File

@ -89,7 +89,7 @@ int GatherCPUKernel::DoGather(int task_id) {
return error_code;
}
int GatherRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int GatherRun(void *cdata, int task_id) {
auto gather_kernel = reinterpret_cast<GatherCPUKernel *>(cdata);
auto error_code = gather_kernel->DoGather(task_id);
if (error_code != RET_OK) {
@ -112,7 +112,7 @@ int GatherCPUKernel::Run() {
context_->allocator->Free(indices_data_);
return RET_ERROR;
}
int error_code = LiteBackendParallelLaunch(GatherRun, this, op_parameter_->thread_num_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, GatherRun, this, op_parameter_->thread_num_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Gather function error error_code[" << error_code << "]";
}

View File

@ -105,7 +105,7 @@ int GatherNdCPUKernel::DoGatherNd(int task_id) {
return RET_OK;
}
int GatherNdRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int GatherNdRun(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<GatherNdCPUKernel *>(cdata);
auto ret = g_kernel->DoGatherNd(task_id);
if (ret != RET_OK) {
@ -123,7 +123,7 @@ int GatherNdCPUKernel::Run() {
}
in_ptr_ = reinterpret_cast<float *>(in_tensors_.front()->Data());
out_ptr_ = reinterpret_cast<float *>(out_tensors_.front()->Data());
auto ret = LiteBackendParallelLaunch(GatherNdRun, this, thread_sz_count_);
auto ret = ParallelLaunch(THREAD_POOL_DEFAULT, GatherNdRun, this, thread_sz_count_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "gatherNd error error_code[" << ret << "]";
return ret;

View File

@ -30,7 +30,7 @@ using mindspore::schema::PrimitiveType_Prelu;
namespace mindspore::kernel {
namespace {
int LeakyReluRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int LeakyReluRun(void *cdata, int task_id) {
auto kernel_relu = reinterpret_cast<LeakyReluCPUKernel *>(cdata);
auto ret = kernel_relu->DoExcute(task_id);
if (ret != RET_OK) {
@ -66,7 +66,7 @@ int LeakyReluCPUKernel::Run() {
input_data = reinterpret_cast<float *>(input->Data());
output_data = reinterpret_cast<float *>(out_tensors_.at(0)->Data());
auto ret = LiteBackendParallelLaunch(LeakyReluRun, this, context_->thread_num_);
auto ret = ParallelLaunch(THREAD_POOL_DEFAULT, LeakyReluRun, this, context_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "PReluDwRun error: error_code[" << ret << "]";
return RET_ERROR;

View File

@ -63,7 +63,7 @@ int LocalResponseNormCPUKernel::DoLocalResponseNorm(int task_id) {
return RET_OK;
}
int LocalResponseNormRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int LocalResponseNormRun(void *cdata, int task_id) {
auto lrn = reinterpret_cast<LocalResponseNormCPUKernel *>(cdata);
auto error_code = lrn->DoLocalResponseNorm(task_id);
if (error_code != RET_OK) {
@ -79,7 +79,7 @@ int LocalResponseNormCPUKernel::Run() {
MS_LOG(ERROR) << "Prepare fail!ret: " << prepare_ret;
return prepare_ret;
}
int error_code = LiteBackendParallelLaunch(LocalResponseNormRun, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, LocalResponseNormRun, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "LocalResponseNorm function error error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -147,7 +147,7 @@ int MatmulCPUKernel::RunImpl(int task_id) {
return RET_OK;
}
int MatmulFloatRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int MatmulFloatRun(void *cdata, int task_id) {
auto op = reinterpret_cast<MatmulCPUKernel *>(cdata);
auto error_code = op->RunImpl(task_id);
if (error_code != RET_OK) {
@ -178,7 +178,7 @@ int MatmulCPUKernel::Run() {
a_ptr_ = a_c12_ptr_ + i * params_->row_12_ * params_->deep_;
b_ptr_ = b_r8_ptr_ + i * params_->deep_ * params_->col_8_;
c_ptr_ = c_src + i * params_->row_ * params_->col_;
LiteBackendParallelLaunch(MatmulFloatRun, this, thread_count_);
ParallelLaunch(THREAD_POOL_DEFAULT, MatmulFloatRun, this, thread_count_);
}
return RET_OK;
}

View File

@ -81,7 +81,7 @@ int OneHotCPUKernel::ReSize() {
return RET_OK;
}
int RunOneHot(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int RunOneHot(void *cdata, int task_id) {
auto onehot_kernel = reinterpret_cast<OneHotCPUKernel *>(cdata);
if (onehot_kernel == nullptr) {
MS_LOG(ERROR) << "cast OneHotCPUKernel failed";
@ -166,7 +166,7 @@ int OneHotCPUKernel::Run() {
MS_LOG(ERROR) << "Prepare fail!ret: " << prepare_ret;
return prepare_ret;
}
int error_code = LiteBackendParallelLaunch(RunOneHot, this, context_->thread_num_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, RunOneHot, this, context_->thread_num_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "OneHot function error error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -68,7 +68,7 @@ int PadCPUKernel::ReSize() {
return RET_OK;
}
int PadImpl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int PadImpl(void *cdata, int task_id) {
auto padKernel = reinterpret_cast<PadCPUKernel *>(cdata);
int error_code = padKernel->RunImpl(task_id);
if (error_code != NNACL_OK) {
@ -102,7 +102,7 @@ int PadCPUKernel::Run() {
auto output_data = reinterpret_cast<float *>(output->Data());
memset(output_data, 0, output_size * sizeof(float));
int error_code = LiteBackendParallelLaunch(PadImpl, this, context_->thread_num_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, PadImpl, this, context_->thread_num_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Pad run error, error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -78,7 +78,7 @@ int PoolingCPUKernel::RunImpl(int task_id) {
return RET_OK;
}
int PoolingImpl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int PoolingImpl(void *cdata, int task_id) {
auto pooling = reinterpret_cast<PoolingCPUKernel *>(cdata);
auto error_code = pooling->RunImpl(task_id);
if (error_code != RET_OK) {
@ -94,7 +94,7 @@ int PoolingCPUKernel::Run() {
MS_LOG(ERROR) << "Prepare fail!ret: " << prepare_ret;
return prepare_ret;
}
int error_code = LiteBackendParallelLaunch(PoolingImpl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, PoolingImpl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "pooling error error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -30,7 +30,7 @@ int PowerCPUKernel::Init() { return RET_OK; }
int PowerCPUKernel::ReSize() { return RET_OK; }
int PowerImpl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int PowerImpl(void *cdata, int task_id) {
auto kernel = reinterpret_cast<PowerCPUKernel *>(cdata);
auto ret = kernel->RunImpl(task_id);
if (ret != RET_OK) {
@ -46,7 +46,7 @@ int PowerCPUKernel::Run() {
MS_LOG(ERROR) << "Prepare fail!ret: " << prepare_ret;
return prepare_ret;
}
auto ret = LiteBackendParallelLaunch(PowerImpl, this, thread_count_);
auto ret = ParallelLaunch(THREAD_POOL_DEFAULT, PowerImpl, this, thread_count_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "PowerCPUKernel error: " << ret;
return RET_ERROR;

View File

@ -28,7 +28,7 @@ using mindspore::schema::PrimitiveType_CaffePReLU;
namespace mindspore::kernel {
namespace {
int PReluRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int PReluRun(void *cdata, int task_id) {
auto PRelu = reinterpret_cast<PReluCPUKernel *>(cdata);
auto ret = PRelu->DoExcute(task_id);
if (ret != RET_OK) {
@ -135,7 +135,7 @@ int PReluCPUKernel::Run() {
auto negative_slope_tensor = in_tensors_.at(1);
prelu_param_->slope_ = reinterpret_cast<float *>(negative_slope_tensor->Data());
auto ret = LiteBackendParallelLaunch(PReluRun, this, prelu_param_->op_parameter_.thread_num_);
auto ret = ParallelLaunch(THREAD_POOL_DEFAULT, PReluRun, this, prelu_param_->op_parameter_.thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "PRelu Run error: error_code[" << ret << "]";
context_->allocator->Free(input_data_);

View File

@ -95,7 +95,7 @@ int ReduceCPUKernel::CallReduceUnit(int task_id) {
return ret;
}
int ReduceImpl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ReduceImpl(void *cdata, int task_id) {
auto reduce = reinterpret_cast<ReduceCPUKernel *>(cdata);
auto error_code = reduce->CallReduceUnit(task_id);
if (error_code != RET_OK) {
@ -125,7 +125,7 @@ int ReduceCPUKernel::Run() {
inner_size_ *= tmp_shape_[k];
}
axis_size_ = tmp_shape_[axis];
auto error_code = LiteBackendParallelLaunch(ReduceImpl, this, context_->thread_num_);
auto error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ReduceImpl, this, context_->thread_num_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Reduce run error, error_code[" << error_code << "]";
return RET_ERROR;
@ -145,7 +145,7 @@ int ReduceCPUKernel::Run() {
}
axis_size_ = tmp_shape_[last_reduce_axis];
dst_data_ = reinterpret_cast<float *>(out_tensors_.at(0)->Data());
auto error_code = LiteBackendParallelLaunch(ReduceImpl, this, context_->thread_num_);
auto error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ReduceImpl, this, context_->thread_num_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Reduce run error, error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -38,7 +38,7 @@ int ResizeCPUKernel::Init() {
return ReSize();
}
int ResizeImpl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ResizeImpl(void *cdata, int task_id) {
auto resize = reinterpret_cast<ResizeCPUKernel *>(cdata);
auto error_code = resize->RunImpl(task_id);
if (error_code != RET_OK) {
@ -94,7 +94,7 @@ int ResizeCPUKernel::Run() {
MS_LOG(ERROR) << "Prepare failed.";
return RET_ERROR;
}
int error_code = LiteBackendParallelLaunch(ResizeImpl, this, context_->thread_num_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ResizeImpl, this, context_->thread_num_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Resize run error, error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -100,7 +100,7 @@ int ReverseCPUKernel::Init() {
return ret;
}
int ReverseRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ReverseRun(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<ReverseCPUKernel *>(cdata);
auto ret = g_kernel->DoReverse(task_id);
if (ret != RET_OK) {
@ -132,7 +132,7 @@ int ReverseCPUKernel::Run() {
}
in_ptr_ = reinterpret_cast<float *>(in_tensors_[0]->Data());
out_ptr_ = reinterpret_cast<float *>(out_tensors_[0]->Data());
ret = LiteBackendParallelLaunch(ReverseRun, this, thread_sz_count_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ReverseRun, this, thread_sz_count_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "Reverse run error error_code[" << ret << "]";
return ret;

View File

@ -72,7 +72,7 @@ int ROIPoolingCPUKernel::DoExecute(int task_id) {
return RET_OK;
}
int ROIPoolingRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ROIPoolingRun(void *cdata, int task_id) {
auto Data = reinterpret_cast<ROIPoolingCPUKernel *>(cdata);
auto ret = Data->DoExecute(task_id);
if (ret != RET_OK) {
@ -91,7 +91,7 @@ int ROIPoolingCPUKernel::Run() {
in_ptr_ = reinterpret_cast<float *>(in_tensors_.front()->Data());
out_ptr_ = reinterpret_cast<float *>(out_tensors_.front()->Data());
roi_ptr_ = reinterpret_cast<float *>(in_tensors_.at(1)->Data());
ret = LiteBackendParallelLaunch(ROIPoolingRun, this, param_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ROIPoolingRun, this, param_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "ROIPooling error: error_code[" << ret << "]";
return ret;

View File

@ -137,7 +137,7 @@ int ScaleCPUKernel::Scale(int task_id) {
return RET_OK;
}
int ScaleRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ScaleRun(void *cdata, int task_id) {
auto scale = reinterpret_cast<ScaleCPUKernel *>(cdata);
auto ret = scale->Scale(task_id);
if (ret != RET_OK) {
@ -162,7 +162,7 @@ int ScaleCPUKernel::Run() {
auto out_tensor = out_tensors_.front();
output_ptr_ = reinterpret_cast<float *>(out_tensor->Data());
ret = LiteBackendParallelLaunch(ScaleRun, this, op_parameter_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ScaleRun, this, op_parameter_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "Scale error error_code[" << ret << "]";
return RET_ERROR;

View File

@ -137,7 +137,7 @@ int ScatterNDCPUKernel::ScatterND(int task_id) {
return RET_OK;
}
int ScatterNDRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ScatterNDRun(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<ScatterNDCPUKernel *>(cdata);
auto ret = g_kernel->ScatterND(task_id);
if (ret != RET_OK) {
@ -153,7 +153,7 @@ int ScatterNDCPUKernel::Run() {
MS_LOG(ERROR) << "Prepare fail!ret: " << ret;
return ret;
}
ret = LiteBackendParallelLaunch(ScatterNDRun, this, thread_n_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ScatterNDRun, this, thread_n_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "ScatterND error error_code[" << ret << "]";
return RET_ERROR;

View File

@ -29,13 +29,13 @@ using mindspore::schema::PrimitiveType_Slice;
namespace mindspore::kernel {
namespace {
int SliceLaunch(int thread_id, LiteParallelGroupEnv *penv, void *cdata) {
int SliceLaunch(void *cdata, int task_id) {
if (cdata == nullptr) {
MS_LOG(ERROR) << "Input cdata is nullptr!";
return RET_NULL_PTR;
}
auto kernel = reinterpret_cast<SliceCPUKernel *>(cdata);
return kernel->SliceParallelRun(thread_id);
return kernel->SliceParallelRun(task_id);
}
} // namespace
@ -97,7 +97,7 @@ int SliceCPUKernel::Run() {
DoSliceNoParallel(input_data, output_data, param);
return RET_OK;
}
ret = LiteBackendParallelLaunch(SliceLaunch, this, param->op_parameter_.thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, SliceLaunch, this, param->op_parameter_.thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "slice launch fail!ret: " << ret;
return RET_ERROR;

View File

@ -74,7 +74,7 @@ int SpaceToDepthCPUKernel::SpaceToDepth(int task_id) {
return RET_OK;
}
int SpaceToDepthRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int SpaceToDepthRun(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<SpaceToDepthCPUKernel *>(cdata);
auto ret = g_kernel->SpaceToDepth(task_id);
if (ret != RET_OK) {
@ -93,7 +93,7 @@ int SpaceToDepthCPUKernel::Run() {
input_ptr_ = reinterpret_cast<float *>(in_tensors_[0]->Data());
output_ptr_ = reinterpret_cast<float *>(out_tensors_[0]->Data());
if (in_tensors_[0]->GetFormat() == schema::Format_NHWC) {
ret = LiteBackendParallelLaunch(SpaceToDepthRun, this, thread_h_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, SpaceToDepthRun, this, thread_h_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "SpaceToDepth error error_code[" << ret << "]";
return ret;

View File

@ -39,7 +39,7 @@ int SparseToDenseCPUKernel::DoExcute(int task_id) {
return RET_OK;
}
int SparseToDenseRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int SparseToDenseRun(void *cdata, int task_id) {
auto s2ddata = reinterpret_cast<SparseToDenseCPUKernel *>(cdata);
auto ret = s2ddata->DoExcute(task_id);
if (ret != RET_OK) {
@ -70,7 +70,7 @@ int SparseToDenseCPUKernel::Run() {
std::vector<int> temp_shape = output0->shape();
output_shape_ = reinterpret_cast<int *>(temp_shape.data());
ret = LiteBackendParallelLaunch(SparseToDenseRun, this, s2d_param_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, SparseToDenseRun, this, s2d_param_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "SparseToDenseRun error: error_code[" << ret << "]";
return RET_ERROR;

View File

@ -62,7 +62,7 @@ int SplitCPUKernel::Split(int task_id) {
return RET_OK;
}
int SplitRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int SplitRun(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<SplitCPUKernel *>(cdata);
auto ret = g_kernel->Split(task_id);
if (ret != RET_OK) {
@ -83,7 +83,7 @@ int SplitCPUKernel::Run() {
for (int i = 0; i < param->num_split_; i++) {
output_ptr_[i] = reinterpret_cast<float *>(out_tensors_.at(i)->Data());
}
ret = LiteBackendParallelLaunch(SplitRun, this, thread_n_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, SplitRun, this, thread_n_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "Scale error error_code[" << ret << "]";
return RET_ERROR;

View File

@ -72,7 +72,7 @@ int TransposeCPUKernel::TransposeParallel(int task_id) {
return RET_OK;
}
int TransposeRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int TransposeRun(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<TransposeCPUKernel *>(cdata);
auto ret = g_kernel->TransposeParallel(task_id);
if (ret != RET_OK) {
@ -101,7 +101,7 @@ int TransposeCPUKernel::Run() {
in_shape_ = const_cast<int *>(in_tensor->shape().data());
out_shape_ = const_cast<int *>(out_tensor->shape().data());
ret = LiteBackendParallelLaunch(TransposeRun, this, thread_h_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, TransposeRun, this, thread_h_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "Tranpose error error_code[" << ret << "]";
return ret;

View File

@ -55,7 +55,7 @@ int UnsqueezeCPUKernel::DoUnsqueeze(int task_id) {
return RET_OK;
}
int UnsqueezeRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int UnsqueezeRun(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<UnsqueezeCPUKernel *>(cdata);
auto ret = g_kernel->DoUnsqueeze(task_id);
if (ret != RET_OK) {
@ -73,7 +73,7 @@ int UnsqueezeCPUKernel::Run() {
}
in_ptr_ = reinterpret_cast<int8_t *>(in_tensors_.at(0)->Data());
out_ptr_ = reinterpret_cast<int8_t *>(out_tensors_.at(0)->Data());
ret = LiteBackendParallelLaunch(UnsqueezeRun, this, thread_sz_count_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, UnsqueezeRun, this, thread_sz_count_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "UnsqueezeRun error error_code[" << ret << "]";
return ret;

View File

@ -38,7 +38,7 @@ int WhereCPUKernel::DoExcute(int task_id) {
return RET_OK;
}
int WhereRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int WhereRun(void *cdata, int task_id) {
auto wheredata = reinterpret_cast<WhereCPUKernel *>(cdata);
auto ret = wheredata->DoExcute(task_id);
if (ret != RET_OK) {
@ -79,7 +79,7 @@ int WhereCPUKernel::Run() {
MS_LOG(ERROR) << "Error, inputs' length are zero !!!";
return RET_ERROR;
}
ret = LiteBackendParallelLaunch(WhereRun, this, where_param_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, WhereRun, this, where_param_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "WhereDwRun error: error_code[" << ret << "]";
return RET_ERROR;

View File

@ -70,7 +70,7 @@ int ActivationGradCPUKernel::DoActivation(int task_id) {
return RET_OK;
}
int ActivationGradRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ActivationGradRun(void *cdata, int task_id) {
auto activationGrad_kernel = reinterpret_cast<ActivationGradCPUKernel *>(cdata);
auto error_code = activationGrad_kernel->DoActivation(task_id);
if (error_code != RET_OK) {
@ -81,7 +81,7 @@ int ActivationGradRun(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
}
int ActivationGradCPUKernel::Run() {
int error_code = LiteBackendParallelLaunch(ActivationGradRun, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ActivationGradRun, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Activation function error error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -102,17 +102,17 @@ int QuantizedAddCPUKernel::Run() {
TileDimensionsUint8(static_cast<uint8_t *>(in_tensors_.at(0)->Data()),
static_cast<uint8_t *>(in_tensors_.at(1)->Data()), reinterpret_cast<uint8_t *>(input0_data_),
reinterpret_cast<uint8_t *>(input1_data_), &tile_para);
ret = LiteBackendParallelLaunch(AddInt8Run, this, thread_count_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, AddInt8Run, this, thread_count_);
ctx_->allocator->Free(input0_data_);
ctx_->allocator->Free(input1_data_);
return ret;
}
ret = LiteBackendParallelLaunch(AddInt8Run, this, thread_count_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, AddInt8Run, this, thread_count_);
return ret;
}
int AddInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int AddInt8Run(void *cdata, int task_id) {
auto add = reinterpret_cast<QuantizedAddCPUKernel *>(cdata);
add->DoExecute(task_id);
return lite::RET_OK;

View File

@ -46,7 +46,7 @@ class QuantizedAddCPUKernel : public LiteKernel {
int8_t *output_data_ = nullptr;
};
int AddInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata);
int AddInt8Run(void *cdata, int task_id);
} // namespace mindspore::kernel
#endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_INT8_ADD_INT8_H_

View File

@ -36,11 +36,11 @@ using mindspore::schema::PrimitiveType_NotEqual;
namespace mindspore::kernel {
namespace {
int ArithmeticsInt8Launch(int thread_id, LiteParallelGroupEnv *penv, void *cdata) {
int ArithmeticsInt8Launch(void *cdata, int task_id) {
auto arithmetic_kernel = reinterpret_cast<ArithmeticInt8CPUKernel *>(cdata);
auto error_code = arithmetic_kernel->DoArithmetic(thread_id);
auto error_code = arithmetic_kernel->DoArithmetic(task_id);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "ArithmeticsRun error thread_id[" << thread_id << "] error_code[" << error_code << "]";
MS_LOG(ERROR) << "ArithmeticsRun error thread_id[" << task_id << "] error_code[" << error_code << "]";
return error_code;
}
return RET_OK;
@ -151,7 +151,7 @@ int ArithmeticInt8CPUKernel::Run() {
}
TileDimensionsInt8(input_data0, input_data1, tile_data0_, tile_data1_, param);
}
ret = LiteBackendParallelLaunch(ArithmeticsInt8Launch, this, op_parameter_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ArithmeticsInt8Launch, this, op_parameter_->thread_num_);
if (param->broadcasting_) {
context_->allocator->Free(tile_data0_);
context_->allocator->Free(tile_data1_);

View File

@ -65,7 +65,7 @@ int ArithmeticSelfInt8CPUKernel::ReSize() {
return RET_OK;
}
int ArithmeticSelfInt8Runs(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ArithmeticSelfInt8Runs(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<ArithmeticSelfInt8CPUKernel *>(cdata);
auto ret = g_kernel->DoArithmeticSelf(task_id);
if (ret != RET_OK) {
@ -104,7 +104,7 @@ int ArithmeticSelfInt8CPUKernel::Run() {
auto out_tensor = out_tensors_.at(0);
in_ptr_ = reinterpret_cast<int8_t *>(input_tensor->Data());
out_ptr_ = reinterpret_cast<int8_t *>(out_tensor->Data());
ret = LiteBackendParallelLaunch(ArithmeticSelfInt8Runs, this, thread_sz_count_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ArithmeticSelfInt8Runs, this, thread_sz_count_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "ArithmeticSelfRun error error_code[" << ret << "]";
return ret;

View File

@ -180,7 +180,7 @@ int BatchnormInt8CPUKernel::DoExecute(int task_id) {
return RET_OK;
}
int BatchNormInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int BatchNormInt8Run(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<BatchnormInt8CPUKernel *>(cdata);
auto ret = g_kernel->DoExecute(task_id);
if (ret != RET_OK) {
@ -199,7 +199,7 @@ int BatchnormInt8CPUKernel::Run() {
in_addr_ = reinterpret_cast<int8_t *>(in_tensors_.at(0)->Data());
out_addr_ = reinterpret_cast<int8_t *>(out_tensors_.at(0)->Data());
int ret = LiteBackendParallelLaunch(BatchNormInt8Run, this, batchnorm_param_->op_parameter_.thread_num_);
int ret = ParallelLaunch(THREAD_POOL_DEFAULT, BatchNormInt8Run, this, batchnorm_param_->op_parameter_.thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "BatchnormRun error error_code[" << ret << "]";
return ret;

View File

@ -104,12 +104,12 @@ int ConcatInt8CPUKernel::Run() {
}
output_data_ = reinterpret_cast<int8_t *>(out_tensors_.at(0)->Data());
ret = LiteBackendParallelLaunch(ConcatInt8Run, this, thread_count_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ConcatInt8Run, this, thread_count_);
return ret;
}
int ConcatInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ConcatInt8Run(void *cdata, int task_id) {
auto concat = reinterpret_cast<ConcatInt8CPUKernel *>(cdata);
concat->DoExecute(task_id);
return lite::RET_OK;

View File

@ -56,7 +56,7 @@ class ConcatInt8CPUKernel : public ConcatBaseCPUKernel {
int8_t *output_data_ = nullptr;
};
int ConcatInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata);
int ConcatInt8Run(void *cdata, int task_id);
} // namespace mindspore::kernel
#endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_INT8_CONCAT_INT8_H_

View File

@ -217,7 +217,7 @@ int Convolution1x1Int8CPUKernel::RunImpl(int task_id) {
return RET_OK;
}
int Convolution1x1Int8Impl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int Convolution1x1Int8Impl(void *cdata, int task_id) {
auto conv = reinterpret_cast<Convolution1x1Int8CPUKernel *>(cdata);
auto error_code = conv->RunImpl(task_id);
if (error_code != RET_OK) {
@ -253,7 +253,7 @@ int Convolution1x1Int8CPUKernel::Run() {
PackInputSum16x4Int8(packed_input_, input_sum_, matmul_param_->deep_, matmul_param_->col_, matmul_param_->row_,
conv_param_);
int error_code = LiteBackendParallelLaunch(Convolution1x1Int8Impl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, Convolution1x1Int8Impl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "conv1x1 fp16 error error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -213,7 +213,7 @@ int Convolution3x3Int8CPUKernel::RunImpl(int task_id) {
return RET_OK;
}
int Convolution3x3Int8Impl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int Convolution3x3Int8Impl(void *cdata, int task_id) {
auto conv = reinterpret_cast<Convolution3x3Int8CPUKernel *>(cdata);
auto error_code = conv->RunImpl(task_id);
if (error_code != RET_OK) {
@ -238,7 +238,7 @@ int Convolution3x3Int8CPUKernel::Run() {
auto input_addr = reinterpret_cast<int8_t *>(in_tensors_.at(kInputIndex)->Data());
PackInputToC8Int8(input_addr, input_data_, conv_param_);
int error_code = LiteBackendParallelLaunch(Convolution3x3Int8Impl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, Convolution3x3Int8Impl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "conv3x3 int8 error error_code[" << error_code << "]";
FreeTmpBuffer();

View File

@ -128,7 +128,7 @@ int ConvolutionDepthwiseInt8CPUKernel::Execute(int task_id) {
return RET_OK;
}
int ConvDwInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ConvDwInt8Run(void *cdata, int task_id) {
auto conv_dw_int8 = reinterpret_cast<ConvolutionDepthwiseInt8CPUKernel *>(cdata);
auto ret = conv_dw_int8->Execute(task_id);
if (ret != RET_OK) {
@ -164,7 +164,7 @@ int ConvolutionDepthwiseInt8CPUKernel::Run() {
packed_output_ = output_addr;
}
ret = LiteBackendParallelLaunch(ConvDwInt8Run, this, conv_param_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, ConvDwInt8Run, this, conv_param_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "ConvDwInt8Run error: error_code[" << ret << "]";
return RET_ERROR;

View File

@ -338,7 +338,7 @@ int ConvolutionInt8CPUKernel::RunImpl(int task_id) {
return RET_OK;
}
int ConvolutionInt8Impl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ConvolutionInt8Impl(void *cdata, int task_id) {
auto conv = reinterpret_cast<ConvolutionInt8CPUKernel *>(cdata);
auto error_code = conv->RunImpl(task_id);
if (error_code != RET_OK) {
@ -374,7 +374,7 @@ int ConvolutionInt8CPUKernel::Run() {
convert_func_(ori_input_data, nhwc4_input_, conv_param_->input_batch_, conv_param_->input_h_ * conv_param_->input_w_,
conv_param_->input_channel_);
int error_code = LiteBackendParallelLaunch(ConvolutionInt8Impl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ConvolutionInt8Impl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "conv int8 error error_code[" << error_code << "]";
FreeTmpBuffer();

View File

@ -67,7 +67,7 @@ int CropInt8CPUKernel::Run() {
MS_LOG(ERROR) << "Prepare fail!ret: " << ret;
return ret;
}
ret = LiteBackendParallelLaunch(CropInt8Run, this, thread_count_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, CropInt8Run, this, thread_count_);
return ret;
}
@ -91,7 +91,7 @@ void PadOffset(int input_dim, CropParameter *crop_para) {
}
}
int CropInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int CropInt8Run(void *cdata, int task_id) {
auto crop = reinterpret_cast<CropInt8CPUKernel *>(cdata);
crop->DoExecute(task_id);
return RET_OK;

View File

@ -46,7 +46,7 @@ class CropInt8CPUKernel : public CropBaseCPUKernel {
CropParameter *crop_para_;
};
int CropInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata);
int CropInt8Run(void *cdata, int task_id);
void PadOffset(int input_dim, CropParameter *crop_para);
} // namespace mindspore::kernel

View File

@ -164,7 +164,7 @@ int DeconvolutionDepthwiseInt8CPUKernel::Execute(int task_id) {
return RET_OK;
}
int DeconvDwInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int DeconvDwInt8Run(void *cdata, int task_id) {
auto deconv_dw_int8 = reinterpret_cast<DeconvolutionDepthwiseInt8CPUKernel *>(cdata);
auto ret = deconv_dw_int8->Execute(task_id);
if (ret != RET_OK) {
@ -196,7 +196,7 @@ int DeconvolutionDepthwiseInt8CPUKernel::Run() {
packed_output_ = output_addr;
}
ret = LiteBackendParallelLaunch(DeconvDwInt8Run, this, conv_param_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, DeconvDwInt8Run, this, conv_param_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "DeconvDwInt8Run error: error_code[" << ret << "]";
return RET_ERROR;

View File

@ -216,7 +216,7 @@ void DeConvInt8CPUKernel::FreeRunBuf() {
return;
}
int DeConvInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int DeConvInt8Run(void *cdata, int task_id) {
auto deconv = reinterpret_cast<DeConvInt8CPUKernel *>(cdata);
auto error_code = deconv->DoDeconv(task_id);
if (error_code != RET_OK) {
@ -272,7 +272,7 @@ int DeConvInt8CPUKernel::Run() {
DeConvPackInputSum(input_ptr_, input_sum_, conv_param_->conv_quant_arg_.filter_quant_args_[0].zp_,
UP_ROUND(matmul_param_->row_, C4NUM), UP_ROUND(matmul_param_->deep_, C16NUM), support_optimize_);
error_code = LiteBackendParallelLaunch(DeConvInt8Run, this, thread_count_);
error_code = ParallelLaunch(THREAD_POOL_DEFAULT, DeConvInt8Run, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "deconv int8 run error! error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -87,7 +87,7 @@ int DivInt8CPUKernel::DoExecute(int task_id) {
return ret;
}
int DivInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int DivInt8Run(void *cdata, int task_id) {
auto div_kernel = reinterpret_cast<DivInt8CPUKernel *>(cdata);
auto ret = div_kernel->DoExecute(task_id);
if (ret != RET_OK) {
@ -123,7 +123,7 @@ int DivInt8CPUKernel::Run() {
static_cast<uint8_t *>(in_tensors_.at(1)->Data()), reinterpret_cast<uint8_t *>(tile0_data_),
reinterpret_cast<uint8_t *>(tile1_data_), &tile_para);
}
ret = LiteBackendParallelLaunch(DivInt8Run, this, op_parameter_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, DivInt8Run, this, op_parameter_->thread_num_);
if (broadcast_) {
context_->allocator->Free(tile0_data_);
context_->allocator->Free(tile1_data_);

View File

@ -118,7 +118,7 @@ int FullconnectionInt8CPUKernel::RunImpl(int task_id) {
return RET_OK;
}
int FcInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int FcInt8Run(void *cdata, int task_id) {
auto fc = reinterpret_cast<FullconnectionInt8CPUKernel *>(cdata);
auto ret = fc->RunImpl(task_id);
if (ret != RET_OK) {
@ -137,7 +137,7 @@ int FullconnectionInt8CPUKernel::Run() {
auto input_ptr = reinterpret_cast<int8_t *>(in_tensors_[0]->Data());
RowMajor2Row4x16Major(input_ptr, fc_param_->row_, fc_param_->deep_, a_r4x16_ptr_, d16_);
CalcInputSums(input_ptr, fc_param_->row_, fc_param_->deep_, quant_params_.weight.zp_, input_sums_);
LiteBackendParallelLaunch(FcInt8Run, this, thread_count_);
ParallelLaunch(THREAD_POOL_DEFAULT, FcInt8Run, this, thread_count_);
return RET_OK;
}

View File

@ -114,7 +114,7 @@ int GatherNdInt8CPUKernel::DoGatherNd(int task_id) {
return RET_OK;
}
int GatherNdInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int GatherNdInt8Run(void *cdata, int task_id) {
auto g_kernel = reinterpret_cast<GatherNdInt8CPUKernel *>(cdata);
auto ret = g_kernel->DoGatherNd(task_id);
if (ret != RET_OK) {
@ -132,7 +132,7 @@ int GatherNdInt8CPUKernel::Run() {
}
in_ptr_ = reinterpret_cast<int8_t *>(in_tensors_.front()->Data());
out_ptr_ = reinterpret_cast<int8_t *>(out_tensors_.front()->Data());
auto ret = LiteBackendParallelLaunch(GatherNdInt8Run, this, thread_sz_count_);
auto ret = ParallelLaunch(THREAD_POOL_DEFAULT, GatherNdInt8Run, this, thread_sz_count_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "gatherNd error error_code[" << ret << "]";
return ret;

View File

@ -111,7 +111,7 @@ int GatherInt8CPUKernel::DoGather(int task_id) {
return RET_OK;
}
int GatherInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int GatherInt8Run(void *cdata, int task_id) {
auto gather_kernel = reinterpret_cast<GatherInt8CPUKernel *>(cdata);
auto error_code = gather_kernel->DoGather(task_id);
if (error_code != RET_OK) {
@ -127,7 +127,7 @@ int GatherInt8CPUKernel::Run() {
MS_LOG(ERROR) << "Prepare fail!ret: " << prepare_ret;
return prepare_ret;
}
int error_code = LiteBackendParallelLaunch(GatherInt8Run, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, GatherInt8Run, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Gather function error error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -78,7 +78,7 @@ int HswishInt8CPUKernel::DoActivation(int task_id) {
return RET_OK;
}
int HswishInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int HswishInt8Run(void *cdata, int task_id) {
auto activation_kernel = reinterpret_cast<HswishInt8CPUKernel *>(cdata);
auto error_code = activation_kernel->DoActivation(task_id);
if (error_code != RET_OK) {
@ -94,7 +94,7 @@ int HswishInt8CPUKernel::Run() {
MS_LOG(ERROR) << "Prepare failed.";
return RET_ERROR;
}
int error_code = LiteBackendParallelLaunch(HswishInt8Run, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, HswishInt8Run, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "HswishInt8Run function error error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -82,13 +82,13 @@ int LeakyReluInt8CPUKernel::Run() {
MS_LOG(ERROR) << "Prepare fail!ret: " << ret;
return ret;
}
ret = LiteBackendParallelLaunch(PreluInt8Run, this, op_parameter_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, PreluInt8Run, this, op_parameter_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "RunPreluParam failed. errorcode: ";
}
return RET_OK;
}
int PreluInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int PreluInt8Run(void *cdata, int task_id) {
auto prelu = reinterpret_cast<LeakyReluInt8CPUKernel *>(cdata);
prelu->DoExecute(task_id);
return RET_OK;

View File

@ -41,7 +41,7 @@ class LeakyReluInt8CPUKernel : public LeakyReluBaseCPUKernel {
private:
LeakyReluQuantArg quant_prelu_parm_;
};
int PreluInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata);
int PreluInt8Run(void *cdata, int task_id);
} // namespace mindspore::kernel
#endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_INT8_PRELU_INT8_H_

View File

@ -111,7 +111,7 @@ int MatmulInt8CPUKernel::RunImpl(int task_id) {
return RET_OK;
}
int MatmulInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int MatmulInt8Run(void *cdata, int task_id) {
auto op = reinterpret_cast<MatmulInt8CPUKernel *>(cdata);
auto ret = op->RunImpl(task_id);
if (ret != RET_OK) {
@ -152,7 +152,7 @@ int MatmulInt8CPUKernel::Run() {
auto &q = quant_params_;
CalcInputSums(cur_a_ptr, params_->row_, params_->deep_, q.weight.zp_, input_sums_);
CalcWeightBiasSums(cur_b_ptr, params_->deep_, params_->col_, q.input.zp_, q.weight.zp_, NULL, weight_bias_sums_);
ret = LiteBackendParallelLaunch(MatmulInt8Run, this, thread_count_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, MatmulInt8Run, this, thread_count_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "MatmulInt8Run error: [" << ret << "]";
return ret;

View File

@ -86,17 +86,17 @@ int MulInt8CPUKernel::Run() {
}
TileDimensionsInt8(static_cast<int8_t *>(in_tensors_.at(0)->Data()),
static_cast<int8_t *>(in_tensors_.at(1)->Data()), input0_data_, input1_data_, &tile_para);
ret = LiteBackendParallelLaunch(MulInt8Run, this, thread_count_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, MulInt8Run, this, thread_count_);
ctx_->allocator->Free(input0_data_);
ctx_->allocator->Free(input1_data_);
return ret;
}
ret = LiteBackendParallelLaunch(MulInt8Run, this, thread_count_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, MulInt8Run, this, thread_count_);
return ret;
}
int MulInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int MulInt8Run(void *cdata, int task_id) {
auto mul = reinterpret_cast<MulInt8CPUKernel *>(cdata);
mul->DoExecute(task_id);
return lite::RET_OK;

View File

@ -46,7 +46,7 @@ class MulInt8CPUKernel : public LiteKernel {
int8_t *output_data_ = nullptr;
};
int MulInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata);
int MulInt8Run(void *cdata, int task_id);
} // namespace mindspore::kernel
#endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_INT8_MUL_INT8_H_

View File

@ -112,7 +112,7 @@ int PadInt8CPUKernel::RunImpl(int task_id) {
return PadConstant4D(in_data_, out_data_, in_dims_, out_dims_, pad_param_->paddings_, task_id, context_->thread_num_);
}
int PadInt8Impl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int PadInt8Impl(void *cdata, int task_id) {
auto resize = reinterpret_cast<PadInt8CPUKernel *>(cdata);
auto error_code = resize->RunImpl(task_id);
if (error_code != RET_OK) {
@ -132,7 +132,7 @@ int PadInt8CPUKernel::Run() {
out_data_ = reinterpret_cast<int8_t *>(out_tensors_[0]->Data());
memset(out_data_, pad_param_->pad_quant_arg_.constant_value_[0], out_tensors_[0]->ElementsNum() * sizeof(int8_t));
int error_code = LiteBackendParallelLaunch(PadInt8Impl, this, context_->thread_num_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, PadInt8Impl, this, context_->thread_num_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Resize run error, error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -69,7 +69,7 @@ int PoolingInt8CPUKernel::RunImpl(int task_id) {
return RET_OK;
}
int PoolingInt8Impl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int PoolingInt8Impl(void *cdata, int task_id) {
auto pooling = reinterpret_cast<PoolingInt8CPUKernel *>(cdata);
auto error_code = pooling->RunImpl(task_id);
if (error_code != RET_OK) {
@ -85,7 +85,7 @@ int PoolingInt8CPUKernel::Run() {
MS_LOG(ERROR) << "Prepare failed.";
return RET_ERROR;
}
int error_code = LiteBackendParallelLaunch(PoolingInt8Impl, this, thread_count_);
int error_code = ParallelLaunch(THREAD_POOL_DEFAULT, PoolingInt8Impl, this, thread_count_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "poolingInt8 error error_code[" << error_code << "]";
return RET_ERROR;

View File

@ -88,7 +88,7 @@ int PowerInt8CPUKernel::DoPower(int task_id) {
return ret;
}
int PowerInt8Run(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int PowerInt8Run(void *cdata, int task_id) {
auto power_kernel = reinterpret_cast<PowerInt8CPUKernel *>(cdata);
auto ret = power_kernel->DoPower(task_id);
if (ret != RET_OK) {
@ -103,7 +103,7 @@ int PowerInt8CPUKernel::Run() {
MS_LOG(ERROR) << "Prepare failed.";
return ret;
}
ret = LiteBackendParallelLaunch(PowerInt8Run, this, op_parameter_->thread_num_);
ret = ParallelLaunch(THREAD_POOL_DEFAULT, PowerInt8Run, this, op_parameter_->thread_num_);
if (ret != RET_OK) {
MS_LOG(ERROR) << "PowerInt8Run error, error_code[" << ret << "]";
}

View File

@ -235,7 +235,7 @@ int ReduceInt8CPUKernel::ReSize() {
return ret;
}
int ReduceInt8Impl(int task_id, LiteParallelGroupEnv *penv, void *cdata) {
int ReduceInt8Impl(void *cdata, int task_id) {
auto reduce = reinterpret_cast<ReduceInt8CPUKernel *>(cdata);
auto error_code = reduce->CallReduceUnit(task_id);
if (error_code != RET_OK) {
@ -284,7 +284,7 @@ int ReduceInt8CPUKernel::Run() {
inner_size_ *= tmp_shape_[k];
}
axis_size_ = tmp_shape_[axis];
auto error_code = LiteBackendParallelLaunch(ReduceInt8Impl, this, context_->thread_num_);
auto error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ReduceInt8Impl, this, context_->thread_num_);
if (error_code != RET_OK) {
FreeTmpBuffer();
MS_LOG(ERROR) << "Reduce run error, error_code[" << error_code << "]";
@ -321,7 +321,7 @@ int ReduceInt8CPUKernel::Run() {
axis_size_ = tmp_shape_[last_reduce_axis];
last_dst_data_ = reinterpret_cast<int8_t *>(out_tensors_.at(0)->Data());
is_last_axis_ = true;
auto error_code = LiteBackendParallelLaunch(ReduceInt8Impl, this, context_->thread_num_);
auto error_code = ParallelLaunch(THREAD_POOL_DEFAULT, ReduceInt8Impl, this, context_->thread_num_);
if (error_code != RET_OK) {
MS_LOG(ERROR) << "Reduce run error, error_code[" << error_code << "]";
FreeTmpBuffer();

Some files were not shown because too many files have changed in this diff Show More