From 64635242c2eb496c04aa7bf3effe10b5d1704449 Mon Sep 17 00:00:00 2001 From: gongdaguo Date: Wed, 14 Apr 2021 17:00:55 +0800 Subject: [PATCH] remove innercontext --- mindspore/lite/schema/ops.fbs | 2 +- mindspore/lite/src/lite_kernel.h | 13 ++++---- .../runtime/agent/npu/subgraph_npu_kernel.cc | 3 +- .../kernel/arm/base/constant_of_shape.cc | 3 +- .../arm/base/detection_post_process_base.cc | 33 ++++++++++++------- .../arm/base/detection_post_process_base.h | 1 + .../src/runtime/kernel/arm/base/prior_box.cc | 3 +- .../kernel/arm/base/quant_dtype_cast.cc | 3 +- .../runtime/kernel/arm/base/reshape_base.cc | 3 +- .../src/runtime/kernel/arm/base/slice_base.cc | 3 +- .../src/runtime/kernel/arm/base/split_base.cc | 3 +- .../src/runtime/kernel/arm/base/stack_base.cc | 3 +- .../runtime/kernel/arm/base/strided_slice.cc | 3 +- .../src/runtime/kernel/arm/base/tile_base.cc | 3 +- .../kernel/arm/fp16/activation_fp16.cc | 3 +- .../arm/fp16/arithmetic_compare_fp16.cc | 7 ++-- .../kernel/arm/fp16/arithmetic_fp16.cc | 13 ++++---- .../kernel/arm/fp16/arithmetic_self_fp16.cc | 5 +-- .../runtime/kernel/arm/fp16/batchnorm_fp16.cc | 7 ++-- .../src/runtime/kernel/arm/fp16/cast_fp16.cc | 3 +- .../kernel/arm/fp16/convolution_1x1_fp16.cc | 6 ++-- .../arm/fp16/convolution_delegate_fp16.cc | 14 ++++---- .../arm/fp16/convolution_depthwise_fp16.cc | 3 +- .../convolution_depthwise_slidewindow_fp16.cc | 3 +- .../kernel/arm/fp16/convolution_fp16.cc | 3 +- .../arm/fp16/convolution_winograd_fp16.cc | 3 +- .../src/runtime/kernel/arm/fp16/crop_fp16.cc | 3 +- .../arm/fp16/deconvolution_depthwise_fp16.cc | 3 +- .../kernel/arm/fp16/deconvolution_fp16.cc | 14 +++++--- .../arm/fp16/deconvolution_winograd_fp16.cc | 6 ++-- .../runtime/kernel/arm/fp16/gather_fp16.cc | 3 +- .../kernel/arm/fp16/instance_norm_fp16.cc | 3 +- .../kernel/arm/fp16/log_softmax_fp16.cc | 3 +- .../kernel/arm/fp16/matmul_base_fp16.cc | 3 +- .../src/runtime/kernel/arm/fp16/pad_fp16.cc | 6 ++-- .../runtime/kernel/arm/fp16/pooling_fp16.cc | 3 +- .../src/runtime/kernel/arm/fp16/power_fp16.cc | 3 +- .../kernel/arm/fp16/quant_dtype_cast_fp16.cc | 3 +- .../runtime/kernel/arm/fp16/reduce_fp16.cc | 6 ++-- .../src/runtime/kernel/arm/fp16/scale_fp16.cc | 7 ++-- .../src/runtime/kernel/arm/fp16/slice_fp16.cc | 3 +- .../runtime/kernel/arm/fp16/softmax_fp16.cc | 3 +- .../src/runtime/kernel/arm/fp16/stack_fp16.cc | 8 +++-- .../arm/fp16_grad/activation_fp16_grad.cc | 3 +- .../fp16_grad/arithmetic_fp16_self_grad.cc | 3 +- .../kernel/arm/fp32/activation_fp32.cc | 3 +- .../src/runtime/kernel/arm/fp32/adder_fp32.cc | 3 +- .../src/runtime/kernel/arm/fp32/addn_fp32.cc | 6 ++-- .../kernel/arm/fp32/arithmetic_fp32.cc | 3 +- .../kernel/arm/fp32/arithmetic_self_fp32.cc | 3 +- .../runtime/kernel/arm/fp32/batchnorm_fp32.cc | 3 +- .../src/runtime/kernel/arm/fp32/cast_fp32.cc | 3 +- .../runtime/kernel/arm/fp32/concat_fp32.cc | 3 +- .../kernel/arm/fp32/convolution_1x1_fp32.cc | 6 ++-- .../arm/fp32/convolution_delegate_fp32.cc | 22 ++++++++----- .../fp32/convolution_depthwise_3x3_fp32.cc | 3 +- .../arm/fp32/convolution_depthwise_fp32.cc | 3 +- .../convolution_depthwise_indirect_fp32.cc | 3 +- .../convolution_depthwise_slidewindow_fp32.cc | 3 +- .../kernel/arm/fp32/convolution_fp32.cc | 3 +- .../arm/fp32/convolution_winograd_fp32.cc | 3 +- .../kernel/arm/fp32/crop_and_resize_fp32.cc | 3 +- .../src/runtime/kernel/arm/fp32/crop_fp32.cc | 3 +- .../arm/fp32/deconvolution_depthwise_fp32.cc | 3 +- .../kernel/arm/fp32/deconvolution_fp32.cc | 14 +++++--- .../arm/fp32/deconvolution_winograd_fp32.cc | 6 ++-- .../src/runtime/kernel/arm/fp32/elu_fp32.cc | 3 +- .../kernel/arm/fp32/embedding_lookup_fp32.cc | 3 +- .../src/runtime/kernel/arm/fp32/exp_fp32.cc | 3 +- .../src/runtime/kernel/arm/fp32/fill_fp32.cc | 3 +- .../kernel/arm/fp32/fused_batchnorm_fp32.cc | 3 +- .../runtime/kernel/arm/fp32/gatherNd_fp32.cc | 3 +- .../runtime/kernel/arm/fp32/gather_fp32.cc | 3 +- .../kernel/arm/fp32/instance_norm_fp32.cc | 3 +- .../runtime/kernel/arm/fp32/l2_norm_fp32.cc | 9 +++-- .../kernel/arm/fp32/layer_norm_fp32.cc | 3 +- .../arm/fp32/local_response_norm_fp32.cc | 3 +- .../kernel/arm/fp32/log_softmax_fp32.cc | 3 +- .../kernel/arm/fp32/lsh_projection_fp32.cc | 3 +- .../kernel/arm/fp32/matmul_fp32_base.cc | 3 +- .../runtime/kernel/arm/fp32/one_hot_fp32.cc | 3 +- .../src/runtime/kernel/arm/fp32/pad_fp32.cc | 6 ++-- .../runtime/kernel/arm/fp32/pooling_fp32.cc | 3 +- .../src/runtime/kernel/arm/fp32/power_fp32.cc | 3 +- .../src/runtime/kernel/arm/fp32/prelu_fp32.cc | 3 +- .../runtime/kernel/arm/fp32/reduce_fp32.cc | 3 +- .../runtime/kernel/arm/fp32/resize_fp32.cc | 3 +- .../runtime/kernel/arm/fp32/reverse_fp32.cc | 3 +- .../kernel/arm/fp32/roi_pooling_fp32.cc | 3 +- .../src/runtime/kernel/arm/fp32/scale_fp32.cc | 3 +- .../kernel/arm/fp32/scatter_nd_fp32.cc | 3 +- .../runtime/kernel/arm/fp32/softmax_fp32.cc | 3 +- .../kernel/arm/fp32/space_to_batch_fp32.cc | 3 +- .../kernel/arm/fp32/space_to_depth_fp32.cc | 3 +- .../kernel/arm/fp32/sparse_to_dense_fp32.cc | 3 +- .../runtime/kernel/arm/fp32/transpose_fp32.cc | 6 ++-- .../src/runtime/kernel/arm/fp32/where_fp32.cc | 3 +- .../kernel/arm/fp32_grad/activation_grad.cc | 3 +- .../src/runtime/kernel/arm/fp32_grad/adam.cc | 8 +++-- .../kernel/arm/fp32_grad/apply_momentum.cc | 8 +++-- .../kernel/arm/fp32_grad/arithmetic_grad.cc | 8 +++-- .../arm/fp32_grad/arithmetic_self_grad.cc | 8 +++-- .../runtime/kernel/arm/fp32_grad/assign.cc | 8 +++-- .../runtime/kernel/arm/fp32_grad/bias_grad.cc | 8 +++-- .../runtime/kernel/arm/fp32_grad/bn_grad.cc | 11 ++++--- .../kernel/arm/fp32_grad/convolution.cc | 8 +++-- .../kernel/arm/fp32_grad/convolution.h | 2 +- .../arm/fp32_grad/convolution_grad_filter.cc | 8 +++-- .../arm/fp32_grad/convolution_grad_input.cc | 3 +- .../fp32_grad/deconvolution_grad_filter.cc | 8 +++-- .../runtime/kernel/arm/fp32_grad/dropout.cc | 8 +++-- .../kernel/arm/fp32_grad/dropout_grad.cc | 8 +++-- .../kernel/arm/fp32_grad/layernorm_grad.cc | 3 +- .../runtime/kernel/arm/fp32_grad/neg_grad.cc | 8 +++-- .../kernel/arm/fp32_grad/pooling_grad.cc | 8 +++-- .../kernel/arm/fp32_grad/power_grad.cc | 8 +++-- .../kernel/arm/fp32_grad/resize_grad.cc | 3 +- .../src/runtime/kernel/arm/fp32_grad/sgd.cc | 11 ++++--- .../sigmoid_cross_entropy_with_logits.cc | 8 +++-- .../sigmoid_cross_entropy_with_logits_grad.cc | 8 +++-- .../kernel/arm/fp32_grad/smooth_l1_loss.cc | 8 +++-- .../arm/fp32_grad/smooth_l1_loss_grad.cc | 8 +++-- .../softmax_cross_entropy_with_logits.cc | 8 +++-- .../kernel/arm/fp32_grad/softmax_grad.cc | 8 +++-- ...parse_softmax_cross_entropy_with_logits.cc | 3 +- .../arm/fp32_grad/strided_slice_grad.cc | 3 +- .../arm/fp32_grad/unsorted_segment_sum.cc | 3 +- .../kernel/arm/int8/activation_int8.cc | 20 +++++++---- .../src/runtime/kernel/arm/int8/add_int8.cc | 3 +- .../kernel/arm/int8/arithmetic_int8.cc | 14 +++++--- .../kernel/arm/int8/arithmetic_self_int8.cc | 3 +- .../runtime/kernel/arm/int8/batchnorm_int8.cc | 4 +-- .../runtime/kernel/arm/int8/concat_int8.cc | 3 +- .../kernel/arm/int8/convolution_1x1_int8.cc | 9 +++-- .../kernel/arm/int8/convolution_3x3_int8.cc | 3 +- .../int8/convolution_depthwise_3x3_int8.cc | 3 +- .../arm/int8/convolution_depthwise_int8.cc | 3 +- .../convolution_depthwise_slidewindow_int8.cc | 3 +- .../kernel/arm/int8/convolution_int8.cc | 3 +- .../arm/int8/convolution_int8_creator.cc | 10 +++--- .../src/runtime/kernel/arm/int8/crop_int8.cc | 3 +- .../arm/int8/deconvolution_depthwise_int8.cc | 3 +- .../kernel/arm/int8/deconvolution_int8.cc | 11 ++++--- .../arm/int8/detection_post_process_int8.cc | 3 +- .../src/runtime/kernel/arm/int8/div_int8.cc | 3 +- .../runtime/kernel/arm/int8/gatherNd_int8.cc | 3 +- .../runtime/kernel/arm/int8/gather_int8.cc | 3 +- .../runtime/kernel/arm/int8/hswish_int8.cc | 3 +- .../runtime/kernel/arm/int8/l2_norm_int8.cc | 3 +- .../kernel/arm/int8/layer_norm_int8.cc | 3 +- .../kernel/arm/int8/leaky_relu_int8.cc | 3 +- .../kernel/arm/int8/matmul_base_int8.cc | 3 +- .../src/runtime/kernel/arm/int8/mul_int8.cc | 9 +++-- .../src/runtime/kernel/arm/int8/pad_int8.cc | 6 ++-- .../runtime/kernel/arm/int8/pooling_int8.cc | 3 +- .../src/runtime/kernel/arm/int8/power_int8.cc | 3 +- .../runtime/kernel/arm/int8/reduce_int8.cc | 9 +++-- .../src/runtime/kernel/arm/int8/relux_int8.cc | 3 +- .../runtime/kernel/arm/int8/reshape_int8.cc | 3 +- .../runtime/kernel/arm/int8/resize_int8.cc | 3 +- .../src/runtime/kernel/arm/int8/scale_int8.cc | 6 ++-- .../runtime/kernel/arm/int8/sigmoid_int8.cc | 3 +- .../src/runtime/kernel/arm/int8/slice_int8.cc | 3 +- .../runtime/kernel/arm/int8/softmax_int8.cc | 3 +- .../src/runtime/kernel/arm/int8/split_int8.cc | 3 +- .../runtime/kernel/arm/int8/squeeze_int8.cc | 3 +- .../src/runtime/kernel/arm/int8/sub_int8.cc | 3 +- .../src/runtime/kernel/arm/int8/tanh_int8.cc | 3 +- .../runtime/kernel/arm/int8/transpose_int8.cc | 3 +- .../runtime/kernel/arm/int8/unsqueeze_int8.cc | 3 +- .../kernel/arm/string/extract_feature.cc | 5 +-- .../kernel/arm/string/hashtable_lookup.cc | 5 +-- .../runtime/kernel/arm/string/normalize.cc | 5 +-- .../src/runtime/kernel/arm/string/predict.cc | 5 +-- .../src/runtime/kernel/npu/convolution_npu.cc | 8 +++-- .../lite/src/runtime/kernel/npu/npu_kernel.h | 4 +-- .../runtime/kernel/opencl/kernel/conv2d.cc | 15 +++++---- .../kernel/opencl/kernel/conv2d_transpose.cc | 2 +- .../runtime/kernel/opencl/kernel/matmul.cc | 8 +++-- .../src/runtime/kernel/opencl/opencl_kernel.h | 5 +-- mindspore/lite/src/sub_graph_kernel.cc | 2 +- 181 files changed, 580 insertions(+), 328 deletions(-) diff --git a/mindspore/lite/schema/ops.fbs b/mindspore/lite/schema/ops.fbs index 2f019de1553..2af4e527cd3 100644 --- a/mindspore/lite/schema/ops.fbs +++ b/mindspore/lite/schema/ops.fbs @@ -841,7 +841,7 @@ table Rsqrt { } table QuantDTypeCast { - src_t: long; // deprecated + src_t: long; dst_t: long; } diff --git a/mindspore/lite/src/lite_kernel.h b/mindspore/lite/src/lite_kernel.h index 785c9d49401..620135a96f0 100644 --- a/mindspore/lite/src/lite_kernel.h +++ b/mindspore/lite/src/lite_kernel.h @@ -30,6 +30,7 @@ #include "src/tensor.h" #include "include/errorcode.h" #include "schema/model_generated.h" +#include "include/context.h" namespace mindspore::kernel { enum KERNEL_ARCH { @@ -64,7 +65,7 @@ class LiteKernel { public: LiteKernel() = default; LiteKernel(OpParameter *parameter, std::vector in_tensors, std::vector out_tensors, - const lite::InnerContext *ctx) + const lite::Context *ctx) : op_parameter_(parameter), in_tensors_(std::move(in_tensors)), out_tensors_(std::move(out_tensors)), @@ -175,7 +176,7 @@ class LiteKernel { SubGraphType subgraph_type() const { return this->subgraph_type_; } - const lite::InnerContext *context() const { return this->context_; } + const lite::Context *context() const { return this->context_; } virtual std::string ToString() const; @@ -202,7 +203,7 @@ class LiteKernel { // tensor will free in ~lite_session() std::vector in_tensors_; std::vector out_tensors_; - const lite::InnerContext *context_ = nullptr; + const lite::Context *context_ = nullptr; std::vector in_kernels_; std::vector out_kernels_; bool train_mode_ = false; @@ -217,13 +218,13 @@ class LiteKernel { typedef LiteKernel *(*KernelCreator)(const std::vector &inputs, const std::vector &outputs, OpParameter *parameter, - const lite::InnerContext *ctx, const KernelKey &desc); + const lite::Context *ctx, const KernelKey &desc); template kernel::LiteKernel *LiteKernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *parameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { - auto *kernel = new (std::nothrow) T(parameter, inputs, outputs, ctx); + const lite::Context *ctx, const kernel::KernelKey &desc) { + auto *kernel = new (std::nothrow) T(parameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "kernel: " << parameter->name_ << "is nullptr."; free(parameter); diff --git a/mindspore/lite/src/runtime/agent/npu/subgraph_npu_kernel.cc b/mindspore/lite/src/runtime/agent/npu/subgraph_npu_kernel.cc index a9208b06290..468ac2aa24a 100644 --- a/mindspore/lite/src/runtime/agent/npu/subgraph_npu_kernel.cc +++ b/mindspore/lite/src/runtime/agent/npu/subgraph_npu_kernel.cc @@ -206,7 +206,8 @@ int SubGraphNpuKernel::Init() { MS_ASSERT(npu_manager_ != nullptr); - npu_manager_->AddModel(model_buffer_data, GetOMModelName(), context_->GetNpuInfo().frequency_); + npu_manager_->AddModel(model_buffer_data, GetOMModelName(), + static_cast(context_)->GetNpuInfo().frequency_); executor_ = new (std::nothrow) mindspore::lite::NPUExecutor(GetOMModelName(), npu_manager_); diff --git a/mindspore/lite/src/runtime/kernel/arm/base/constant_of_shape.cc b/mindspore/lite/src/runtime/kernel/arm/base/constant_of_shape.cc index 48c1ec53ccb..05a086532bb 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/constant_of_shape.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/constant_of_shape.cc @@ -73,7 +73,8 @@ int ConstantOfShapeCPUKernel::Run() { int thread_count = MSMIN(op_parameter_->thread_num_, param_->element_size_); thread_stride_ = UP_DIV(param_->element_size_, thread_count); - auto ret = ParallelLaunch(this->context_->thread_pool_, ConstantOfShapeRun, this, thread_count); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConstantOfShapeRun, + this, thread_count); if (ret != RET_OK) { MS_LOG(ERROR) << "ConstantOfShapeRun error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.cc b/mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.cc index 66b70c85e74..899c3e69ebc 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.cc @@ -144,17 +144,7 @@ void DetectionPostProcessBaseCPUKernel::FreeAllocatedBuffer() { } } -int DetectionPostProcessBaseCPUKernel::Run() { - MS_ASSERT(context_->allocator != nullptr); - int status = GetInputData(); - if (status != RET_OK) { - return status; - } - auto output_boxes = reinterpret_cast(out_tensors_.at(0)->data_c()); - auto output_classes = reinterpret_cast(out_tensors_.at(1)->data_c()); - auto output_scores = reinterpret_cast(out_tensors_.at(2)->data_c()); - auto output_num = reinterpret_cast(out_tensors_.at(3)->data_c()); - +int DetectionPostProcessBaseCPUKernel::ParamInit() { num_boxes_ = in_tensors_.at(0)->shape().at(1); num_classes_with_bg_ = in_tensors_.at(1)->shape().at(2); params_->decoded_boxes_ = context_->allocator->Malloc(num_boxes_ * 4 * sizeof(float)); @@ -221,6 +211,24 @@ int DetectionPostProcessBaseCPUKernel::Run() { return RET_ERROR; } } + return RET_OK; +} + +int DetectionPostProcessBaseCPUKernel::Run() { + MS_ASSERT(context_->allocator != nullptr); + int status = GetInputData(); + if (status != RET_OK) { + return status; + } + auto output_boxes = reinterpret_cast(out_tensors_.at(0)->data_c()); + auto output_classes = reinterpret_cast(out_tensors_.at(1)->data_c()); + auto output_scores = reinterpret_cast(out_tensors_.at(2)->data_c()); + auto output_num = reinterpret_cast(out_tensors_.at(3)->data_c()); + + if (ParamInit() != RET_OK) { + MS_LOG(ERROR) << "ParamInit error"; + return status; + } status = DecodeBoxes(num_boxes_, input_boxes_, params_->anchors_, params_); if (status != RET_OK) { @@ -238,7 +246,8 @@ int DetectionPostProcessBaseCPUKernel::Run() { return status; } } else { - status = ParallelLaunch(this->context_->thread_pool_, NmsMultiClassesFastCoreRun, this, op_parameter_->thread_num_); + status = ParallelLaunch(static_cast(this->context_)->thread_pool_, + NmsMultiClassesFastCoreRun, this, op_parameter_->thread_num_); if (status != RET_OK) { MS_LOG(ERROR) << "NmsMultiClassesFastCoreRun error error_code[" << status << "]"; FreeAllocatedBuffer(); diff --git a/mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.h b/mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.h index 3a2bbd8d79d..150f9c1886e 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.h +++ b/mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.h @@ -47,6 +47,7 @@ class DetectionPostProcessBaseCPUKernel : public LiteKernel { protected: virtual int GetInputData() = 0; + int ParamInit(); private: void FreeAllocatedBuffer(); diff --git a/mindspore/lite/src/runtime/kernel/arm/base/prior_box.cc b/mindspore/lite/src/runtime/kernel/arm/base/prior_box.cc index 91a8889a1dd..927fd1919b5 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/prior_box.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/prior_box.cc @@ -166,7 +166,8 @@ int RunPriorBox(void *cdata, int task_id) { } int PriorBoxCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, RunPriorBox, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, RunPriorBox, + this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "PriorBox run error, error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/base/quant_dtype_cast.cc b/mindspore/lite/src/runtime/kernel/arm/base/quant_dtype_cast.cc index 0f295434f34..7a01b0e6379 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/quant_dtype_cast.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/quant_dtype_cast.cc @@ -172,7 +172,8 @@ int QuantDTypeCastCPUKernel::Run() { uint8_ptr_ = reinterpret_cast(out_tensors_[0]->data_c()); } - auto ret = ParallelLaunch(this->context_->thread_pool_, QuantDTypeCastRun, this, thread_n_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, QuantDTypeCastRun, + this, thread_n_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Scale error error_code[" << ret << "]"; if (in_tensors_[0]->data_type() == TypeId::kNumberTypeInt8 && diff --git a/mindspore/lite/src/runtime/kernel/arm/base/reshape_base.cc b/mindspore/lite/src/runtime/kernel/arm/base/reshape_base.cc index 65d2b3087b9..33184bdb2e9 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/reshape_base.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/reshape_base.cc @@ -66,7 +66,8 @@ int ReshapeRun(void *cdata, int task_id) { int ReshapeBaseCPUKernel::Run() { input_ptr_ = reinterpret_cast(in_tensors_.at(kInputIndex)->data_c()); output_ptr_ = reinterpret_cast(out_tensors_.at(kOutputIndex)->data_c()); - auto ret = ParallelLaunch(this->context_->thread_pool_, ReshapeRun, this, context_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ReshapeRun, this, + context_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Reshape run error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/base/slice_base.cc b/mindspore/lite/src/runtime/kernel/arm/base/slice_base.cc index 6d9846d2049..266a15a9be9 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/slice_base.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/slice_base.cc @@ -81,7 +81,8 @@ int SliceCPUKernel::Run() { lite::DataTypeSize(in_tensors_.at(0)->data_type())); return RET_OK; } - auto ret = ParallelLaunch(this->context_->thread_pool_, SliceLaunch, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, SliceLaunch, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "slice launch fail!ret: " << ret; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/base/split_base.cc b/mindspore/lite/src/runtime/kernel/arm/base/split_base.cc index 0dfb02a6a81..28d1d5dc3bc 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/split_base.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/split_base.cc @@ -120,7 +120,8 @@ int SplitBaseCPUKernel::Run() { output_ptr_.at(i) = output_tensor->data_c(); } - auto ret = ParallelLaunch(this->context_->thread_pool_, SplitRun, this, thread_n_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, SplitRun, this, + thread_n_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "split error error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/base/stack_base.cc b/mindspore/lite/src/runtime/kernel/arm/base/stack_base.cc index 53e43879c15..46f599d1d2f 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/stack_base.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/stack_base.cc @@ -100,7 +100,8 @@ int StackBaseCPUKernel::Run() { } // run stack num_threads_ = MSMIN(UP_DIV(outer_size_, 64), this->context_->thread_num_); - auto ret = ParallelLaunch(this->context_->thread_pool_, StackRun, this, num_threads_); + auto ret = + ParallelLaunch(static_cast(this->context_)->thread_pool_, StackRun, this, num_threads_); if (ret != RET_OK) { MS_LOG(ERROR) << "StackBaseCPUKernel Run error: error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/base/strided_slice.cc b/mindspore/lite/src/runtime/kernel/arm/base/strided_slice.cc index a7baa6dcb1a..6d80e17674a 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/strided_slice.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/strided_slice.cc @@ -157,7 +157,8 @@ int StridedSliceCPUKernel::FastRun() { } input_ptr_ = reinterpret_cast(in_tensors_.front()->data_c()); output_ptr_ = reinterpret_cast(out_tensors_.front()->data_c()); - auto ret = ParallelLaunch(this->context_->thread_pool_, StrideRun, this, context_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, StrideRun, this, + context_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Stride run error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/base/tile_base.cc b/mindspore/lite/src/runtime/kernel/arm/base/tile_base.cc index 04f3aee09c3..ba382314c5e 100644 --- a/mindspore/lite/src/runtime/kernel/arm/base/tile_base.cc +++ b/mindspore/lite/src/runtime/kernel/arm/base/tile_base.cc @@ -127,7 +127,8 @@ int TileCPUKernel::SimpleTileImpl(int task_id) { } int TileCPUKernel::RunSimpleTile() { - auto ret = ParallelLaunch(context_->thread_pool_, SimpleTile, this, context_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, SimpleTile, this, + context_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "RunSimpleTile error code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/activation_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/activation_fp16.cc index ce2f2bcce5d..9640e51d879 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/activation_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/activation_fp16.cc @@ -100,7 +100,8 @@ int ActivationFp16CPUKernel::Run() { fp16_input_ = reinterpret_cast(input_tensor->data_c()); fp16_output_ = reinterpret_cast(output_tensor->data_c()); - int error_code = ParallelLaunch(this->context_->thread_pool_, ActivationFp16Run, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ActivationFp16Run, this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Activation function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_compare_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_compare_fp16.cc index 278f1b0fe64..fbc393ac8fe 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_compare_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_compare_fp16.cc @@ -160,15 +160,16 @@ int ArithmeticCompareFP16CPUKernel::Run() { is_input0_fp32_ = in_tensors_.at(0)->data_type() == kNumberTypeFloat32; is_input1_fp32_ = in_tensors_.at(1)->data_type() == kNumberTypeFloat32; - input0_fp16_ = ConvertInputFp32toFp16(in_tensors_.at(0), context_); - input1_fp16_ = ConvertInputFp32toFp16(in_tensors_.at(1), context_); + input0_fp16_ = ConvertInputFp32toFp16(in_tensors_.at(0), static_cast(this->context_)); + input1_fp16_ = ConvertInputFp32toFp16(in_tensors_.at(1), static_cast(this->context_)); output_fp16_ = reinterpret_cast(output_tensor->MutableData()); if (input0_fp16_ == nullptr || input1_fp16_ == nullptr || output_fp16_ == nullptr) { MS_LOG(ERROR) << "Memory allocation failed"; FreeTmpBuffer(); return RET_ERROR; } - auto ret = ParallelLaunch(this->context_->thread_pool_, ArithmeticsRunFp16, this, context_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ArithmeticsRunFp16, + this, context_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "ArithmeticsRunFp16 run error error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_fp16.cc index 943f96f3306..1089cda4f50 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_fp16.cc @@ -127,13 +127,13 @@ void ArithmeticFP16CPUKernel::InitRunFunction(int primitive_type) { int ArithmeticFP16CPUKernel::ConstTensorBroadCast() { int ret; if (in_tensors_[0]->data_c() != nullptr) { - ret = ConvertFp32TensorToFp16(in_tensors_[0], context_); + ret = ConvertFp32TensorToFp16(in_tensors_[0], static_cast(this->context_)); if (ret != RET_OK) { return ret; } } if (in_tensors_[1]->data_c() != nullptr) { - ret = ConvertFp32TensorToFp16(in_tensors_[1], context_); + ret = ConvertFp32TensorToFp16(in_tensors_[1], static_cast(this->context_)); if (ret != RET_OK) { return ret; } @@ -167,18 +167,19 @@ int ArithmeticFP16CPUKernel::Run() { return RET_ERROR; } if (!input0_broadcast_) { - input0_ptr_ = ConvertInputFp32toFp16(in_tensors_.at(0), context_); + input0_ptr_ = ConvertInputFp32toFp16(in_tensors_.at(0), static_cast(this->context_)); } if (!input1_broadcast_) { - input1_ptr_ = ConvertInputFp32toFp16(in_tensors_.at(1), context_); + input1_ptr_ = ConvertInputFp32toFp16(in_tensors_.at(1), static_cast(this->context_)); } auto output_tensor = out_tensors_.at(0); - output_ptr_ = MallocOutputFp16(output_tensor, context_); + output_ptr_ = MallocOutputFp16(output_tensor, static_cast(this->context_)); if (input0_ptr_ == nullptr || input1_ptr_ == nullptr || output_ptr_ == nullptr) { FreeFp16Buffer(); return RET_ERROR; } - auto ret = ParallelLaunch(this->context_->thread_pool_, ArithmeticsRun, this, context_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ArithmeticsRun, this, + context_->thread_num_); if (out_tensors_.at(0)->data_type() == kNumberTypeFloat32) { Float16ToFloat32(static_cast(output_ptr_), reinterpret_cast(output_tensor->MutableData()), output_tensor->ElementsNum()); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_self_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_self_fp16.cc index ae5e22b5f58..50bb2893c87 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_self_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/arithmetic_self_fp16.cc @@ -77,13 +77,14 @@ int ArithmeticSelfFp16CPUKernel::Run() { auto output_tensor = out_tensors_.at(0); if (input_tensor->data_type() == kNumberTypeFloat32) { - input_fp16_ptr_ = ConvertInputFp32toFp16(input_tensor, context_); + input_fp16_ptr_ = ConvertInputFp32toFp16(input_tensor, static_cast(this->context_)); } else { input_fp16_ptr_ = reinterpret_cast(input_tensor->data_c()); } output_fp16_ptr_ = reinterpret_cast(output_tensor->data_c()); - auto ret = ParallelLaunch(this->context_->thread_pool_, ArithmeticSelfRun, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ArithmeticSelfRun, + this, op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "ArithmeticSelfRun error error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/batchnorm_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/batchnorm_fp16.cc index 38c531a2d0d..c5ca5e9cb61 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/batchnorm_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/batchnorm_fp16.cc @@ -51,15 +51,16 @@ int BatchnormFp16CPUKernel::InitConstTensor() { int BatchnormFp16CPUKernel::Run() { auto input_tensor = in_tensors_.at(0); auto output_tensor = out_tensors_.at(0); - input_ = ConvertInputFp32toFp16(input_tensor, context_); - output_ = MallocOutputFp16(output_tensor, context_); + input_ = ConvertInputFp32toFp16(input_tensor, static_cast(this->context_)); + output_ = MallocOutputFp16(output_tensor, static_cast(this->context_)); if (input_ == nullptr || output_ == nullptr) { FreeInputAndOutput(); MS_LOG(ERROR) << "input or output is nullptr"; return RET_ERROR; } - auto ret = ParallelLaunch(this->context_->thread_pool_, BatchNormRun, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, BatchNormRun, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "BatchnormRun error error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/cast_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/cast_fp16.cc index b24f3abbe27..5423222b977 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/cast_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/cast_fp16.cc @@ -132,7 +132,8 @@ int CastFp16CPUKernel::Run() { if (data_num_ == 0) { return RET_OK; } - return ParallelLaunch(this->context_->thread_pool_, CastFp16Run, this, op_parameter_->thread_num_); + return ParallelLaunch(static_cast(this->context_)->thread_pool_, CastFp16Run, this, + op_parameter_->thread_num_); } REG_KERNEL(kCPU, kNumberTypeFloat16, PrimitiveType_Cast, LiteKernelCreator) diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_1x1_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_1x1_fp16.cc index c47450f8e6d..dc4aca22c4a 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_1x1_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_1x1_fp16.cc @@ -236,14 +236,16 @@ int Convolution1x1FP16CPUKernel::Run() { int ret = RET_ERROR; if (multi_thread_by_hw_) { - ret = ParallelLaunch(this->context_->thread_pool_, Convolution1x1Fp16RunHw, this, thread_count_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, + Convolution1x1Fp16RunHw, this, thread_count_); } else { #ifdef ENABLE_ARM64 RowMajor2Col16MajorFp16Opt(input_ptr_, pack_input_, matmul_param_->row_, matmul_param_->deep_); #else RowMajor2Col12MajorFp16Opt(input_ptr_, pack_input_, matmul_param_->row_, matmul_param_->deep_); #endif - ret = ParallelLaunch(this->context_->thread_pool_, Convolution1x1Fp16RunOc, this, thread_count_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, + Convolution1x1Fp16RunOc, this, thread_count_); } if (ret != RET_OK) { MS_LOG(ERROR) << "ParallelLaunch failed."; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_delegate_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_delegate_fp16.cc index 4526900ca36..3088ed7a944 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_delegate_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_delegate_fp16.cc @@ -95,10 +95,11 @@ static void SetInputOutputShapeInfo(ConvParameter *conv_param, lite::Tensor *inp int ConvolutionDelegateFP16CPUKernel::ReSize() { // Update shape info of input and output kernel::SetInputOutputShapeInfo(reinterpret_cast(op_parameter_), in_tensors_.front(), - out_tensors_.front(), context_); + out_tensors_.front(), static_cast(this->context_)); if (fp16_conv_kernel_ == nullptr) { fp16_conv_kernel_ = - CpuConvFp16KernelSelect(in_tensors_, out_tensors_, op_parameter_, context_, origin_weight_, origin_bias_); + CpuConvFp16KernelSelect(in_tensors_, out_tensors_, op_parameter_, + static_cast(context_), origin_weight_, origin_bias_); if (fp16_conv_kernel_ == nullptr) { MS_LOG(ERROR) << "Selecting execute kernel failed for conv_kernel, got a nullptr."; return RET_ERROR; @@ -184,7 +185,7 @@ kernel::LiteKernel *CpuGroupConvFp16KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_Conv2DFusion); @@ -200,11 +201,12 @@ kernel::LiteKernel *CpuConvFp16KernelCreator(const std::vector & auto conv_param = reinterpret_cast(opParameter); kernel::LiteKernel *kernel = nullptr; if (conv_param->group_ == 1) { - kernel = new (std::nothrow) kernel::ConvolutionDelegateFP16CPUKernel(opParameter, inputs, outputs, ctx); + kernel = new (std::nothrow) kernel::ConvolutionDelegateFP16CPUKernel(opParameter, inputs, outputs, + static_cast(ctx)); } else if (conv_param->group_ == conv_param->input_channel_ && conv_param->group_ == conv_param->output_channel_) { - kernel = CpuConvDwFp16KernelCreator(inputs, outputs, opParameter, ctx); + kernel = CpuConvDwFp16KernelCreator(inputs, outputs, opParameter, static_cast(ctx)); } else { - kernel = CpuGroupConvFp16KernelCreator(inputs, outputs, opParameter, ctx); + kernel = CpuGroupConvFp16KernelCreator(inputs, outputs, opParameter, static_cast(ctx)); } if (kernel == nullptr) { diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_fp16.cc index 9446cfd10e7..f3ffa37a057 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_fp16.cc @@ -104,7 +104,8 @@ static int ConvDwFp16Run(void *cdata, int task_id) { } int ConvolutionDepthwiseFp16CPUKernel::Run() { - auto ret = ParallelLaunch(this->context_->thread_pool_, ConvDwFp16Run, this, conv_param_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConvDwFp16Run, this, + conv_param_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "ConvDwFp16Run error: error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_slidewindow_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_slidewindow_fp16.cc index a4797092315..0be1221ef9d 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_slidewindow_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_slidewindow_fp16.cc @@ -155,7 +155,8 @@ int ConvolutionDepthwiseSWFp16CPUKernel::Run() { packed_output_ = output_ptr; } - ret = ParallelLaunch(this->context_->thread_pool_, ConvDwSWFp16Run, this, conv_param_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConvDwSWFp16Run, this, + conv_param_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "ConvDwSWFp16Run error: error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_fp16.cc index 3e15eec4ff8..49ebf8ab091 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_fp16.cc @@ -144,7 +144,8 @@ int ConvolutionFP16CPUKernel::Run() { return RET_ERROR; } - ret = ParallelLaunch(this->context_->thread_pool_, ConvolutionFp16Impl, this, thread_count_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConvolutionFp16Impl, this, + thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "conv fp16 error ret[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc index c7d0d89267d..b984a63d9fc 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc @@ -213,7 +213,8 @@ int ConvolutionWinogradFP16CPUKernel::Run() { return RET_ERROR; } - ret = ParallelLaunch(this->context_->thread_pool_, ConvolutionWinogradFp16Impl, this, thread_count_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ConvolutionWinogradFp16Impl, this, thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "conv winograd error error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/crop_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/crop_fp16.cc index 02622c55b75..b1ca2d63ec2 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/crop_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/crop_fp16.cc @@ -53,7 +53,8 @@ int CropFp16CPUKernel::Run() { input_ptr_ = reinterpret_cast(input_tensor->data_c()); output_ptr_ = reinterpret_cast(output_tensor->data_c()); - auto ret = ParallelLaunch(this->context_->thread_pool_, CropFp16Run, this, crop_para_->thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, CropFp16Run, this, + crop_para_->thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "ParallelLaunch failed: " << ret; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_depthwise_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_depthwise_fp16.cc index 99f4f21892f..68c7f99a99d 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_depthwise_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_depthwise_fp16.cc @@ -173,7 +173,8 @@ int DeconvolutionDepthwiseFp16CPUKernel::Run() { memset(output_ptr, 0, out_tensors_.at(kOutputIndex)->ElementsNum() * sizeof(float16_t)); packed_output_ = output_ptr; } - ret = ParallelLaunch(this->context_->thread_pool_, DeconvDwFp16Run, this, conv_param_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, DeconvDwFp16Run, this, + conv_param_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "DeconvDwFp16Run error: error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_fp16.cc index b57bf7a37ef..e829552771a 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_fp16.cc @@ -217,7 +217,8 @@ int DeConvolutionFp16CPUKernel::Run() { RowMajor2Col16MajorFp16Opt(batch_input_, pack_input_, input_plane_, conv_param_->input_channel_); - error_code = ParallelLaunch(this->context_->thread_pool_, DeConvFp16Run, this, thread_count_); + error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, DeConvFp16Run, + this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "deconv fp16 run error! error_code[" << error_code << "]"; } @@ -229,7 +230,7 @@ int DeConvolutionFp16CPUKernel::Run() { kernel::LiteKernel *CpuDeConvFp16KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *op_parameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(op_parameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_Conv2dTransposeFusion); @@ -238,12 +239,15 @@ kernel::LiteKernel *CpuDeConvFp16KernelCreator(const std::vector if (conv_param->group_ == 1) { if ((conv_param->stride_h_ != 1 || conv_param->stride_w_ != 1) && (conv_param->dilation_h_ == 1 && conv_param->dilation_w_ == 1)) { - kernel = new (std::nothrow) kernel::DeConvWinogradFp16CPUKernel(op_parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) kernel::DeConvWinogradFp16CPUKernel(op_parameter, inputs, outputs, + static_cast(ctx)); } else { - kernel = new (std::nothrow) kernel::DeConvolutionFp16CPUKernel(op_parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) + kernel::DeConvolutionFp16CPUKernel(op_parameter, inputs, outputs, static_cast(ctx)); } } else if (conv_param->group_ == conv_param->input_channel_ && conv_param->group_ == conv_param->output_channel_) { - kernel = new (std::nothrow) DeconvolutionDepthwiseFp16CPUKernel(op_parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) + DeconvolutionDepthwiseFp16CPUKernel(op_parameter, inputs, outputs, static_cast(ctx)); } if (kernel == nullptr) { diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_winograd_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_winograd_fp16.cc index b198df72187..e3d68b7e659 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_winograd_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/deconvolution_winograd_fp16.cc @@ -392,10 +392,12 @@ int DeConvWinogradFp16CPUKernel::Run() { nhwc_output_ = output_ptr + batch_index * deconv_param_->output_plane_ * conv_param_->output_channel_; ::memset(nc4hw4_output_, 0, deconv_param_->output_plane_ * deconv_param_->oc_div4_ * C4NUM * sizeof(float16_t)); - ParallelLaunch(this->context_->thread_pool_, DeConvWgFp16Run, this, deconv_param_->thread_num_); + ParallelLaunch(static_cast(this->context_)->thread_pool_, DeConvWgFp16Run, this, + deconv_param_->thread_num_); /*post bias activate and nhwc */ - ParallelLaunch(this->context_->thread_pool_, DeConvWgPostFp16Run, this, thread_num_hw_); + ParallelLaunch(static_cast(this->context_)->thread_pool_, DeConvWgPostFp16Run, this, + thread_num_hw_); } return RET_OK; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/gather_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/gather_fp16.cc index 8e40a1bccb0..c7699d1559b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/gather_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/gather_fp16.cc @@ -151,7 +151,8 @@ int GatherFp16CPUKernel::Run() { Float32ToFloat16(reinterpret_cast(input_tensor->data_c()), input_data_, input_tensor->ElementsNum()); } } - ret = ParallelLaunch(this->context_->thread_pool_, GatherRunFp16, this, op_parameter_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, GatherRunFp16, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Gather function error error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/instance_norm_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/instance_norm_fp16.cc index 363acbe80da..7f2b7c9897b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/instance_norm_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/instance_norm_fp16.cc @@ -109,7 +109,8 @@ int InstanceNormFp16Run(void *cdata, int task_id) { int InstanceNormFp16CPUKernel::Run() { src_data_ = reinterpret_cast(in_tensors_[0]->data_c()); dst_data_ = reinterpret_cast(out_tensors_[0]->data_c()); - auto ret = ParallelLaunch(this->context_->thread_pool_, InstanceNormFp16Run, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, InstanceNormFp16Run, + this, op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "InstanceNormFp16Run error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/log_softmax_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/log_softmax_fp16.cc index 379f61694f4..e484ec982fd 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/log_softmax_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/log_softmax_fp16.cc @@ -95,7 +95,8 @@ int LogSoftmaxLastAxisFp16Run(void *cdata, int task_id) { int LogSoftmaxFp16CPUKernel::Run() { if (in_plane_size_ == 1) { - auto ret = ParallelLaunch(this->context_->thread_pool_, LogSoftmaxLastAxisFp16Run, this, context_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, + LogSoftmaxLastAxisFp16Run, this, context_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "LogSoftmaxFp16CPUKernel ParallelLaunch failed, ret: " << ret; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/matmul_base_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/matmul_base_fp16.cc index a395b54b734..9d58d28aaf4 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/matmul_base_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/matmul_base_fp16.cc @@ -286,7 +286,8 @@ int MatmulBaseFP16CPUKernel::Run() { batch_b_ptr_ = b_pack_ptr_ + i * params_->deep_ * params_->col_align_; batch_c_ptr_ = c_ptr + i * params_->row_ * params_->col_; } - auto ret = ParallelLaunch(this->context_->thread_pool_, MatmulBaseFP16Run, this, thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, MatmulBaseFP16Run, + this, thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "MatmulBaseFloatRun failed"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/pad_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/pad_fp16.cc index 35eb07cc0bb..6573a340ac3 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/pad_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/pad_fp16.cc @@ -89,7 +89,8 @@ int PadFp16CPUKernel::Run() { output_[i] = pad_param_->constant_value_; } } - ret = ParallelLaunch(this->context_->thread_pool_, PadImpl, this, op_parameter_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, PadImpl, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "BatchnormRun error error_code[" << ret << "]"; } @@ -101,7 +102,8 @@ int PadFp16CPUKernel::Run() { return ret; } - ret = ParallelLaunch(this->context_->thread_pool_, MirrorPadImpl, this, context_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, MirrorPadImpl, this, + context_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Pad Reflect or Symmetric mode run error, error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/pooling_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/pooling_fp16.cc index bcc91cb2b9d..03491257a81 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/pooling_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/pooling_fp16.cc @@ -90,7 +90,8 @@ int PoolingFp16CPUKernel::Run() { fp16_input_ = reinterpret_cast(input_tensor->data_c()); fp16_output_ = reinterpret_cast(output_tensor->data_c()); - int error_code = ParallelLaunch(this->context_->thread_pool_, PoolingFp16Impl, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + PoolingFp16Impl, this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "pooling error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/power_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/power_fp16.cc index 9170f2926fc..587e48b3723 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/power_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/power_fp16.cc @@ -87,7 +87,8 @@ int PowerFp16CPUKernel::Run() { return ret; } } - auto ret = ParallelLaunch(this->context_->thread_pool_, PowerImplFp16, this, thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, PowerImplFp16, this, + thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "PowerFp16CPUKernel error: " << ret; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/quant_dtype_cast_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/quant_dtype_cast_fp16.cc index acf0f00e892..0edd6a26ecd 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/quant_dtype_cast_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/quant_dtype_cast_fp16.cc @@ -164,7 +164,8 @@ int QuantDTypeCastFp16CPUKernel::Run() { return RET_ERROR; } - auto ret = ParallelLaunch(this->context_->thread_pool_, QuantDTypeCastFP16Run, this, thread_n_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, + QuantDTypeCastFP16Run, this, thread_n_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Scale error error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/reduce_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/reduce_fp16.cc index 2a5928b02db..c7d0dfc2511 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/reduce_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/reduce_fp16.cc @@ -93,7 +93,8 @@ int ReduceFp16CPUKernel::Run() { outer_size_ = outer_sizes_.at(i); inner_size_ = inner_sizes_.at(i); axis_size_ = axis_sizes_.at(i); - auto error_code = ParallelLaunch(this->context_->thread_pool_, ReduceFp16Impl, this, context_->thread_num_); + auto error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ReduceFp16Impl, this, context_->thread_num_); if (error_code != RET_OK) { FreeTmpBuffer(); MS_LOG(ERROR) << "Reduce run error, error_code[" << error_code << "]"; @@ -108,7 +109,8 @@ int ReduceFp16CPUKernel::Run() { outer_size_ = outer_sizes_.back(); inner_size_ = inner_sizes_.back(); axis_size_ = axis_sizes_.back(); - auto error_code = ParallelLaunch(this->context_->thread_pool_, ReduceFp16Impl, this, context_->thread_num_); + auto error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ReduceFp16Impl, this, context_->thread_num_); if (error_code != RET_OK) { FreeTmpBuffer(); MS_LOG(ERROR) << "Reduce run error, error_code[" << error_code << "]"; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/scale_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/scale_fp16.cc index 325a2a837ec..3db787165ad 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/scale_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/scale_fp16.cc @@ -115,7 +115,8 @@ int ScaleFp16CPUKernel::Run() { return ret; } - ret = ParallelLaunch(this->context_->thread_pool_, ScaleFp16Run, this, op_parameter_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ScaleFp16Run, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Scale error error_code[" << ret << "]"; FreeTmpBuffer(); @@ -127,12 +128,12 @@ int ScaleFp16CPUKernel::Run() { } int ScaleFp16CPUKernel::MallocAssignTmpBuffer() { - scale_ = ConvertInputFp32toFp16(in_tensors_.at(1), context_); + scale_ = ConvertInputFp32toFp16(in_tensors_.at(1), static_cast(this->context_)); if (scale_ == nullptr) { return RET_ERROR; } if (in_tensors_.size() == 3) { - offset_ = ConvertInputFp32toFp16(in_tensors_.at(2), context_); + offset_ = ConvertInputFp32toFp16(in_tensors_.at(2), static_cast(this->context_)); if (offset_ == nullptr) { return RET_ERROR; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/slice_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/slice_fp16.cc index f878bd13f8a..15aef3e1a1f 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/slice_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/slice_fp16.cc @@ -63,7 +63,8 @@ int SliceFp16CPUKernel::Run() { DoSliceNoParallel(input_data, out_tensors_.at(0)->data_c(), param_, lite::DataTypeSize(kNumberTypeFloat16)); return RET_OK; } - auto ret = ParallelLaunch(this->context_->thread_pool_, SliceFp16Launch, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, SliceFp16Launch, + this, op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "fp16 slice launch fail!ret: " << ret; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/softmax_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/softmax_fp16.cc index 275861deaa1..ed6e14dfe22 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/softmax_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/softmax_fp16.cc @@ -95,7 +95,8 @@ int SoftmaxLastAxisFp16Run(void *cdata, int task_id) { int SoftmaxFp16CPUKernel::Run() { if (in_plane_size_ == 1) { - auto ret = ParallelLaunch(this->context_->thread_pool_, SoftmaxLastAxisFp16Run, this, context_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, + SoftmaxLastAxisFp16Run, this, context_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "SoftmaxFp16CPUKernel ParallelLaunch failed, ret: " << ret; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/stack_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/stack_fp16.cc index e050d872bf5..0abf39d5ea2 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/stack_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/stack_fp16.cc @@ -40,14 +40,15 @@ void StackFp16CPUKernel::InitMallocFlags() { int StackFp16CPUKernel::MallocAssignBuffer() { buffers_.resize(in_tensors_.size(), nullptr); for (size_t i = 0; i < in_tensors_.size(); ++i) { - buffers_.at(i) = reinterpret_cast(ConvertInputFp32toFp16(in_tensors_.at(i), context_)); + buffers_.at(i) = reinterpret_cast( + ConvertInputFp32toFp16(in_tensors_.at(i), static_cast(context_))); if (buffers_.at(i) == nullptr) { return RET_ERROR; } } out_buffer_ = nullptr; - out_buffer_ = MallocOutputFp16(out_tensors_.at(0), context_); + out_buffer_ = MallocOutputFp16(out_tensors_.at(0), static_cast(this->context_)); if (out_buffer_ == nullptr) { return RET_ERROR; } @@ -100,7 +101,8 @@ int StackFp16CPUKernel::Run() { } // run stack num_threads_ = MSMIN(UP_DIV(outer_size_, 64), this->context_->thread_num_); - ret = ParallelLaunch(this->context_->thread_pool_, StackRun, this, num_threads_); + ret = + ParallelLaunch(static_cast(this->context_)->thread_pool_, StackRun, this, num_threads_); if (ret != RET_OK) { MS_LOG(ERROR) << "StackBaseCPUKernel Run error: error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16_grad/activation_fp16_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp16_grad/activation_fp16_grad.cc index d5d9d117ec5..1f24ba18b7c 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16_grad/activation_fp16_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16_grad/activation_fp16_grad.cc @@ -79,7 +79,8 @@ int ActivationGradRunFp16(void *cdata, int task_id) { } int ActivationGradCPUKernelFp16::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, ActivationGradRunFp16, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ActivationGradRunFp16, this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Activation Grad function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16_grad/arithmetic_fp16_self_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp16_grad/arithmetic_fp16_self_grad.cc index 597250ee142..11795bc507d 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16_grad/arithmetic_fp16_self_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16_grad/arithmetic_fp16_self_grad.cc @@ -73,7 +73,8 @@ int ArithmeticSelfGradFp16Run(void *cdata, int task_id) { } int ArithmeticSelfGradFp16CPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, ArithmeticSelfGradFp16Run, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ArithmeticSelfGradFp16Run, this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Activation Grad function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/activation_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/activation_fp32.cc index 677f679c529..130ebb60f6b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/activation_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/activation_fp32.cc @@ -101,7 +101,8 @@ int ActivationRun(void *cdata, int task_id) { } int ActivationCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, ActivationRun, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, ActivationRun, + this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Activation function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/adder_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/adder_fp32.cc index 29a603238b4..9a1c8652608 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/adder_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/adder_fp32.cc @@ -122,7 +122,8 @@ int AdderCPUKernel::Run() { return RET_ERROR; } - int error_code = ParallelLaunch(this->context_->thread_pool_, AdderImpl, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, AdderImpl, + this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "adder error error_code[" << error_code << "]"; FreeTmpBuffer(); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/addn_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/addn_fp32.cc index d738f725dc3..2d0d95024da 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/addn_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/addn_fp32.cc @@ -89,7 +89,8 @@ int AddNCPUKernel::Run() { in1_addr_ = input0_data; in2_addr_ = input1_data; out_addr_ = output_data; - auto ret = ParallelLaunch(this->context_->thread_pool_, AddNLaunch, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, AddNLaunch, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "addn launch fail!ret: " << ret; return RET_ERROR; @@ -97,7 +98,8 @@ int AddNCPUKernel::Run() { for (size_t i = 2; i < in_tensors_.size(); ++i) { in1_addr_ = reinterpret_cast(in_tensors_[i]->MutableData()); in2_addr_ = output_data; - ret = ParallelLaunch(this->context_->thread_pool_, AddNLaunch, this, op_parameter_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, AddNLaunch, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "addn launch fail!ret: " << ret << ", input index: " << i; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_fp32.cc index 6c3e0e3d4b2..76418256aff 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_fp32.cc @@ -418,7 +418,8 @@ int ArithmeticCPUKernel::Run() { input1_ptr_ = in_tensors_[1]->data_c(); } output_ptr_ = out_tensors_[0]->data_c(); - return ParallelLaunch(this->context_->thread_pool_, ArithmeticsRun, this, context_->thread_num_); + return ParallelLaunch(static_cast(this->context_)->thread_pool_, ArithmeticsRun, this, + context_->thread_num_); } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_MulFusion, LiteKernelCreator) diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_self_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_self_fp32.cc index b852aa9034c..bdedb65ec9d 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_self_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_self_fp32.cc @@ -113,7 +113,8 @@ int ArithmeticSelfRun(void *cdata, int task_id) { } int ArithmeticSelfCPUKernel::Run() { - auto ret = ParallelLaunch(this->context_->thread_pool_, ArithmeticSelfRun, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ArithmeticSelfRun, + this, op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "ArithmeticSelfRun error error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/batchnorm_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/batchnorm_fp32.cc index 6ffc51e2f6a..90aa0230171 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/batchnorm_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/batchnorm_fp32.cc @@ -75,7 +75,8 @@ int BatchnormCPUKernel::InitConstTensor() { } int BatchnormCPUKernel::Run() { - auto ret = ParallelLaunch(this->context_->thread_pool_, BatchNormRun, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, BatchNormRun, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "BatchnormRun error error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/cast_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/cast_fp32.cc index 9fae4807a93..36e0b1b2f89 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/cast_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/cast_fp32.cc @@ -141,7 +141,8 @@ int CastCPUKernel::Run() { if (data_num_ == 0) { return RET_OK; } - return ParallelLaunch(this->context_->thread_pool_, CastRun, this, op_parameter_->thread_num_); + return ParallelLaunch(static_cast(this->context_)->thread_pool_, CastRun, this, + op_parameter_->thread_num_); } REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_Cast, LiteKernelCreator) diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/concat_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/concat_fp32.cc index b177f7846ca..a03359a94be 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/concat_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/concat_fp32.cc @@ -69,7 +69,8 @@ int ConcatRun(void *cdata, int task_id) { } int ConcatCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, ConcatRun, this, op_parameter_->thread_num_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConcatRun, + this, op_parameter_->thread_num_); return error_code; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_1x1_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_1x1_fp32.cc index ef8ad24c025..15f0e8226e5 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_1x1_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_1x1_fp32.cc @@ -247,10 +247,12 @@ int Convolution1x1CPUKernel::Run() { } if (multi_thread_by_hw_) { - ParallelLaunch(this->context_->thread_pool_, Convolution1x1RunHw, this, thread_count_); + ParallelLaunch(static_cast(this->context_)->thread_pool_, Convolution1x1RunHw, this, + thread_count_); } else { PackMatmulInput(input_ptr_, pack_input_, matmul_param_->row_, matmul_param_->deep_); - ParallelLaunch(this->context_->thread_pool_, Convolution1x1Run, this, thread_count_); + ParallelLaunch(static_cast(this->context_)->thread_pool_, Convolution1x1Run, this, + thread_count_); } } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_delegate_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_delegate_fp32.cc index 0564bd29ea4..def19d36ed5 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_delegate_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_delegate_fp32.cc @@ -138,16 +138,19 @@ kernel::LiteKernel *ConvolutionDelegateCPUKernel::CpuConvFp32KernelSelect() { kernel::LiteKernel *kernel = nullptr; auto conv_param = reinterpret_cast(op_parameter_); if (conv_param->kernel_h_ == 1 && conv_param->kernel_w_ == 1) { - kernel = new (std::nothrow) - kernel::Convolution1x1CPUKernel(op_parameter_, in_tensors_, out_tensors_, context_, origin_weight_, origin_bias_); + kernel = new (std::nothrow) kernel::Convolution1x1CPUKernel(op_parameter_, in_tensors_, out_tensors_, + static_cast(this->context_), + origin_weight_, origin_bias_); } else { int out_unit; if (CheckIfUseWinograd(&out_unit, conv_param)) { kernel = new (std::nothrow) kernel::ConvolutionWinogradCPUKernel( - op_parameter_, in_tensors_, out_tensors_, context_, out_unit, origin_weight_, origin_bias_); + op_parameter_, in_tensors_, out_tensors_, static_cast(this->context_), out_unit, + origin_weight_, origin_bias_); } else { - kernel = new (std::nothrow) - kernel::ConvolutionCPUKernel(op_parameter_, in_tensors_, out_tensors_, context_, origin_weight_, origin_bias_); + kernel = new (std::nothrow) kernel::ConvolutionCPUKernel(op_parameter_, in_tensors_, out_tensors_, + static_cast(this->context_), + origin_weight_, origin_bias_); } } @@ -214,7 +217,7 @@ kernel::LiteKernel *CpuGroupConvFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *op_parameter, - const InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(op_parameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_Conv2DFusion); MS_ASSERT(desc.data_type == kNumberTypeFloat32); @@ -222,11 +225,12 @@ kernel::LiteKernel *CpuConvFp32KernelCreator(const std::vector & auto conv_param = reinterpret_cast(op_parameter); kernel::LiteKernel *kernel = nullptr; if (conv_param->group_ == 1) { - kernel = new (std::nothrow) kernel::ConvolutionDelegateCPUKernel(op_parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) + kernel::ConvolutionDelegateCPUKernel(op_parameter, inputs, outputs, static_cast(ctx)); } else if (conv_param->group_ == conv_param->input_channel_ && conv_param->group_ == conv_param->output_channel_) { - kernel = CpuConvDwFp32KernelCreator(inputs, outputs, op_parameter, ctx); + kernel = CpuConvDwFp32KernelCreator(inputs, outputs, op_parameter, static_cast(ctx)); } else { - kernel = CpuGroupConvFp32KernelCreator(inputs, outputs, op_parameter, ctx); + kernel = CpuGroupConvFp32KernelCreator(inputs, outputs, op_parameter, static_cast(ctx)); } if (kernel == nullptr) { diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_3x3_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_3x3_fp32.cc index 0149af5d460..fddabdd583b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_3x3_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_3x3_fp32.cc @@ -126,7 +126,8 @@ int ConvolutionDepthwise3x3CPUKernel::Run() { auto output_tensor = out_tensors_.at(kOutputIndex); output_ptr_ = reinterpret_cast(output_tensor->data_c()); - auto ret = ParallelLaunch(this->context_->thread_pool_, ConvDw3x3Run, this, conv_param_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConvDw3x3Run, this, + conv_param_->thread_num_); ctx_->allocator->Free(buffer_); if (ret != RET_OK) { MS_LOG(ERROR) << "ConvDw3x3Run error: error_code[" << ret << "]"; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_fp32.cc index a550f4b1636..0a65ed63b0e 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_fp32.cc @@ -107,7 +107,8 @@ int ConvolutionDepthwiseCPUKernel::Run() { auto output_tensor = out_tensors_.at(kOutputIndex); output_ptr_ = reinterpret_cast(output_tensor->MutableData()); - auto ret = ParallelLaunch(this->context_->thread_pool_, ConvDwRun, this, conv_param_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConvDwRun, this, + conv_param_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "ConvDwRun error: error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_indirect_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_indirect_fp32.cc index d5e738a8de1..b5148c78d47 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_indirect_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_indirect_fp32.cc @@ -194,7 +194,8 @@ int ConvolutionDepthwiseIndirectCPUKernel::Run() { ConvDwInitIndirection(indirect_buffer_, packed_input_, zero_ptr_, conv_param_, step_h, step_w); - auto ret = ParallelLaunch(this->context_->thread_pool_, ConvDwIndirectRun, this, conv_param_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConvDwIndirectRun, + this, conv_param_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "ConvDwIndirectRun error: error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_slidewindow_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_slidewindow_fp32.cc index 5188d770881..e5fee3d2ad7 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_slidewindow_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise_slidewindow_fp32.cc @@ -163,7 +163,8 @@ int ConvolutionDepthwiseSWCPUKernel::Run() { packed_output_ = output_ptr; } - ret = ParallelLaunch(this->context_->thread_pool_, ConvDwSWRun, this, conv_param_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConvDwSWRun, this, + conv_param_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "ConvDwSWRun error: error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_fp32.cc index f762f012860..22c29e6007b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_fp32.cc @@ -152,7 +152,8 @@ int ConvolutionCPUKernel::Run() { PackWeight(); } - ret = ParallelLaunch(this->context_->thread_pool_, ConvolutionImpl, this, thread_count_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConvolutionImpl, this, + thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "conv error error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_winograd_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_winograd_fp32.cc index 2da7dbe6898..cdbdbf5d4b7 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_winograd_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_winograd_fp32.cc @@ -219,7 +219,8 @@ int ConvolutionWinogradCPUKernel::Run() { InitWeightBias(); } - ret = ParallelLaunch(this->context_->thread_pool_, ConvolutionWinogradImpl, this, thread_count_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConvolutionWinogradImpl, + this, thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "conv winograd error error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/crop_and_resize_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/crop_and_resize_fp32.cc index 8fe3d6fc134..d311e159e4a 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/crop_and_resize_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/crop_and_resize_fp32.cc @@ -151,7 +151,8 @@ int CropAndResizeCPUKernel::Run() { return ret; } - int error_code = ParallelLaunch(this->context_->thread_pool_, CropAndResizeImpl, this, context_->thread_num_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + CropAndResizeImpl, this, context_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "CropAndResize run error, error_code[" << error_code << "]"; FreeTmpBuffer(); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/crop_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/crop_fp32.cc index ab2e1d46a06..da6a6a8951d 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/crop_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/crop_fp32.cc @@ -62,7 +62,8 @@ int CropCPUKernel::Run() { return RET_OK; } - auto ret = ParallelLaunch(this->context_->thread_pool_, CropLaunch, this, crop_para_->thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, CropLaunch, this, + crop_para_->thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "Crop launch fail!ret: " << ret; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_depthwise_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_depthwise_fp32.cc index a6a75ad707d..fc208f012ee 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_depthwise_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_depthwise_fp32.cc @@ -168,7 +168,8 @@ int DeconvolutionDepthwiseCPUKernel::Run() { packed_output_ = output_addr; } - ret = ParallelLaunch(this->context_->thread_pool_, DeconvDwRun, this, conv_param_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, DeconvDwRun, this, + conv_param_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "DeconvDwRun error: error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_fp32.cc index 7b2426bed26..4ea7f43c3c2 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_fp32.cc @@ -222,7 +222,8 @@ int DeConvolutionCPUKernel::Run() { RowMajor2Col12Major(input_ptr_, pack_input_, matmul_param_->row_, matmul_param_->deep_); #endif - error_code = ParallelLaunch(this->context_->thread_pool_, DeConvFp32Run, this, thread_count_); + error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, DeConvFp32Run, + this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "deconv fp32 run error! error_code[" << error_code << "]"; FreeRunBuf(); @@ -236,7 +237,7 @@ int DeConvolutionCPUKernel::Run() { kernel::LiteKernel *CpuDeConvFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *op_parameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(op_parameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_Conv2dTransposeFusion); @@ -245,12 +246,15 @@ kernel::LiteKernel *CpuDeConvFp32KernelCreator(const std::vector if (conv_param->group_ == 1) { if ((conv_param->stride_h_ != 1 || conv_param->stride_w_ != 1) && (conv_param->dilation_w_ == 1 && conv_param->dilation_h_ == 1)) { - kernel = new (std::nothrow) kernel::DeConvolutionWinogradCPUKernel(op_parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) kernel::DeConvolutionWinogradCPUKernel(op_parameter, inputs, outputs, + static_cast(ctx)); } else { - kernel = new (std::nothrow) kernel::DeConvolutionCPUKernel(op_parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) + kernel::DeConvolutionCPUKernel(op_parameter, inputs, outputs, static_cast(ctx)); } } else if (conv_param->group_ == conv_param->input_channel_ && conv_param->group_ == conv_param->output_channel_) { - kernel = new (std::nothrow) kernel::DeconvolutionDepthwiseCPUKernel(op_parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) kernel::DeconvolutionDepthwiseCPUKernel(op_parameter, inputs, outputs, + static_cast(ctx)); } else { MS_LOG(ERROR) << "deconv do not support group deconv!"; kernel = nullptr; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_winograd_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_winograd_fp32.cc index 90a4b766bfd..d22a146cfdf 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_winograd_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/deconvolution_winograd_fp32.cc @@ -411,10 +411,12 @@ int DeConvolutionWinogradCPUKernel::Run() { nhwc_output_ = src_out + batch_index * deconv_param_->output_plane_ * conv_param_->output_channel_; ::memset(nc4hw4_output_, 0, deconv_param_->output_plane_ * deconv_param_->oc_div4_ * C4NUM * sizeof(float)); - ParallelLaunch(this->context_->thread_pool_, DeConvWgFp32Run, this, deconv_param_->thread_num_); + ParallelLaunch(static_cast(this->context_)->thread_pool_, DeConvWgFp32Run, this, + deconv_param_->thread_num_); /*post bias activate and nhwc */ - ParallelLaunch(this->context_->thread_pool_, DeConvWgPostFp32Run, this, thread_num_hw_); + ParallelLaunch(static_cast(this->context_)->thread_pool_, DeConvWgPostFp32Run, this, + thread_num_hw_); } FreeRunBuf(); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/elu_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/elu_fp32.cc index 4200b23145b..56649e3ff95 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/elu_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/elu_fp32.cc @@ -55,7 +55,8 @@ int EluRun(void *cdata, int task_id) { } int EluCPUKernel::Run() { - auto ret = ParallelLaunch(this->context_->thread_pool_, EluRun, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, EluRun, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Elu error: error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/embedding_lookup_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/embedding_lookup_fp32.cc index cc5b643f33a..0b94fc6de28 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/embedding_lookup_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/embedding_lookup_fp32.cc @@ -87,7 +87,8 @@ int EmbeddingLookupCPUKernel::Run() { memcpy(input_addr_ + dest_loc, input_t, sizeof(float) * in_tensors_.at(i)->ElementsNum()); dest_loc += in_tensors_.at(i)->ElementsNum(); } - auto ret = ParallelLaunch(this->context_->thread_pool_, EmbeddingLookupRun, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, EmbeddingLookupRun, + this, op_parameter_->thread_num_); FreeRunBuff(); if (ret != RET_OK) { MS_LOG(ERROR) << "EmbeddingLookup error: error_code[" << ret << "]"; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/exp_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/exp_fp32.cc index 8156b2d345f..84347856787 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/exp_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/exp_fp32.cc @@ -73,7 +73,8 @@ int ExpCPUKernel::Run() { output_addr_ = reinterpret_cast(out_tensors_.front()->MutableData()); exp_parameter_->element_num_ = in_tensors_.front()->ElementsNum(); - auto ret = ParallelLaunch(this->context_->thread_pool_, ExpRun, this, exp_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ExpRun, this, + exp_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Exp error: error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/fill_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/fill_fp32.cc index 1e62da62e63..0c99b609197 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/fill_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/fill_fp32.cc @@ -91,7 +91,8 @@ int FillCPUKernel::Run() { MS_LOG(ERROR) << "unsupported fill data type " << fill_input->data_type(); return RET_ERROR; } - auto ret = ParallelLaunch(this->context_->thread_pool_, FillRun, this, thread_sz_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, FillRun, this, + thread_sz_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "FillRun error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/fused_batchnorm_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/fused_batchnorm_fp32.cc index 1df0ee7af1b..91436a3debb 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/fused_batchnorm_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/fused_batchnorm_fp32.cc @@ -93,7 +93,8 @@ int FusedBatchnormCPUKernel::Run() { trained_ = true; // trained at least once } - auto ret = ParallelLaunch(this->context_->thread_pool_, BatchNormRun, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, BatchNormRun, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "BatchnormRun error error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/gatherNd_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/gatherNd_fp32.cc index 8d8c62c89b8..219cfe8b8a2 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/gatherNd_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/gatherNd_fp32.cc @@ -128,7 +128,8 @@ int GatherNdCPUKernel::Run() { in_ptr_ = reinterpret_cast(in_tensors_.front()->MutableData()); out_ptr_ = reinterpret_cast(out_tensors_.front()->MutableData()); InitOffset(); - auto ret = ParallelLaunch(this->context_->thread_pool_, GatherNdRun, this, thread_sz_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, GatherNdRun, this, + thread_sz_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "gatherNd error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/gather_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/gather_fp32.cc index 0a2d6c80cd5..6e2bebbad92 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/gather_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/gather_fp32.cc @@ -92,7 +92,8 @@ int GatherCPUKernel::Run() { return ret; } - ret = ParallelLaunch(this->context_->thread_pool_, GatherRun, this, op_parameter_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, GatherRun, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Gather function error error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/instance_norm_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/instance_norm_fp32.cc index 4d6f005b604..54cfa9fef88 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/instance_norm_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/instance_norm_fp32.cc @@ -66,7 +66,8 @@ int InstanceNormCPUKernel::Run() { gamma_data_ = reinterpret_cast(in_tensors_.at(1)->data_c()); beta_data_ = reinterpret_cast(in_tensors_.at(2)->data_c()); dst_data_ = reinterpret_cast(out_tensors_.at(0)->data_c()); - auto ret = ParallelLaunch(this->context_->thread_pool_, InstanceNormRun, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, InstanceNormRun, + this, op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "InstanceNormRun error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/l2_norm_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/l2_norm_fp32.cc index 3eed8ce64e7..bd35bee22eb 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/l2_norm_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/l2_norm_fp32.cc @@ -146,7 +146,8 @@ int L2NormCPUKernel::Run() { output_ptr_ = reinterpret_cast(out_tensors_.at(kOutputIndex)->MutableData()); if (l2_norm_param_->axis_num_ == 0 || l2_norm_param_->axis_num_ == input_shape.size()) { // all axis - auto ret = ParallelLaunch(this->context_->thread_pool_, SquareSumRun, this, context_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, SquareSumRun, this, + context_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "L2Norm error: error_code[" << ret << "]"; return RET_ERROR; @@ -156,13 +157,15 @@ int L2NormCPUKernel::Run() { sum += tmp_sum_[i]; } sqrt_sum_ = sqrt(sum > l2_norm_param_->epsilon_ ? sum : l2_norm_param_->epsilon_); - ret = ParallelLaunch(this->context_->thread_pool_, L2NormRun, this, context_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, L2NormRun, this, + context_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "L2Norm error: error_code[" << ret << "]"; return RET_ERROR; } } else if (l2_norm_param_->axis_num_ == 1 && l2_norm_param_->axis_[0] == static_cast(input_shape.size()) - 1) { - auto ret = ParallelLaunch(this->context_->thread_pool_, L2NormTrailingAxisRun, this, context_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, + L2NormTrailingAxisRun, this, context_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "L2Norm error: error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/layer_norm_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/layer_norm_fp32.cc index 05c8187288b..8def08a2bbc 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/layer_norm_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/layer_norm_fp32.cc @@ -92,7 +92,8 @@ int LayerNormCPUKernel::Run() { mean_data_ = reinterpret_cast(context_->allocator->Malloc(param_->norm_outer_size_ * sizeof(float))); var_data_ = reinterpret_cast(context_->allocator->Malloc(param_->norm_outer_size_ * sizeof(float))); } - ret = ParallelLaunch(this->context_->thread_pool_, LayerNormRun, this, op_parameter_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, LayerNormRun, this, + op_parameter_->thread_num_); if (out_tensors_.size() != 3) { context_->allocator->Free(mean_data_); context_->allocator->Free(var_data_); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/local_response_norm_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/local_response_norm_fp32.cc index 4fa01c9c163..b3293ce3c76 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/local_response_norm_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/local_response_norm_fp32.cc @@ -74,7 +74,8 @@ int LocalResponseNormRun(void *cdata, int task_id) { } int LocalResponseNormCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, LocalResponseNormRun, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + LocalResponseNormRun, this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "LocalResponseNorm function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/log_softmax_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/log_softmax_fp32.cc index e9f5eac9576..5bb6863ff98 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/log_softmax_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/log_softmax_fp32.cc @@ -96,7 +96,8 @@ int LogSoftmaxLastAxisRun(void *cdata, int task_id) { int LogSoftmaxCPUKernel::Run() { int ret = RET_OK; if (in_plane_size_ == 1) { - ret = ParallelLaunch(this->context_->thread_pool_, LogSoftmaxLastAxisRun, this, context_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, LogSoftmaxLastAxisRun, + this, context_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "LogSoftmaxCPUKernel ParallelLaunch failed, ret: " << ret; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/lsh_projection_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/lsh_projection_fp32.cc index 77b77813c7c..50c4c5e5e54 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/lsh_projection_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/lsh_projection_fp32.cc @@ -61,7 +61,8 @@ int LshProjectionCPUKernel::Run() { if (ret != RET_OK) { return ret; } - ret = ParallelLaunch(this->context_->thread_pool_, LshProjectionRun, this, op_parameter_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, LshProjectionRun, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "LshProjection kernel parallel launch failed"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/matmul_fp32_base.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/matmul_fp32_base.cc index a2a5a88d64d..17d0d5481d4 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/matmul_fp32_base.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/matmul_fp32_base.cc @@ -332,7 +332,8 @@ int MatmulFp32BaseCPUKernel::Run() { batch_b_ptr_ = b_pack_ptr_ + i * params_->deep_ * params_->col_align_; batch_c_ptr_ = c_ptr + i * params_->row_ * params_->col_; } - auto ret = ParallelLaunch(this->context_->thread_pool_, MatmulBaseFloatRun, this, thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, MatmulBaseFloatRun, + this, thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "MatmulBaseFloatRun failed"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/one_hot_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/one_hot_fp32.cc index d6647c63de5..a3cae5ce29f 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/one_hot_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/one_hot_fp32.cc @@ -181,7 +181,8 @@ int OneHotCPUKernel::GetParams() { } int OneHotCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, RunOneHot, this, context_->thread_num_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, RunOneHot, + this, context_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "OneHot function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/pad_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/pad_fp32.cc index ec51c8b0472..73eb758ae4d 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/pad_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/pad_fp32.cc @@ -395,7 +395,8 @@ int PadCPUKernel::Run() { output_data[i] = pad_param_->constant_value_; } } - error_code = ParallelLaunch(this->context_->thread_pool_, PadImpl, this, context_->thread_num_); + error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, PadImpl, this, + context_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Pad run error, error_code[" << error_code << "]"; return RET_ERROR; @@ -408,7 +409,8 @@ int PadCPUKernel::Run() { return error_code; } - error_code = ParallelLaunch(this->context_->thread_pool_, MirrorPadImpl, this, context_->thread_num_); + error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, MirrorPadImpl, + this, context_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Pad Reflect or Symmetric mode run error, error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/pooling_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/pooling_fp32.cc index 0ccbf35cae4..74cc4880e6a 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/pooling_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/pooling_fp32.cc @@ -85,7 +85,8 @@ int PoolingImpl(void *cdata, int task_id) { } int PoolingCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, PoolingImpl, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, PoolingImpl, + this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "pooling error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/power_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/power_fp32.cc index baf56197a96..262af77ab2b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/power_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/power_fp32.cc @@ -41,7 +41,8 @@ int PowerImpl(void *cdata, int task_id) { } int PowerCPUKernel::Run() { - auto ret = ParallelLaunch(this->context_->thread_pool_, PowerImpl, this, thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, PowerImpl, this, + thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "PowerCPUKernel error: " << ret; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/prelu_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/prelu_fp32.cc index 9e503c64866..e80baa2c536 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/prelu_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/prelu_fp32.cc @@ -93,7 +93,8 @@ int PReluCPUKernel::Run() { auto negative_slope_tensor = in_tensors_.at(1); prelu_param_->slope_ = reinterpret_cast(negative_slope_tensor->data_c()); - auto ret = ParallelLaunch(this->context_->thread_pool_, PReluRun, this, prelu_param_->op_parameter_.thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, PReluRun, this, + prelu_param_->op_parameter_.thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "PRelu Run error: error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/reduce_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/reduce_fp32.cc index c221536bfa3..8c4927f53f3 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/reduce_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/reduce_fp32.cc @@ -117,7 +117,8 @@ int ReduceCPUKernel::Run() { outer_size_ = outer_sizes_.at(i); inner_size_ = inner_sizes_.at(i); axis_size_ = axis_sizes_.at(i); - auto error_code = ParallelLaunch(this->context_->thread_pool_, ReduceImpl, this, context_->thread_num_); + auto error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, ReduceImpl, + this, context_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Reduce run error, error_code[" << error_code << "]"; FreeTmpBuffer(); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/resize_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/resize_fp32.cc index 99abfcef2f5..ef34cb5994b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/resize_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/resize_fp32.cc @@ -205,7 +205,8 @@ int ResizeCPUKernel::RunImpl(int task_id) { } int ResizeCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, ResizeImpl, this, context_->thread_num_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, ResizeImpl, + this, context_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Resize run error, error_code[" << error_code << "]"; FreeTmpBuffer(); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/reverse_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/reverse_fp32.cc index 4a9189979a6..17d288cbedd 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/reverse_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/reverse_fp32.cc @@ -129,7 +129,8 @@ int ReverseCPUKernel::DoReverse(int task_id) { int ReverseCPUKernel::Run() { in_ptr_ = reinterpret_cast(in_tensors_[0]->MutableData()); out_ptr_ = reinterpret_cast(out_tensors_[0]->MutableData()); - auto ret = ParallelLaunch(this->context_->thread_pool_, ReverseRun, this, thread_sz_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ReverseRun, this, + thread_sz_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "Reverse run error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/roi_pooling_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/roi_pooling_fp32.cc index ba6e8590af3..5003fee3775 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/roi_pooling_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/roi_pooling_fp32.cc @@ -101,7 +101,8 @@ int ROIPoolingCPUKernel::Run() { in_ptr_ = reinterpret_cast(in_tensors_.front()->MutableData()); out_ptr_ = reinterpret_cast(out_tensors_.front()->MutableData()); roi_ptr_ = reinterpret_cast(in_tensors_.at(1)->MutableData()); - auto ret = ParallelLaunch(this->context_->thread_pool_, ROIPoolingRun, this, param_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ROIPoolingRun, this, + param_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "ROIPooling error: error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/scale_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/scale_fp32.cc index 2a07586e7bd..0de56f6af0b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/scale_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/scale_fp32.cc @@ -188,7 +188,8 @@ int ScaleCPUKernel::Run() { auto out_tensor = out_tensors_.front(); output_ptr_ = reinterpret_cast(out_tensor->MutableData()); - auto ret = ParallelLaunch(this->context_->thread_pool_, ScaleRun, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ScaleRun, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Scale error error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/scatter_nd_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/scatter_nd_fp32.cc index 3fe4d6f405b..d16b5de59a7 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/scatter_nd_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/scatter_nd_fp32.cc @@ -149,7 +149,8 @@ int ScatterNDRun(void *cdata, int task_id) { } int ScatterNDCPUKernel::Run() { - auto ret = ParallelLaunch(this->context_->thread_pool_, ScatterNDRun, this, thread_n_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ScatterNDRun, this, + thread_n_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "ScatterND error error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/softmax_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/softmax_fp32.cc index 619d5ceae4c..4fc23814420 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/softmax_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/softmax_fp32.cc @@ -96,7 +96,8 @@ int SoftmaxLastAxisRun(void *cdata, int task_id) { int SoftmaxCPUKernel::Run() { int ret = RET_OK; if (in_plane_size_ == 1) { - ret = ParallelLaunch(this->context_->thread_pool_, SoftmaxLastAxisRun, this, context_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, SoftmaxLastAxisRun, + this, context_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "SoftmaxCPUKernel ParallelLaunch failed, ret: " << ret; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/space_to_batch_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/space_to_batch_fp32.cc index d590ab7d9f0..210dac2d6ae 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/space_to_batch_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/space_to_batch_fp32.cc @@ -102,7 +102,8 @@ int SpaceToBatchCPUKernel::Run() { } } - ParallelLaunch(this->context_->thread_pool_, SpaceToBatchFp32Run, this, op_parameter_->thread_num_); + ParallelLaunch(static_cast(this->context_)->thread_pool_, SpaceToBatchFp32Run, this, + op_parameter_->thread_num_); return RET_OK; } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/space_to_depth_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/space_to_depth_fp32.cc index d401085035d..84b16ebceef 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/space_to_depth_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/space_to_depth_fp32.cc @@ -93,7 +93,8 @@ int SpaceToDepthCPUKernel::Run() { input_ptr_ = reinterpret_cast(in_tensors_.at(0)->data_c()); output_ptr_ = reinterpret_cast(out_tensors_.at(0)->data_c()); if (in_tensors_.at(0)->format() == schema::Format::Format_NHWC) { - auto ret = ParallelLaunch(this->context_->thread_pool_, SpaceToDepthRun, this, thread_h_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, SpaceToDepthRun, + this, thread_h_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "SpaceToDepth error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/sparse_to_dense_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/sparse_to_dense_fp32.cc index 57f317b2f91..5be46ecbcbc 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/sparse_to_dense_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/sparse_to_dense_fp32.cc @@ -175,7 +175,8 @@ int SparseToDenseCPUKernel::Run() { } output_data = reinterpret_cast(out_tensors_.at(0)->MutableData()); count_unit_ = thread_count_ > 1 ? UP_DIV(index_num, thread_count_) : index_num; - ret = ParallelLaunch(this->context_->thread_pool_, SparseToDenseRun, this, s2d_param->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, SparseToDenseRun, this, + s2d_param->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "SparseToDenseRun error: error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/transpose_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/transpose_fp32.cc index cff1de66c01..61286ea34c5 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/transpose_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/transpose_fp32.cc @@ -159,7 +159,8 @@ int TransposeCPUKernel::Run() { thread_count_ = op_parameter_->thread_num_; GetNHNCTransposeFunc(in_tensor, out_tensor, param_); if (NHNCTransposeFunc_ != nullptr) { - auto ret = ParallelLaunch(this->context_->thread_pool_, TransposeImpl, this, thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, TransposeImpl, + this, thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "NHNCTransposeFunc_ is error!"; } @@ -187,7 +188,8 @@ int TransposeCPUKernel::Run() { } int ret; if (dims_ > MAX_TRANSPOSE_DIM_SIZE) { - ret = ParallelLaunch(this->context_->thread_pool_, TransposeImpl, this, thread_count_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, TransposeImpl, this, + thread_count_); } else { ret = DoTransposeFp32(in_data_, out_data_, out_shape_, param_); } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/where_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/where_fp32.cc index 8c23b32b46a..8fcc69dafde 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/where_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/where_fp32.cc @@ -133,7 +133,8 @@ int WhereCPUKernel::RunWithTripleInputs() { MS_LOG(ERROR) << "Error, inputs' length are zero !!!"; return RET_ERROR; } - auto ret = ParallelLaunch(this->context_->thread_pool_, WhereRun, this, where_param_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, WhereRun, this, + where_param_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "WhereDwRun error: error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/activation_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/activation_grad.cc index 2f9dd9b7b6c..aa0cfe7f4f0 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/activation_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/activation_grad.cc @@ -98,7 +98,8 @@ int ActivationGradRun(void *cdata, int task_id) { } int ActivationGradCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, ActivationGradRun, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ActivationGradRun, this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Activation Grad function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/adam.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/adam.cc index 553408c78c9..41c54e12469 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/adam.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/adam.cc @@ -102,7 +102,8 @@ int AdamRun(void *cdata, int task_id) { } int AdamCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, AdamRun, this, thread_count_); + int error_code = + ParallelLaunch(static_cast(this->context_)->thread_pool_, AdamRun, this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Adam function error error_code[" << error_code << "]"; return RET_ERROR; @@ -145,9 +146,10 @@ int AdamCPUKernel::OptimizerStep() { kernel::LiteKernel *CpuAdamFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(desc.type == schema::PrimitiveType_Adam); - auto *kernel = new (std::nothrow) AdamCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = + new (std::nothrow) AdamCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new AdamCPUKernel fail!"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/apply_momentum.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/apply_momentum.cc index b555b51132d..af718e486f4 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/apply_momentum.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/apply_momentum.cc @@ -82,7 +82,8 @@ int ApplyMomentumRun(void *cdata, int task_id) { } int ApplyMomentumCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, ApplyMomentumRun, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ApplyMomentumRun, this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Apply Momentum function error error_code[" << error_code << "]"; return RET_ERROR; @@ -119,10 +120,11 @@ int ApplyMomentumCPUKernel::OptimizerStep() { kernel::LiteKernel *CpuApplyMomentumFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, - OpParameter *opParameter, const lite::InnerContext *ctx, + OpParameter *opParameter, const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(desc.type == schema::PrimitiveType_ApplyMomentum); - auto *kernel = new (std::nothrow) ApplyMomentumCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = new (std::nothrow) + ApplyMomentumCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new ApplyMomentumCPUKernel fail!"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/arithmetic_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/arithmetic_grad.cc index 9187d26da93..1037bd63b68 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/arithmetic_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/arithmetic_grad.cc @@ -227,7 +227,8 @@ int ArithmeticGradRun(void *cdata, int task_id) { } int ArithmeticGradCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, ArithmeticGradRun, this, 1); + int error_code = + ParallelLaunch(static_cast(this->context_)->thread_pool_, ArithmeticGradRun, this, 1); if (error_code != RET_OK) { MS_LOG(ERROR) << "Arithmetic Grad function error error_code[" << error_code << "]"; return RET_ERROR; @@ -237,13 +238,14 @@ int ArithmeticGradCPUKernel::Run() { kernel::LiteKernel *CpuArithmeticGradFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, - OpParameter *opParameter, const lite::InnerContext *ctx, + OpParameter *opParameter, const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(nullptr != opParameter); if (opParameter == nullptr) { return nullptr; } - auto *kernel = new (std::nothrow) ArithmeticGradCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = new (std::nothrow) + ArithmeticGradCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new ArithmeticGradCPUKernel fail!"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/arithmetic_self_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/arithmetic_self_grad.cc index ae4c32906bd..0e445c18100 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/arithmetic_self_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/arithmetic_self_grad.cc @@ -81,7 +81,8 @@ int ArithmeticSelfGradCPUKernel::DoArithmeticSelfGrad(int task_id) { int ArithmeticSelfGradCPUKernel::ReSize() { return RET_OK; } int ArithmeticSelfGradCPUKernel::Run() { - auto ret = ParallelLaunch(this->context_->thread_pool_, ArithmeticSelfGradRun, this, thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ArithmeticSelfGradRun, this, thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "parallel launch fail!ret: " << ret; return ret; @@ -92,13 +93,14 @@ int ArithmeticSelfGradCPUKernel::Run() { kernel::LiteKernel *CpuArithmeticSelfGradFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, - OpParameter *param, const lite::InnerContext *ctx, + OpParameter *param, const lite::Context *ctx, const kernel::KernelKey &desc) { if (param == nullptr) { MS_LOG(ERROR) << "input parameter is nullptr!"; return nullptr; } - auto *kernel = new (std::nothrow) ArithmeticSelfGradCPUKernel(param, inputs, outputs, ctx); + auto *kernel = new (std::nothrow) + ArithmeticSelfGradCPUKernel(param, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new ArithmeticSelfGradCPUKernel fail!"; free(param); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/assign.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/assign.cc index 734b6ab3deb..28e1f8b163a 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/assign.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/assign.cc @@ -59,7 +59,8 @@ int AssignRun(void *cdata, int task_id) { } int AssignCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, AssignRun, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, AssignRun, + this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Assign function error error_code[" << error_code << "]"; return RET_ERROR; @@ -71,9 +72,10 @@ int AssignCPUKernel::Init() { return RET_OK; } kernel::LiteKernel *CpuAssignFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(desc.type == schema::PrimitiveType_Assign); - auto *kernel = new (std::nothrow) AssignCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = + new (std::nothrow) AssignCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new AssignCPUKernel fail!"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/bias_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/bias_grad.cc index d70cb3a5a53..0d95991cef6 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/bias_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/bias_grad.cc @@ -83,7 +83,8 @@ int BiasGradRun(void *cdata, int task_id) { } int BiasGradCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, BiasGradRun, this, 1); + int error_code = + ParallelLaunch(static_cast(this->context_)->thread_pool_, BiasGradRun, this, 1); if (error_code != RET_OK) { MS_LOG(ERROR) << "bias function error error_code[" << error_code << "]"; return RET_ERROR; @@ -93,10 +94,11 @@ int BiasGradCPUKernel::Run() { kernel::LiteKernel *CpuBiasGradFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_BiasAddGrad); - auto *kernel = new (std::nothrow) BiasGradCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = + new (std::nothrow) BiasGradCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new BiasGradCPUKernel fail!"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/bn_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/bn_grad.cc index b8b0428d844..cdbf05ec939 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/bn_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/bn_grad.cc @@ -135,7 +135,8 @@ int BNGradCPUKernel::Run() { stage_ = 0; thread_num_ = context_->thread_num_; if (thread_num_ == 1) { - int error_code = ParallelLaunch(this->context_->thread_pool_, BNGradRun, this, thread_num_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, BNGradRun, + this, thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "BN function error error_code[" << error_code << "]"; return RET_ERROR; @@ -144,7 +145,8 @@ int BNGradCPUKernel::Run() { const std::vector threads = {thread_num_, 1, thread_num_}; for (size_t stage = 0; stage < threads.size(); stage++) { stage_ = static_cast(stage); - int error_code = ParallelLaunch(this->context_->thread_pool_, BNGradRun, this, threads.at(stage)); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, BNGradRun, + this, threads.at(stage)); if (error_code != RET_OK) { MS_LOG(ERROR) << "BN function error error_code[" << error_code << "]"; return RET_ERROR; @@ -156,10 +158,11 @@ int BNGradCPUKernel::Run() { kernel::LiteKernel *CpuBNGradFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_BatchNormGrad); - auto *kernel = new (std::nothrow) BNGradCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = + new (std::nothrow) BNGradCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new BNGradCPUKernel fail!"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution.cc index 5659842cc16..51328f54e45 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution.cc @@ -166,7 +166,8 @@ int ConvolutionTrainRun(void *cdata, int task_id) { } int ConvolutionTrainCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, ConvolutionTrainRun, this, 1); + int error_code = + ParallelLaunch(static_cast(this->context_)->thread_pool_, ConvolutionTrainRun, this, 1); if (error_code != RET_OK) { MS_LOG(ERROR) << "conv train function error error_code[" << error_code << "]"; return RET_ERROR; @@ -176,11 +177,12 @@ int ConvolutionTrainCPUKernel::Run() { kernel::LiteKernel *CpuConvTrainFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_Conv2DFusion); - auto *kernel = new (std::nothrow) ConvolutionTrainCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = new (std::nothrow) + ConvolutionTrainCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new ConvolutionTrainCPUKernel failed!"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution.h b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution.h index d77ed8983d6..6ffc508f902 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution.h +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution.h @@ -46,7 +46,7 @@ class ConvolutionTrainCPUKernel : public LiteKernel { kernel::LiteKernel *CpuConvTrainFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc); + const lite::Context *ctx, const kernel::KernelKey &desc); } // namespace mindspore::kernel #endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_FP32_GRAD_CONVOLUTION_H_ diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution_grad_filter.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution_grad_filter.cc index 736d0b69e16..57cc3fc9e88 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution_grad_filter.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution_grad_filter.cc @@ -192,7 +192,8 @@ int ConvolutionGradFilterCPUKernel::Run() { auto *out_dw = out_tensors_.at(0); auto dw_addr = reinterpret_cast(out_dw->MutableData()); memset(dw_addr, 0, out_dw->Size()); - int error_code = ParallelLaunch(this->context_->thread_pool_, ConvolutionGradFilterRun, this, context_->thread_num_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ConvolutionGradFilterRun, this, context_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "conv filter function error error_code[" << error_code << "]"; return RET_ERROR; @@ -202,12 +203,13 @@ int ConvolutionGradFilterCPUKernel::Run() { kernel::LiteKernel *CpuConvGradFilterFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, - OpParameter *opParameter, const lite::InnerContext *ctx, + OpParameter *opParameter, const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_Conv2DBackpropFilterFusion); - auto *kernel = new (std::nothrow) ConvolutionGradFilterCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = new (std::nothrow) + ConvolutionGradFilterCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new kernel fail!"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution_grad_input.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution_grad_input.cc index 9291db8cd10..1c4fb8c3dff 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution_grad_input.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/convolution_grad_input.cc @@ -144,7 +144,8 @@ int ConvolutionGradInputCPUKernel::Run() { auto *out_dx = out_tensors_.at(0); auto dx_addr = reinterpret_cast(out_dx->MutableData()); memset(dx_addr, 0, sizeof(float) * batch * in_ch * in_h * in_w); - int error_code = ParallelLaunch(this->context_->thread_pool_, ConvolutionGradInputRun, this, context_->thread_num_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ConvolutionGradInputRun, this, context_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "bias function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/deconvolution_grad_filter.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/deconvolution_grad_filter.cc index 42f377a9d14..909ef3b682d 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/deconvolution_grad_filter.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/deconvolution_grad_filter.cc @@ -121,7 +121,8 @@ int DeConvolutionGradFilterRun(void *cdata, int task_id) { } int DeConvolutionGradFilterCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, DeConvolutionGradFilterRun, this, 1); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + DeConvolutionGradFilterRun, this, 1); if (error_code != RET_OK) { MS_LOG(ERROR) << "conv filter function error error_code[" << error_code << "]"; return RET_ERROR; @@ -131,12 +132,13 @@ int DeConvolutionGradFilterCPUKernel::Run() { kernel::LiteKernel *CpuDeConvGradFilterFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, - OpParameter *opParameter, const lite::InnerContext *ctx, + OpParameter *opParameter, const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_DeConv2DGradFilter); - auto *kernel = new (std::nothrow) DeConvolutionGradFilterCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = new (std::nothrow) + DeConvolutionGradFilterCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new kernel fail!"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/dropout.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/dropout.cc index 5894f9ba92e..9e7096eb8bd 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/dropout.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/dropout.cc @@ -101,7 +101,8 @@ int RunDropout(void *cdata, int task_id) { } int DropoutCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, RunDropout, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, RunDropout, + this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Dropout function error error_code[" << error_code << "]"; return RET_ERROR; @@ -111,7 +112,7 @@ int DropoutCPUKernel::Run() { kernel::LiteKernel *CpuDropoutFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { if (opParameter == nullptr) { MS_LOG(ERROR) << "Dropout opParameter nullptr."; return nullptr; @@ -120,7 +121,8 @@ kernel::LiteKernel *CpuDropoutFp32KernelCreator(const std::vector(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "Dropout new kernel failed."; return nullptr; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/dropout_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/dropout_grad.cc index 9845859746f..ec671273fb1 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/dropout_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/dropout_grad.cc @@ -83,7 +83,8 @@ int RunDropoutGrad(void *cdata, int task_id) { } int DropoutGradCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, RunDropoutGrad, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, RunDropoutGrad, + this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Dropout Grad function error error_code[" << error_code << "]"; return RET_ERROR; @@ -93,7 +94,7 @@ int DropoutGradCPUKernel::Run() { kernel::LiteKernel *CpuDropoutGradFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, - OpParameter *opParameter, const lite::InnerContext *ctx, + OpParameter *opParameter, const lite::Context *ctx, const kernel::KernelKey &desc) { if (opParameter == nullptr) { MS_LOG(ERROR) << "DropoutGrad opParameter nullptr."; @@ -103,7 +104,8 @@ kernel::LiteKernel *CpuDropoutGradFp32KernelCreator(const std::vector(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "DropoutGrad new kernel failed."; return nullptr; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/layernorm_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/layernorm_grad.cc index 5470378af4d..dd9e70cbbd3 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/layernorm_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/layernorm_grad.cc @@ -97,7 +97,8 @@ int LayerNormGradRun(void *cdata, int task_id) { } int LayerNormGradCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, LayerNormGradRun, this, 1); + int error_code = + ParallelLaunch(static_cast(this->context_)->thread_pool_, LayerNormGradRun, this, 1); if (error_code != RET_OK) { MS_LOG(ERROR) << "LayerNorm function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/neg_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/neg_grad.cc index 6f9ea508955..34dbfcec3e7 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/neg_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/neg_grad.cc @@ -56,7 +56,8 @@ int NegGradCPUKernel::DoNegGrad(int task_id) { int NegGradCPUKernel::ReSize() { return RET_OK; } int NegGradCPUKernel::Run() { - auto ret = ParallelLaunch(this->context_->thread_pool_, NegGradRun, this, thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, NegGradRun, this, + thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "parallel launch fail!ret: " << ret; return ret; @@ -67,12 +68,13 @@ int NegGradCPUKernel::Run() { kernel::LiteKernel *CpuNegGradFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *param, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { if (param == nullptr) { MS_LOG(ERROR) << "input parameter is nullptr!"; return nullptr; } - auto *kernel = new (std::nothrow) NegGradCPUKernel(param, inputs, outputs, ctx); + auto *kernel = + new (std::nothrow) NegGradCPUKernel(param, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new NegGradCPUKernel fail!"; free(param); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/pooling_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/pooling_grad.cc index e43fabc761b..6e78399c453 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/pooling_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/pooling_grad.cc @@ -100,7 +100,8 @@ int PoolingGradImpl(void *cdata, int task_id) { int PoolingGradCPUKernel::Run() { thread_num_ = context_->thread_num_; - int error_code = ParallelLaunch(this->context_->thread_pool_, PoolingGradImpl, this, thread_num_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + PoolingGradImpl, this, thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "pooling error error_code[" << error_code << "]"; return RET_ERROR; @@ -110,11 +111,12 @@ int PoolingGradCPUKernel::Run() { kernel::LiteKernel *CpuPoolingGradFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, - OpParameter *opParameter, const lite::InnerContext *ctx, + OpParameter *opParameter, const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); - auto *kernel = new (std::nothrow) PoolingGradCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = + new (std::nothrow) PoolingGradCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new PoolingGradCPUKernel fail!"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/power_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/power_grad.cc index f721422999b..fce73e66a0c 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/power_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/power_grad.cc @@ -76,7 +76,8 @@ int PowerGradRun(void *cdata, int task_id) { } int PowerGradCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, PowerGradRun, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, PowerGradRun, + this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "power grad function error error_code[" << error_code << "]"; return RET_ERROR; @@ -86,10 +87,11 @@ int PowerGradCPUKernel::Run() { kernel::LiteKernel *CpuPowerGradFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_PowerGrad); - auto *kernel = new (std::nothrow) PowerGradCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = + new (std::nothrow) PowerGradCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new PowerGradCPUKernel fail!"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/resize_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/resize_grad.cc index 34fd46b239c..288f599340e 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/resize_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/resize_grad.cc @@ -92,7 +92,8 @@ int ResizeGradCPUKernel::Run() { auto out_addr = reinterpret_cast(out_tensors_.at(0)->MutableData()); size_t elem_number = out_tensors_.at(0)->ElementsNum(); std::fill(out_addr, out_addr + elem_number, 0.f); - int error_code = ParallelLaunch(this->context_->thread_pool_, ResizeGradRun, this, 1); + int error_code = + ParallelLaunch(static_cast(this->context_)->thread_pool_, ResizeGradRun, this, 1); if (error_code != RET_OK) { MS_LOG(ERROR) << "ResizeGradCPUKernel function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sgd.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sgd.cc index 3a7423c8da2..501f971d8b4 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sgd.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sgd.cc @@ -146,9 +146,11 @@ int SgdCPUKernel::Run() { auto stat = reinterpret_cast(in_tensors_.at(5)->MutableData()); auto error_code = RET_OK; if (*stat > 0.0f) { - error_code = ParallelLaunch(this->context_->thread_pool_, SgdRunInit, this, thread_count_); + error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, SgdRunInit, this, + thread_count_); } else { - error_code = ParallelLaunch(this->context_->thread_pool_, SgdRun, this, thread_count_); + error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, SgdRun, this, + thread_count_); } if (error_code != RET_OK) { MS_LOG(ERROR) << "SGD function error error_code[" << error_code << "]"; @@ -202,9 +204,10 @@ int SgdCPUKernel::OptimizerStep() { kernel::LiteKernel *CpuSgdFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(desc.type == schema::PrimitiveType_SGD); - auto *kernel = new (std::nothrow) SgdCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = + new (std::nothrow) SgdCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new SgdCPUKernel failed!"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sigmoid_cross_entropy_with_logits.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sigmoid_cross_entropy_with_logits.cc index d0ce449f90d..c61658b31d7 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sigmoid_cross_entropy_with_logits.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sigmoid_cross_entropy_with_logits.cc @@ -61,7 +61,8 @@ int SigmoidCrossEntropyWithLogitsRun(void *cdata, int task_id) { } int SigmoidCrossEntropyWithLogitsCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, SigmoidCrossEntropyWithLogitsRun, this, 1); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + SigmoidCrossEntropyWithLogitsRun, this, 1); if (error_code != RET_OK) { MS_LOG(ERROR) << "SigmoidCrossEntropyWithLogits function error error_code[" << error_code << "]"; return RET_ERROR; @@ -74,11 +75,12 @@ int SigmoidCrossEntropyWithLogitsCPUKernel::Init() { return RET_OK; } kernel::LiteKernel *CpuSigmoidCrossEntropyWithLogitsFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_SigmoidCrossEntropyWithLogits); - auto *kernel = new (std::nothrow) SigmoidCrossEntropyWithLogitsCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = new (std::nothrow) + SigmoidCrossEntropyWithLogitsCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new SigmoidCrossEntropyWithLogits failed"; return nullptr; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sigmoid_cross_entropy_with_logits_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sigmoid_cross_entropy_with_logits_grad.cc index c12f03ebba3..4bc84235fee 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sigmoid_cross_entropy_with_logits_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sigmoid_cross_entropy_with_logits_grad.cc @@ -61,7 +61,8 @@ int SigmoidCrossEntropyWithLogitsGradRun(void *cdata, int task_id) { } int SigmoidCrossEntropyWithLogitsGradCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, SigmoidCrossEntropyWithLogitsGradRun, this, 1); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + SigmoidCrossEntropyWithLogitsGradRun, this, 1); if (error_code != RET_OK) { MS_LOG(ERROR) << "SigmoidCrossEntropyWithLogitsGrad function error error_code[" << error_code << "]"; return RET_ERROR; @@ -74,11 +75,12 @@ int SigmoidCrossEntropyWithLogitsGradCPUKernel::Init() { return RET_OK; } kernel::LiteKernel *CpuSigmoidCrossEntropyWithLogitsGradFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_SigmoidCrossEntropyWithLogitsGrad); - auto *kernel = new (std::nothrow) SigmoidCrossEntropyWithLogitsGradCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = new (std::nothrow) SigmoidCrossEntropyWithLogitsGradCPUKernel( + opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new SigmoidCrossEntropyWithLogitsGradWithLogitsCPUKernel failed"; return nullptr; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/smooth_l1_loss.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/smooth_l1_loss.cc index 59b8030469c..f828b555170 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/smooth_l1_loss.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/smooth_l1_loss.cc @@ -73,7 +73,8 @@ int SmoothL1LossRun(void *cdata, int task_id) { } int SmoothL1LossCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, SmoothL1LossRun, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + SmoothL1LossRun, this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "SmoothL1Loss function error error_code[" << error_code << "]"; return RET_ERROR; @@ -85,11 +86,12 @@ int SmoothL1LossCPUKernel::Init() { return RET_OK; } kernel::LiteKernel *CpuSmoothL1LossFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, - OpParameter *opParameter, const lite::InnerContext *ctx, + OpParameter *opParameter, const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_SmoothL1Loss); - auto *kernel = new (std::nothrow) SmoothL1LossCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = new (std::nothrow) + SmoothL1LossCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new SmoothL1Loss failed"; return nullptr; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/smooth_l1_loss_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/smooth_l1_loss_grad.cc index d53cf87455e..9ed44c2b1f0 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/smooth_l1_loss_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/smooth_l1_loss_grad.cc @@ -70,7 +70,8 @@ int SmoothL1LossGradRun(void *cdata, int task_id) { } int SmoothL1LossGradCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, SmoothL1LossGradRun, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + SmoothL1LossGradRun, this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "SmoothL1LossGrad function error error_code[" << error_code << "]"; return RET_ERROR; @@ -82,11 +83,12 @@ int SmoothL1LossGradCPUKernel::Init() { return RET_OK; } kernel::LiteKernel *CpuSmoothL1LossGradFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, - OpParameter *opParameter, const lite::InnerContext *ctx, + OpParameter *opParameter, const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_SmoothL1LossGrad); - auto *kernel = new (std::nothrow) SmoothL1LossGradCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = new (std::nothrow) + SmoothL1LossGradCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new SmoothL1LossGradWithLogitsCPUKernel failed"; return nullptr; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/softmax_cross_entropy_with_logits.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/softmax_cross_entropy_with_logits.cc index 49051e6ba76..f8db0ccb150 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/softmax_cross_entropy_with_logits.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/softmax_cross_entropy_with_logits.cc @@ -92,7 +92,8 @@ int SoftmaxCrossEntropyWithLogitsRun(void *cdata, int task_id) { } int SoftmaxCrossEntropyWithLogitsCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, SoftmaxCrossEntropyWithLogitsRun, this, 1); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + SoftmaxCrossEntropyWithLogitsRun, this, 1); if (error_code != RET_OK) { MS_LOG(ERROR) << "SoftmaxCrossEntropy function error error_code[" << error_code << "]"; return RET_ERROR; @@ -128,11 +129,12 @@ int SoftmaxCrossEntropyWithLogitsCPUKernel::ReSize() { kernel::LiteKernel *CpuSoftmaxCrossEntropyFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, - OpParameter *opParameter, const lite::InnerContext *ctx, + OpParameter *opParameter, const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_SoftmaxCrossEntropyWithLogits); - auto *kernel = new (std::nothrow) SoftmaxCrossEntropyWithLogitsCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = new (std::nothrow) + SoftmaxCrossEntropyWithLogitsCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new SoftmaxCrossEntropyWithLogitsCPUKernel failed"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/softmax_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/softmax_grad.cc index f140d270254..7241e4aed29 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/softmax_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/softmax_grad.cc @@ -80,7 +80,8 @@ int SoftmaxGradRun(void *cdata, int task_id) { } int SoftmaxGradCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, SoftmaxGradRun, this, 1); + int error_code = + ParallelLaunch(static_cast(this->context_)->thread_pool_, SoftmaxGradRun, this, 1); if (error_code != RET_OK) { MS_LOG(ERROR) << "SoftmaxGradRun function error error_code[" << error_code << "]"; return RET_ERROR; @@ -90,10 +91,11 @@ int SoftmaxGradCPUKernel::Run() { kernel::LiteKernel *CpuSoftmaxGradFp32KernelCreator(const std::vector &inputs, const std::vector &outputs, - OpParameter *opParameter, const lite::InnerContext *ctx, + OpParameter *opParameter, const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(opParameter != nullptr); - auto *kernel = new (std::nothrow) SoftmaxGradCPUKernel(opParameter, inputs, outputs, ctx); + auto *kernel = + new (std::nothrow) SoftmaxGradCPUKernel(opParameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new SoftmaxGradCPUKernel fail!"; free(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sparse_softmax_cross_entropy_with_logits.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sparse_softmax_cross_entropy_with_logits.cc index fc02b14200c..2c0c7242bea 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sparse_softmax_cross_entropy_with_logits.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/sparse_softmax_cross_entropy_with_logits.cc @@ -113,7 +113,8 @@ int SparseSoftmaxCrossEntropyWithLogitsRun(void *cdata, int task_id) { } int SparseSoftmaxCrossEntropyWithLogitsCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, SparseSoftmaxCrossEntropyWithLogitsRun, this, 1); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + SparseSoftmaxCrossEntropyWithLogitsRun, this, 1); if (error_code != RET_OK) { MS_LOG(ERROR) << "SparseSoftmaxCrossEntropyWithLogits function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/strided_slice_grad.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/strided_slice_grad.cc index 4a9298261ab..4b63d47b2d1 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/strided_slice_grad.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/strided_slice_grad.cc @@ -124,7 +124,8 @@ int StridedSliceGradImpl(void *cdata, int task_id) { } int StridedSliceGradCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, StridedSliceGradImpl, this, 1); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + StridedSliceGradImpl, this, 1); if (error_code != RET_OK) { MS_LOG(ERROR) << "Strided slice error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/unsorted_segment_sum.cc b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/unsorted_segment_sum.cc index 7a149aee102..b274203d7d6 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32_grad/unsorted_segment_sum.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32_grad/unsorted_segment_sum.cc @@ -68,7 +68,8 @@ int UnsortedSegmentSumRun(void *cdata, int task_id) { } int UnsortedSegmentSumCPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, UnsortedSegmentSumRun, this, 1); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + UnsortedSegmentSumRun, this, 1); if (error_code != RET_OK) { MS_LOG(ERROR) << "Strided slice error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/activation_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/activation_int8.cc index 74ae7d3d67c..ebaefb4437a 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/activation_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/activation_int8.cc @@ -33,7 +33,7 @@ using mindspore::schema::PrimitiveType_Activation; namespace mindspore::kernel { kernel::LiteKernel *CpuActivationInt8KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *parameter, - const lite::InnerContext *ctx, const KernelKey &desc) { + const lite::Context *ctx, const KernelKey &desc) { if (parameter == nullptr) { MS_LOG(ERROR) << "parameter is nullptr"; return nullptr; @@ -43,22 +43,28 @@ kernel::LiteKernel *CpuActivationInt8KernelCreator(const std::vector(type)) { case schema::ActivationType_RELU: - kernel = new (std::nothrow) ReluInt8CPUKernel(parameter, inputs, outputs, ctx); + kernel = + new (std::nothrow) ReluInt8CPUKernel(parameter, inputs, outputs, static_cast(ctx)); break; case schema::ActivationType_RELU6: - kernel = new (std::nothrow) Relu6Int8CPUKernel(parameter, inputs, outputs, ctx); + kernel = + new (std::nothrow) Relu6Int8CPUKernel(parameter, inputs, outputs, static_cast(ctx)); break; case schema::ActivationType_HSWISH: - kernel = new (std::nothrow) HswishInt8CPUKernel(parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) + HswishInt8CPUKernel(parameter, inputs, outputs, static_cast(ctx)); break; case schema::ActivationType_SIGMOID: - kernel = new (std::nothrow) SigmoidInt8CPUKernel(parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) + SigmoidInt8CPUKernel(parameter, inputs, outputs, static_cast(ctx)); break; case schema::ActivationType_LEAKY_RELU: - kernel = new (std::nothrow) LeakyReluInt8CPUKernel(parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) + LeakyReluInt8CPUKernel(parameter, inputs, outputs, static_cast(ctx)); break; case schema::ActivationType_TANH: - kernel = new (std::nothrow) TanhInt8CPUKernel(parameter, inputs, outputs, ctx); + kernel = + new (std::nothrow) TanhInt8CPUKernel(parameter, inputs, outputs, static_cast(ctx)); break; default: break; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/add_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/add_int8.cc index d2fd2578373..b40c7248a8b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/add_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/add_int8.cc @@ -205,7 +205,8 @@ int QuantizedAddCPUKernel::Run() { input1_data_ = static_cast(in_tensors_.at(1)->data_c()); output_data_ = static_cast(out_tensors_.at(0)->data_c()); - ParallelLaunch(this->context_->thread_pool_, AddInt8Run, this, thread_count_); + ParallelLaunch(static_cast(this->context_)->thread_pool_, AddInt8Run, this, + thread_count_); return RET_OK; } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_int8.cc index e677eec54a8..47f62714c8f 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_int8.cc @@ -149,7 +149,8 @@ int ArithmeticInt8CPUKernel::Run() { } TileDimensionsInt8(input_data0, input_data1, tile_data0_, tile_data1_, param); } - auto ret = ParallelLaunch(this->context_->thread_pool_, ArithmeticsInt8Launch, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ArithmeticsInt8Launch, this, op_parameter_->thread_num_); if (param->broadcasting_) { context_->allocator->Free(tile_data0_); context_->allocator->Free(tile_data1_); @@ -162,15 +163,18 @@ int ArithmeticInt8CPUKernel::Run() { kernel::LiteKernel *CpuArithmeticInt8KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *parameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { kernel::LiteKernel *kernel = nullptr; ArithmeticParameter *param = reinterpret_cast(parameter); if (desc.type == PrimitiveType_Eltwise && param->eltwise_mode_ == static_cast(schema::EltwiseMode_SUM)) { - kernel = new (std::nothrow) QuantizedAddCPUKernel(parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) + QuantizedAddCPUKernel(parameter, inputs, outputs, static_cast(ctx)); } else if (desc.type == PrimitiveType_Eltwise && param->eltwise_mode_ == static_cast(schema::EltwiseMode_PROD)) { - kernel = new (std::nothrow) MulInt8CPUKernel(parameter, inputs, outputs, ctx); + kernel = + new (std::nothrow) MulInt8CPUKernel(parameter, inputs, outputs, static_cast(ctx)); } else { - kernel = new (std::nothrow) ArithmeticInt8CPUKernel(parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) + ArithmeticInt8CPUKernel(parameter, inputs, outputs, static_cast(ctx)); } if (kernel == nullptr) { MS_LOG(ERROR) << "Create ArithmeticInt8CPUKernel failed, name: " << parameter->name_; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_self_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_self_int8.cc index 5fc94b98980..7624a22e948 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_self_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/arithmetic_self_int8.cc @@ -99,7 +99,8 @@ int ArithmeticSelfInt8CPUKernel::Run() { auto out_tensor = out_tensors_.at(0); in_ptr_ = reinterpret_cast(input_tensor->MutableData()); out_ptr_ = reinterpret_cast(out_tensor->MutableData()); - auto ret = ParallelLaunch(this->context_->thread_pool_, ArithmeticSelfInt8Runs, this, thread_sz_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ArithmeticSelfInt8Runs, this, thread_sz_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "ArithmeticSelfRun error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/batchnorm_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/batchnorm_int8.cc index 1aed1db1d11..936257beafc 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/batchnorm_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/batchnorm_int8.cc @@ -188,8 +188,8 @@ int BatchnormInt8CPUKernel::Run() { in_addr_ = reinterpret_cast(in_tensors_.at(0)->MutableData()); out_addr_ = reinterpret_cast(out_tensors_.at(0)->MutableData()); - auto ret = - ParallelLaunch(this->context_->thread_pool_, BatchNormInt8Run, this, batchnorm_param_->op_parameter_.thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, BatchNormInt8Run, + this, batchnorm_param_->op_parameter_.thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "BatchnormRun error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/concat_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/concat_int8.cc index dd8da807fd9..161d5fdaeee 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/concat_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/concat_int8.cc @@ -115,7 +115,8 @@ int ConcatInt8CPUKernel::Run() { } output_data_ = reinterpret_cast(out_tensors_.at(0)->MutableData()); - auto ret = ParallelLaunch(this->context_->thread_pool_, ConcatInt8Run, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConcatInt8Run, this, + op_parameter_->thread_num_); return ret; } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_1x1_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_1x1_int8.cc index 3e7d28b46f5..849e8879dd7 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_1x1_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_1x1_int8.cc @@ -524,7 +524,8 @@ int Convolution1x1Int8CPUKernel::Run() { if (parallel_by_oc_) { /* input transpose and input sum */ if (support_optimize_) { - ParallelLaunch(this->context_->thread_pool_, Convolution1x1Int8OcOptPre, this, thread_count_hw_); + ParallelLaunch(static_cast(this->context_)->thread_pool_, + Convolution1x1Int8OcOptPre, this, thread_count_hw_); } else { RowMajor2Row16x4MajorInt8(input_ptr_, packed_input_, matmul_param_->row_, matmul_param_->deep_); if (filter_peroc_) { @@ -535,10 +536,12 @@ int Convolution1x1Int8CPUKernel::Run() { } } /* matmul parallel by oc */ - error_code = ParallelLaunch(this->context_->thread_pool_, Convolution1x1Int8OcRun, this, thread_count_oc_); + error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + Convolution1x1Int8OcRun, this, thread_count_oc_); } else { /* matmul parallel by hw */ - error_code = ParallelLaunch(this->context_->thread_pool_, Convolution1x1Int8HwRun, this, thread_count_hw_); + error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + Convolution1x1Int8HwRun, this, thread_count_hw_); } if (error_code != RET_OK) { MS_LOG(ERROR) << "ParallelLaunch run error error_code[" << error_code << "]"; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_3x3_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_3x3_int8.cc index 36249faaced..61f4933846e 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_3x3_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_3x3_int8.cc @@ -219,7 +219,8 @@ int Convolution3x3Int8CPUKernel::Run() { auto input_addr = reinterpret_cast(in_tensors_.at(kInputIndex)->MutableData()); PackInputToC8Int8(input_addr, input_data_, conv_param_); - int error_code = ParallelLaunch(this->context_->thread_pool_, Convolution3x3Int8Impl, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + Convolution3x3Int8Impl, this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "conv3x3 int8 error error_code[" << error_code << "]"; FreeTmpBuffer(); diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_depthwise_3x3_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_depthwise_3x3_int8.cc index 0ef93018e99..442437d025c 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_depthwise_3x3_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_depthwise_3x3_int8.cc @@ -163,7 +163,8 @@ int ConvolutionDepthwise3x3Int8CPUKernel::Run() { ConvDw3x3Int8Pad(output_ptr_, input_ptr_, packed_weight_, reinterpret_cast(bias_data_), conv_param_, sliding_); } - ret = ParallelLaunch(this->context_->thread_pool_, ConvDw3x3Int8Run, this, conv_param_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConvDw3x3Int8Run, this, + conv_param_->thread_num_); if (ret != RET_OK) { context_->allocator->Free(buffer_); MS_LOG(ERROR) << "ConvDwInt8Run error: error_code[" << ret << "]"; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_depthwise_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_depthwise_int8.cc index 06afeb6fecd..ad8434c9dd8 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_depthwise_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_depthwise_int8.cc @@ -148,7 +148,8 @@ int ConvolutionDepthwiseInt8CPUKernel::Run() { auto output_tensor = out_tensors_.at(kOutputIndex); output_ptr_ = reinterpret_cast(output_tensor->MutableData()); - ret = ParallelLaunch(this->context_->thread_pool_, ConvDwInt8Run, this, conv_param_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConvDwInt8Run, this, + conv_param_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "ConvDwInt8Run error: error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_depthwise_slidewindow_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_depthwise_slidewindow_int8.cc index 3429a8d8440..839cea50879 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_depthwise_slidewindow_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_depthwise_slidewindow_int8.cc @@ -312,7 +312,8 @@ int ConvolutionDepthwiseSWInt8CPUKernel::Run() { packed_output_ = output_addr; } - ret = ParallelLaunch(this->context_->thread_pool_, ConvDwSWInt8Run, this, conv_param_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ConvDwSWInt8Run, this, + conv_param_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "ConvDwSWInt8Run error: error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_int8.cc index e647b28ce3b..ddb076df4d2 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_int8.cc @@ -223,7 +223,8 @@ int ConvolutionInt8CPUKernel::Run() { return RET_ERROR; } - int error_code = ParallelLaunch(this->context_->thread_pool_, ConvolutionInt8Impl, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ConvolutionInt8Impl, this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "conv int8 error error_code[" << error_code << "]"; FreeTmpBuffer(); diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_int8_creator.cc b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_int8_creator.cc index e1b9e225843..9935720f706 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_int8_creator.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_int8_creator.cc @@ -109,19 +109,21 @@ kernel::LiteKernel *CpuGroupConvInt8KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *op_parameter, - const InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(op_parameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_Conv2DFusion); auto conv_param = reinterpret_cast(op_parameter); kernel::LiteKernel *kernel = nullptr; if (conv_param->group_ == 1) { - kernel = CpuConvInt8KernelSelect(inputs, outputs, op_parameter, ctx); + kernel = CpuConvInt8KernelSelect(inputs, outputs, op_parameter, static_cast(ctx)); } else if (conv_param->group_ == conv_param->input_channel_ && conv_param->group_ == conv_param->output_channel_) { - kernel = CpuConvDwInt8KernelCreator(inputs, outputs, op_parameter, ctx, desc); + kernel = + CpuConvDwInt8KernelCreator(inputs, outputs, op_parameter, static_cast(ctx), desc); } else { MS_ASSERT(conv_param->group_ > 1); - kernel = CpuGroupConvInt8KernelCreator(inputs, outputs, op_parameter, ctx, conv_param->group_); + kernel = CpuGroupConvInt8KernelCreator(inputs, outputs, op_parameter, static_cast(ctx), + conv_param->group_); } if (kernel == nullptr) { MS_LOG(ERROR) << "kernel is nullptr."; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/crop_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/crop_int8.cc index 49bd21b62db..262009d7cc3 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/crop_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/crop_int8.cc @@ -52,7 +52,8 @@ int CropInt8CPUKernel::Init() { int CropInt8CPUKernel::ReSize() { return CropBaseCPUKernel::ReSize(); } int CropInt8CPUKernel::Run() { - auto ret = ParallelLaunch(this->context_->thread_pool_, CropInt8Run, this, crop_para_->thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, CropInt8Run, this, + crop_para_->thread_count_); return ret; } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/deconvolution_depthwise_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/deconvolution_depthwise_int8.cc index 3d1e75d70b9..e522a8e401a 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/deconvolution_depthwise_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/deconvolution_depthwise_int8.cc @@ -189,7 +189,8 @@ int DeconvolutionDepthwiseInt8CPUKernel::Run() { packed_output_ = output_addr; } - ret = ParallelLaunch(this->context_->thread_pool_, DeconvDwInt8Run, this, conv_param_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, DeconvDwInt8Run, this, + conv_param_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "DeconvDwInt8Run error: error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/deconvolution_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/deconvolution_int8.cc index d6b6acde666..b1589caed03 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/deconvolution_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/deconvolution_int8.cc @@ -269,7 +269,8 @@ 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 = ParallelLaunch(this->context_->thread_pool_, DeConvInt8Run, this, thread_count_); + error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, DeConvInt8Run, + this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "deconv int8 run error! error_code[" << error_code << "]"; } @@ -280,7 +281,7 @@ int DeConvInt8CPUKernel::Run() { kernel::LiteKernel *CpuDeConvInt8KernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *op_parameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(op_parameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_Conv2dTransposeFusion); @@ -288,9 +289,11 @@ kernel::LiteKernel *CpuDeConvInt8KernelCreator(const std::vector kernel::LiteKernel *kernel = nullptr; if (conv_param->group_ == 1) { - kernel = new (std::nothrow) kernel::DeConvInt8CPUKernel(op_parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) + kernel::DeConvInt8CPUKernel(op_parameter, inputs, outputs, static_cast(ctx)); } else if (conv_param->group_ == conv_param->input_channel_ && conv_param->group_ == conv_param->output_channel_) { - kernel = new (std::nothrow) kernel::DeconvolutionDepthwiseInt8CPUKernel(op_parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) kernel::DeconvolutionDepthwiseInt8CPUKernel( + op_parameter, inputs, outputs, static_cast(ctx)); } else { MS_LOG(ERROR) << "deconv do not support group deconv!"; kernel = nullptr; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/detection_post_process_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/detection_post_process_int8.cc index 612d3b866e5..68c42afe849 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/detection_post_process_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/detection_post_process_int8.cc @@ -64,7 +64,8 @@ int DetectionPostProcessInt8CPUKernel::Dequantize(lite::Tensor *tensor, float ** quant_size_ = tensor->ElementsNum(); thread_n_stride_ = UP_DIV(quant_size_, op_parameter_->thread_num_); - auto ret = ParallelLaunch(this->context_->thread_pool_, DequantizeInt8ToFp32Run, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, + DequantizeInt8ToFp32Run, this, op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "QuantDTypeCastRun error error_code[" << ret << "]"; context_->allocator->Free(*data); diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/div_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/div_int8.cc index a1df673f236..0e1959fbcae 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/div_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/div_int8.cc @@ -118,7 +118,8 @@ int DivInt8CPUKernel::Run() { static_cast(in_tensors_.at(1)->MutableData()), reinterpret_cast(tile0_data_), reinterpret_cast(tile1_data_), &tile_para); } - auto ret = ParallelLaunch(this->context_->thread_pool_, DivInt8Run, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, DivInt8Run, this, + op_parameter_->thread_num_); if (broadcast_) { context_->allocator->Free(tile0_data_); context_->allocator->Free(tile1_data_); diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/gatherNd_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/gatherNd_int8.cc index 968daa223e8..cb3887ff0c4 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/gatherNd_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/gatherNd_int8.cc @@ -135,7 +135,8 @@ int GatherNdInt8CPUKernel::Run() { in_ptr_ = reinterpret_cast(in_tensors_.front()->MutableData()); out_ptr_ = reinterpret_cast(out_tensors_.front()->MutableData()); InitOffset(); - auto ret = ParallelLaunch(this->context_->thread_pool_, GatherNdInt8Run, this, thread_sz_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, GatherNdInt8Run, + this, thread_sz_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "gatherNd error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/gather_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/gather_int8.cc index 5d38262939a..155db851d7e 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/gather_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/gather_int8.cc @@ -98,7 +98,8 @@ int GatherInt8Run(void *cdata, int task_id) { } int GatherInt8CPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, GatherInt8Run, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, GatherInt8Run, + this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Gather function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/hswish_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/hswish_int8.cc index ac5ebc9cdc9..e4c1c8787f3 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/hswish_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/hswish_int8.cc @@ -89,7 +89,8 @@ int HswishInt8Run(void *cdata, int task_id) { } int HswishInt8CPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, HswishInt8Run, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, HswishInt8Run, + this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "HswishInt8Run function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/l2_norm_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/l2_norm_int8.cc index 2a67e0d4aea..1c43a02fdeb 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/l2_norm_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/l2_norm_int8.cc @@ -48,7 +48,8 @@ int L2NormInt8CPUKernel::Run() { MS_LOG(ERROR) << "L2Norm only support reduce on all axis and trailing axis with trailing axis"; return RET_ERROR; } - auto ret = ParallelLaunch(context_->thread_pool_, L2NormInt8Run, this, context_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, L2NormInt8Run, this, + context_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "L2Norm error: error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/layer_norm_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/layer_norm_int8.cc index dafa9c56cda..ed3b1316c73 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/layer_norm_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/layer_norm_int8.cc @@ -123,7 +123,8 @@ int LayerNormInt8CPUKernel::Run() { src_ptr_ = reinterpret_cast(in_tensors_.at(0)->data_c()); dst_ptr_ = reinterpret_cast(out_tensors_.at(0)->data_c()); - auto ret = ParallelLaunch(this->context_->thread_pool_, LayerNormInt8Run, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, LayerNormInt8Run, + this, op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "LayerNormInt8Run error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/leaky_relu_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/leaky_relu_int8.cc index 2aa35b7ff40..c2cff5f6e80 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/leaky_relu_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/leaky_relu_int8.cc @@ -108,7 +108,8 @@ int LeakyReluInt8CPUKernel::ReSize() { } int LeakyReluInt8CPUKernel::Run() { - auto ret = ParallelLaunch(this->context_->thread_pool_, LeakyReluInt8Run, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, LeakyReluInt8Run, + this, op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "RunPreluParam failed. errorcode: "; } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/matmul_base_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/matmul_base_int8.cc index c711b130e3a..c0038c6b6ff 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/matmul_base_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/matmul_base_int8.cc @@ -327,7 +327,8 @@ int MatmulBaseInt8CPUKernel::Run() { batch_sums_ = weight_bias_sums_ + i * param_->col_align_; batch_c_ptr_ = c_ptr + i * param_->row_ * param_->col_; - auto ret = ParallelLaunch(this->context_->thread_pool_, MatmulBaseInt8Run, this, thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, MatmulBaseInt8Run, + this, thread_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "MatmulInt8Run error: [" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/mul_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/mul_int8.cc index 3846d174f82..3644174e135 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/mul_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/mul_int8.cc @@ -145,7 +145,8 @@ int MulInt8CPUKernel::Run() { if (fast_hw_broadcast_) { elements_num_ = out_tensors_.front()->Batch() * out_tensors_.front()->Height() * out_tensors_.front()->Width(); count_unit_ = thread_count_ > 1 ? UP_DIV(elements_num_, thread_count_) : elements_num_; - return ParallelLaunch(this->context_->thread_pool_, FastHWBroadcatMulInt8Run, this, thread_count_); + return ParallelLaunch(static_cast(this->context_)->thread_pool_, + FastHWBroadcatMulInt8Run, this, thread_count_); } elements_num_ = out_tensors_.at(0)->ElementsNum(); @@ -164,13 +165,15 @@ int MulInt8CPUKernel::Run() { } TileDimensionsInt8(static_cast(in_tensors_.at(0)->MutableData()), static_cast(in_tensors_.at(1)->MutableData()), input0_data_, input1_data_, tile_para); - auto ret = ParallelLaunch(this->context_->thread_pool_, MulInt8Run, this, thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, MulInt8Run, this, + thread_count_); ctx_->allocator->Free(input0_data_); ctx_->allocator->Free(input1_data_); return ret; } - auto ret = ParallelLaunch(this->context_->thread_pool_, MulInt8Run, this, thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, MulInt8Run, this, + thread_count_); return ret; } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.cc index 2195640e9f9..e9e543c2db5 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/pad_int8.cc @@ -267,7 +267,8 @@ int PadInt8CPUKernel::Run() { int error_code; if (pad_param_->pad_mode_ == static_cast(schema::PaddingMode_CONSTANT)) { memset(out_data_, pad_param_->pad_quant_arg_.constant_value_[0], out_tensors_[0]->ElementsNum() * sizeof(int8_t)); - error_code = ParallelLaunch(this->context_->thread_pool_, PadInt8Impl, this, context_->thread_num_); + error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, PadInt8Impl, + this, context_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Resize run error, error_code[" << error_code << "]"; return RET_ERROR; @@ -280,7 +281,8 @@ int PadInt8CPUKernel::Run() { return error_code; } - error_code = ParallelLaunch(this->context_->thread_pool_, MirrorPadImplInt8, this, context_->thread_num_); + error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + MirrorPadImplInt8, this, context_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Pad Reflect or Symmetric mode run error, error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/pooling_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/pooling_int8.cc index e861a1913bf..0ca39fbcb6c 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/pooling_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/pooling_int8.cc @@ -96,7 +96,8 @@ int PoolingInt8Impl(void *cdata, int task_id) { } int PoolingInt8CPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, PoolingInt8Impl, this, thread_count_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + PoolingInt8Impl, this, thread_count_); if (error_code != RET_OK) { MS_LOG(ERROR) << "poolingInt8 error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/power_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/power_int8.cc index a3f75cdb1a7..e69bc319039 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/power_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/power_int8.cc @@ -99,7 +99,8 @@ int PowerInt8Run(void *cdata, int task_id) { } int PowerInt8CPUKernel::Run() { - auto ret = ParallelLaunch(this->context_->thread_pool_, PowerInt8Run, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, PowerInt8Run, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "PowerInt8Run error, error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/reduce_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/reduce_int8.cc index aef43355829..433db6eb45d 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/reduce_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/reduce_int8.cc @@ -458,7 +458,8 @@ int ReduceInt8CPUKernel::Fast4DReduceMeanHWImpl() { } PackNHWCToNCHWInt8(reinterpret_cast(input_data), reinterpret_cast(nchw_in_data_), input->Batch(), input->Height() * input->Width(), input->Channel()); - auto ret = ParallelLaunch(this->context_->thread_pool_, ReduceMeanPatternInt8Impl, this, context_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ReduceMeanPatternInt8Impl, this, context_->thread_num_); if (ret != RET_OK) { ctx_->allocator->Free(nchw_in_data_); MS_LOG(ERROR) << "Reduce run error, error_code[" << ret << "]"; @@ -500,7 +501,8 @@ int ReduceInt8CPUKernel::Run() { outer_size_ = outer_sizes_[i]; inner_size_ = inner_sizes_[i]; axis_size_ = axis_sizes_[i]; - auto error_code = ParallelLaunch(this->context_->thread_pool_, ReduceInt8Impl, this, context_->thread_num_); + auto error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ReduceInt8Impl, this, context_->thread_num_); if (error_code != RET_OK) { FreeTmpBuffer(); MS_LOG(ERROR) << "Reduce run error, error_code[" << error_code << "]"; @@ -515,7 +517,8 @@ int ReduceInt8CPUKernel::Run() { axis_size_ = axis_sizes_.back(); last_dst_data_ = reinterpret_cast(out_tensors_.at(0)->MutableData()); is_last_axis_ = true; - auto error_code = ParallelLaunch(this->context_->thread_pool_, ReduceInt8Impl, this, context_->thread_num_); + auto error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, + ReduceInt8Impl, this, context_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Reduce run error, error_code[" << error_code << "]"; FreeTmpBuffer(); diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/relux_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/relux_int8.cc index 494539b4a44..589b8cab9cf 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/relux_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/relux_int8.cc @@ -72,7 +72,8 @@ int ReluXInt8Run(void *cdata, int task_id) { } int ReluXInt8CPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, ReluXInt8Run, this, op_parameter_->thread_num_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, ReluXInt8Run, + this, op_parameter_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "ReluXInt8Run function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/reshape_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/reshape_int8.cc index f9f6c2c8b15..a5652d43e22 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/reshape_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/reshape_int8.cc @@ -58,7 +58,8 @@ int ReshapeInt8CPUKernel::Run() { elements_num_ = in_tensors_.at(kInputIndex)->ElementsNum(); count_unit_ = op_parameter_->thread_num_ > 1 ? UP_DIV(elements_num_, op_parameter_->thread_num_) : elements_num_; - auto ret = ParallelLaunch(this->context_->thread_pool_, ReshapeInt8Run, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ReshapeInt8Run, this, + op_parameter_->thread_num_); return ret; } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/resize_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/resize_int8.cc index d72995351b9..787ec3a464e 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/resize_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/resize_int8.cc @@ -359,7 +359,8 @@ int ResizeInt8CPUKernel::RunImpl(int task_id) { } int ResizeInt8CPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, ResizeInt8Impl, this, context_->thread_num_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, ResizeInt8Impl, + this, context_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "Resize run error, error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/scale_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/scale_int8.cc index e71c4e96284..f83d91651f8 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/scale_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/scale_int8.cc @@ -319,7 +319,8 @@ int ScaleInt8CPUKernel::Run() { tile_para->in_strides1_, tile_para->out_strides_, tile_para->multiples1_); } - auto ret = ParallelLaunch(this->context_->thread_pool_, ScaleRunInt8, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ScaleRunInt8, this, + op_parameter_->thread_num_); // free memory malloced from memory pool if (!scale_param_->const_scale_) { ctx_->allocator->Free(input1_data_); @@ -339,7 +340,8 @@ int ScaleInt8CPUKernel::Run() { if (has_bias_ && !scale_param_->const_offset_) { input2_data_ = reinterpret_cast(in_tensors_.at(2)->data_c()); } - auto ret = ParallelLaunch(this->context_->thread_pool_, ScaleRunInt8, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, ScaleRunInt8, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Scale error error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/sigmoid_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/sigmoid_int8.cc index 0a7c8fdcf26..c4db12e020b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/sigmoid_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/sigmoid_int8.cc @@ -89,7 +89,8 @@ int SigmoidInt8Run(void *cdata, int task_id) { } int SigmoidInt8CPUKernel::Run() { - int error_code = ParallelLaunch(this->context_->thread_pool_, SigmoidInt8Run, this, op_parameter_->thread_num_); + int error_code = ParallelLaunch(static_cast(this->context_)->thread_pool_, SigmoidInt8Run, + this, op_parameter_->thread_num_); if (error_code != RET_OK) { MS_LOG(ERROR) << "SigmoidInt8Run function error error_code[" << error_code << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/slice_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/slice_int8.cc index 1dcb6be190d..bf99e613243 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/slice_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/slice_int8.cc @@ -81,7 +81,8 @@ int SliceInt8CPUKernel::Run() { if (param_->size_[1] < param_->op_parameter_.thread_num_) { ret = SliceInt8NoParallel(input_data, output_data, param_); } else { - ret = ParallelLaunch(this->context_->thread_pool_, SliceInt8Run, this, op_parameter_->thread_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, SliceInt8Run, this, + op_parameter_->thread_num_); } if (ret != RET_OK) { diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/softmax_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/softmax_int8.cc index bd83f8aa752..8d929f240ed 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/softmax_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/softmax_int8.cc @@ -122,7 +122,8 @@ int SoftmaxInt8CPUKernel::Run() { context_->allocator->Free(sum_data_); return RET_ERROR; } - auto ret = ParallelLaunch(this->context_->thread_pool_, SoftmaxRun, this, thread_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, SoftmaxRun, this, + thread_count_); context_->allocator->Free(exp_data_); context_->allocator->Free(sum_data_); if (ret != RET_OK) { diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/split_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/split_int8.cc index bc2316e96f8..d01b152441c 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/split_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/split_int8.cc @@ -98,7 +98,8 @@ int SplitInt8CPUKernel::Run() { output_ptr_[i] = reinterpret_cast(out_tensors_.at(i)->data_c()); } - auto ret = ParallelLaunch(this->context_->thread_pool_, SplitInt8Run, this, thread_n_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, SplitInt8Run, this, + thread_n_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Scale error error_code[" << ret << "]"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/squeeze_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/squeeze_int8.cc index 36653b6a620..1b5a2588b53 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/squeeze_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/squeeze_int8.cc @@ -88,7 +88,8 @@ int SqueezeInt8CPUKernel::Init() { int SqueezeInt8CPUKernel::ReSize() { return RET_OK; } int SqueezeInt8CPUKernel::Run() { - auto ret = ParallelLaunch(this->context_->thread_pool_, SqueezeInt8Run, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, SqueezeInt8Run, this, + op_parameter_->thread_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "RunSqueezeParam failed. errorcode: "; } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/sub_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/sub_int8.cc index b09758ba929..7709631342b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/sub_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/sub_int8.cc @@ -141,7 +141,8 @@ int SubInt8CPUKernel::Run() { static_cast(in_tensors_.at(1)->data_c()), reinterpret_cast(tile0_data_), reinterpret_cast(tile1_data_), &tile_para); } - auto ret = ParallelLaunch(this->context_->thread_pool_, SubInt8Run, this, op_parameter_->thread_num_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, SubInt8Run, this, + op_parameter_->thread_num_); if (broadcast_) { context_->allocator->Free(tile0_data_); context_->allocator->Free(tile1_data_); diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/tanh_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/tanh_int8.cc index 2f3b8006f2c..21c0235201a 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/tanh_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/tanh_int8.cc @@ -71,7 +71,8 @@ int TanhInt8CPUKernel::Run() { in_ptr_ = reinterpret_cast(in_tensors_.at(0)->data_c()); out_ptr_ = reinterpret_cast(out_tensors_.at(0)->data_c()); - ParallelLaunch(this->context_->thread_pool_, TanhInt8Run, this, thread_count_); + ParallelLaunch(static_cast(this->context_)->thread_pool_, TanhInt8Run, this, + thread_count_); return RET_OK; } } // namespace mindspore::kernel diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/transpose_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/transpose_int8.cc index e49423c9d39..27265d5ef21 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/transpose_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/transpose_int8.cc @@ -182,7 +182,8 @@ int TransposeInt8CPUKernel::Run() { MS_LOG(ERROR) << "MallocTmpBuf error_code[" << ret << "]"; } - ret = ParallelLaunch(this->context_->thread_pool_, TransposeInt8Run, this, thread_h_num_); + ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, TransposeInt8Run, this, + thread_h_num_); if (ret != RET_OK) { MS_LOG(ERROR) << "Tranpose error error_code[" << ret << "]"; } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/unsqueeze_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/unsqueeze_int8.cc index 7d5e4fd0261..500ed9c7caa 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/unsqueeze_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/unsqueeze_int8.cc @@ -85,7 +85,8 @@ int UnsqueezeIn8Run(void *cdata, int task_id) { int Unsqueezeint8CPUKernel::Run() { in_ptr_ = reinterpret_cast(in_tensors_.at(0)->MutableData()); out_ptr_ = reinterpret_cast(out_tensors_.at(0)->MutableData()); - auto ret = ParallelLaunch(this->context_->thread_pool_, UnsqueezeIn8Run, this, thread_sz_count_); + auto ret = ParallelLaunch(static_cast(this->context_)->thread_pool_, UnsqueezeIn8Run, + this, thread_sz_count_); if (ret != RET_OK) { MS_LOG(ERROR) << "UnsqueezeRun error error_code[" << ret << "]"; return ret; diff --git a/mindspore/lite/src/runtime/kernel/arm/string/extract_feature.cc b/mindspore/lite/src/runtime/kernel/arm/string/extract_feature.cc index a328d27e574..1c1a81ec2f0 100644 --- a/mindspore/lite/src/runtime/kernel/arm/string/extract_feature.cc +++ b/mindspore/lite/src/runtime/kernel/arm/string/extract_feature.cc @@ -73,8 +73,9 @@ int ExtractFeatureCPUKernel::Run() { kernel::LiteKernel *CpuExtractFeatureKernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *parameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { - auto *kernel = new (std::nothrow) ExtractFeatureCPUKernel(parameter, inputs, outputs, ctx); + const lite::Context *ctx, const kernel::KernelKey &desc) { + auto *kernel = new (std::nothrow) + ExtractFeatureCPUKernel(parameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new ExtractFeatureCPUKernel fail!"; free(parameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/string/hashtable_lookup.cc b/mindspore/lite/src/runtime/kernel/arm/string/hashtable_lookup.cc index 79980e4589f..f3b7d2e9d7b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/string/hashtable_lookup.cc +++ b/mindspore/lite/src/runtime/kernel/arm/string/hashtable_lookup.cc @@ -72,8 +72,9 @@ int HashtableLookupCPUKernel::Run() { kernel::LiteKernel *CpuHashtableLookupKernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *parameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { - auto *kernel = new (std::nothrow) HashtableLookupCPUKernel(parameter, inputs, outputs, ctx); + const lite::Context *ctx, const kernel::KernelKey &desc) { + auto *kernel = new (std::nothrow) + HashtableLookupCPUKernel(parameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new HashtableLookupCPUKernel fail!"; free(parameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/string/normalize.cc b/mindspore/lite/src/runtime/kernel/arm/string/normalize.cc index 3eb0c31e1b6..1962835cee6 100644 --- a/mindspore/lite/src/runtime/kernel/arm/string/normalize.cc +++ b/mindspore/lite/src/runtime/kernel/arm/string/normalize.cc @@ -140,8 +140,9 @@ int NormalizeCPUKernel::Run() { kernel::LiteKernel *CpuNormalizeKernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *parameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { - auto *kernel = new (std::nothrow) NormalizeCPUKernel(parameter, inputs, outputs, ctx); + const lite::Context *ctx, const kernel::KernelKey &desc) { + auto *kernel = + new (std::nothrow) NormalizeCPUKernel(parameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new NormalizeCPUKernel fail!"; free(parameter); diff --git a/mindspore/lite/src/runtime/kernel/arm/string/predict.cc b/mindspore/lite/src/runtime/kernel/arm/string/predict.cc index f0b948e1fc9..73ca79e05c8 100644 --- a/mindspore/lite/src/runtime/kernel/arm/string/predict.cc +++ b/mindspore/lite/src/runtime/kernel/arm/string/predict.cc @@ -95,8 +95,9 @@ int PredictCPUKernel::Run() { kernel::LiteKernel *CpuPredictKernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *parameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { - auto *kernel = new (std::nothrow) PredictCPUKernel(parameter, inputs, outputs, ctx); + const lite::Context *ctx, const kernel::KernelKey &desc) { + auto *kernel = + new (std::nothrow) PredictCPUKernel(parameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "new PredictCPUKernel fail!"; free(parameter); diff --git a/mindspore/lite/src/runtime/kernel/npu/convolution_npu.cc b/mindspore/lite/src/runtime/kernel/npu/convolution_npu.cc index cfb9234ace5..530fb91fea0 100644 --- a/mindspore/lite/src/runtime/kernel/npu/convolution_npu.cc +++ b/mindspore/lite/src/runtime/kernel/npu/convolution_npu.cc @@ -109,15 +109,17 @@ ConvolutionNPUKernel::~ConvolutionNPUKernel() { kernel::LiteKernel *NpuConvKernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *op_parameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(op_parameter != nullptr); MS_ASSERT(desc.type == schema::PrimitiveType_Conv2DFusion); auto conv_param = reinterpret_cast(op_parameter); kernel::NPUKernel *kernel = nullptr; if (conv_param->group_ == 1) { - kernel = new (std::nothrow) kernel::ConvolutionNPUKernel(op_parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) + kernel::ConvolutionNPUKernel(op_parameter, inputs, outputs, static_cast(ctx)); } else if (conv_param->group_ == conv_param->input_channel_ && conv_param->group_ == conv_param->output_channel_) { - kernel = new (std::nothrow) kernel::ConvolutionDepthwiseNPUKernel(op_parameter, inputs, outputs, ctx); + kernel = new (std::nothrow) kernel::ConvolutionDepthwiseNPUKernel(op_parameter, inputs, outputs, + static_cast(ctx)); } else { MS_LOG(ERROR) << "npu do not support group conv!"; kernel = nullptr; diff --git a/mindspore/lite/src/runtime/kernel/npu/npu_kernel.h b/mindspore/lite/src/runtime/kernel/npu/npu_kernel.h index 546af301661..2b08de0ea48 100644 --- a/mindspore/lite/src/runtime/kernel/npu/npu_kernel.h +++ b/mindspore/lite/src/runtime/kernel/npu/npu_kernel.h @@ -60,7 +60,7 @@ class NPUKernel : public LiteKernel { template kernel::LiteKernel *NPUKernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *op_parameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { if (!op_parameter->infer_flag_) { MS_LOG(ERROR) << "NPU does not support runtime inference shape. Type is:" << schema::EnumNamePrimitiveType(static_cast(op_parameter->type_)); @@ -72,7 +72,7 @@ kernel::LiteKernel *NPUKernelCreator(const std::vector &inputs, free(op_parameter); return nullptr; } - auto *kernel = new (std::nothrow) T(op_parameter, inputs, outputs, ctx); + auto *kernel = new (std::nothrow) T(op_parameter, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "kernel " << op_parameter->name_ << "is nullptr."; free(op_parameter); diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d.cc b/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d.cc index 723f720993c..031d512f685 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d.cc @@ -473,7 +473,7 @@ bool UseWinograd4x4To6x6(const ConvParameter *param, const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(!inputs.empty()); MS_ASSERT(!outputs.empty()); MS_ASSERT(opParameter); @@ -484,7 +484,8 @@ kernel::LiteKernel *OpenCLConv2DCreator(const std::vector &input // case 1: depthwise conv2d if (group == input_channel && group == output_channel) { - return OpenCLKernelCreator(inputs, outputs, opParameter, ctx, desc); + return OpenCLKernelCreator(inputs, outputs, opParameter, + static_cast(ctx), desc); } // case 2: group conv2d @@ -499,7 +500,8 @@ kernel::LiteKernel *OpenCLConv2DCreator(const std::vector &input bool infer_shape_done = opParameter->infer_flag_; if (infer_shape_done && UseFcReplaceConv(inputs, outputs, conv_param)) { auto *fc_param = CreateFcParam(conv_param, inputs); - kernel = new (std::nothrow) FullConnectionOpenCLKernel(fc_param, inputs, outputs, ctx); + kernel = new (std::nothrow) + FullConnectionOpenCLKernel(fc_param, inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "Create FullConnection kernel failed."; free(fc_param); @@ -512,10 +514,11 @@ kernel::LiteKernel *OpenCLConv2DCreator(const std::vector &input } else { if (infer_shape_done && UseWinograd4x4To6x6(conv_param, inputs, outputs)) { MS_LOG(DEBUG) << "use Winograd algorithm."; - kernel = - new (std::nothrow) WinogradOpenCLKernel(reinterpret_cast(conv_param), inputs, outputs, ctx); + kernel = new (std::nothrow) WinogradOpenCLKernel(reinterpret_cast(conv_param), inputs, outputs, + static_cast(ctx)); } else { - kernel = new (std::nothrow) Conv2DOpenCLKernel(reinterpret_cast(conv_param), inputs, outputs, ctx); + kernel = new (std::nothrow) Conv2DOpenCLKernel(reinterpret_cast(conv_param), inputs, outputs, + static_cast(ctx)); } if (kernel == nullptr) { MS_LOG(ERROR) << "Create Convolution kernel failed."; diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d_transpose.cc b/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d_transpose.cc index 2a2202cb174..525624ce10d 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d_transpose.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/conv2d_transpose.cc @@ -244,7 +244,7 @@ int Conv2dTransposeOpenCLKernel::InferShape() { kernel::LiteKernel *OpenCLConv2dTransposeCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { MS_ASSERT(!inputs.empty()); MS_ASSERT(!outputs.empty()); MS_ASSERT(opParameter); diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/matmul.cc b/mindspore/lite/src/runtime/kernel/opencl/kernel/matmul.cc index b496ba3ddf8..4f875422120 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/matmul.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/matmul.cc @@ -220,14 +220,16 @@ int MatMulOpenCLKernel::Run() { kernel::LiteKernel *OpenCLMatMulKernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { + const lite::Context *ctx, const kernel::KernelKey &desc) { kernel::OpenCLKernel *kernel = nullptr; bool infer_shape_done = opParameter->infer_flag_; if (infer_shape_done && IsUseStrassenMatmul(inputs)) { MS_LOG(DEBUG) << "use_matmul_strassen"; - kernel = new (std::nothrow) StrassenOpenCLKernel(opParameter, inputs, outputs, ctx); + kernel = new (std::nothrow) + StrassenOpenCLKernel(opParameter, inputs, outputs, static_cast(ctx)); } else { - kernel = new (std::nothrow) MatMulOpenCLKernel(opParameter, inputs, outputs, ctx); + kernel = + new (std::nothrow) MatMulOpenCLKernel(opParameter, inputs, outputs, static_cast(ctx)); } if (kernel == nullptr) { MS_LOG(ERROR) << "kernel " << opParameter->name_ << "is nullptr."; diff --git a/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.h b/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.h index 0594b967a83..7ec7bcf11fc 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.h +++ b/mindspore/lite/src/runtime/kernel/opencl/opencl_kernel.h @@ -235,8 +235,9 @@ class OpenCLKernel : public LiteKernel { template kernel::LiteKernel *OpenCLKernelCreator(const std::vector &inputs, const std::vector &outputs, OpParameter *opParameter, - const lite::InnerContext *ctx, const kernel::KernelKey &desc) { - auto *kernel = new (std::nothrow) T(reinterpret_cast(opParameter), inputs, outputs, ctx); + const lite::Context *ctx, const kernel::KernelKey &desc) { + auto *kernel = new (std::nothrow) + T(reinterpret_cast(opParameter), inputs, outputs, static_cast(ctx)); if (kernel == nullptr) { MS_LOG(ERROR) << "kernel " << opParameter->name_ << "is nullptr."; free(opParameter); diff --git a/mindspore/lite/src/sub_graph_kernel.cc b/mindspore/lite/src/sub_graph_kernel.cc index 44dcd7c30ba..51cf64040f5 100644 --- a/mindspore/lite/src/sub_graph_kernel.cc +++ b/mindspore/lite/src/sub_graph_kernel.cc @@ -173,7 +173,7 @@ int CpuSubGraph::Run(const KernelCallBack &before, const KernelCallBack &after) #endif #ifdef SUPPORT_GPU // In heterogeneous scenarios of CPU and GPU, call MutableData to MapBuffer(synchronize data). - if (context_->IsGpuEnabled()) { + if (static_cast(context_)->IsGpuEnabled()) { for (auto tensor : this->in_tensors()) { tensor->MutableData(); }