diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_kernel.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_kernel.cc index e467a35130e90b17c23b7029d40087c955c4241b..8b2013cf87d9615b9f64faf8f99914066ed58ee1 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_kernel.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_kernel.cc @@ -15,6 +15,7 @@ */ #include "nnacl/nnacl_kernel.h" +#include "schema/model_generated.h" #include "nnacl/cxx_utils.h" #include "src/tensor.h" #include "include/errorcode.h" @@ -169,6 +170,11 @@ int NNACLKernel::InitKernel(const TypeId &data_type, const lite::InnerContext *c if (out_ == nullptr) { return RET_ERROR; } + //Init fc kernel thread number to 1 + if (op_parameter_ != nullptr && op_parameter_->type_ == static_cast(mindspore::schema::PrimitiveType_FullConnection)) { + op_parameter_->thread_num_ = 1; + this->thread_num_ = 1; + } UpdateTensorC(); kernel_ = CreateKernel(op_parameter_, in_, in_size_, out_, out_size_, data_type, exec_env_); diff --git a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_matmul.cc b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_matmul.cc index 913611c5147538d36e4521eff5476634a4356bc6..5dc1d725dc37652c6d1e5ab88b2c10069d79af6d 100644 --- a/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_matmul.cc +++ b/mindspore-lite/src/litert/kernel/cpu/nnacl/nnacl_matmul.cc @@ -43,6 +43,11 @@ int MatmulKernel::Prepare() { matmul->infer_shape_ = InferShapeDone(); matmul->a_const_ = in_tensors_[FIRST_INPUT]->IsConst() && !op_parameter_->is_train_session_; matmul->b_const_ = in_tensors_[SECOND_INPUT]->IsConst() && !op_parameter_->is_train_session_; + //Init fc kernel thread number to 1 + if (op_parameter_ != nullptr && op_parameter_->type_ == schema::PrimitiveType_FullConnection) { + kernel_->thread_nr_ = 1; + } + int ret = kernel_->Prepare(kernel_); if (ret != RET_OK) { MS_LOG(ERROR) << "NNACL matmul/fc prepare failed. Kernel: " << name() << ", ret: " << ret; diff --git a/mindspore-lite/tools/converter/quantizer/full_quant_quantizer.cc b/mindspore-lite/tools/converter/quantizer/full_quant_quantizer.cc index 3f1aba2f5a0da87a480539937a049802091bd4fe..bfa06a6224b37e1b3626f8f6937e5d15935c3982 100644 --- a/mindspore-lite/tools/converter/quantizer/full_quant_quantizer.cc +++ b/mindspore-lite/tools/converter/quantizer/full_quant_quantizer.cc @@ -435,11 +435,11 @@ void FullQuantQuantizer::InitCpuConfig() { support_int8_ops_ = { // Compute prim::kPrimConv2DFusion, - prim::kPrimFullConnection, + // prim::kPrimFullConnection, prim::kPrimMatMulFusion, // Memory - prim::kPrimReshape, - prim::kPrimTranspose, + // prim::kPrimReshape, + // prim::kPrimTranspose, prim::kPrimShape, prim::kPrimUnsqueeze, };