diff --git a/.jenkins/check/config/filter_cpplint.txt b/.jenkins/check/config/filter_cpplint.txt index 7e138857a66c4cec06af15a772f77f8097a7b1ec..b451b95a6a062b1f50983d528c6dbe5978225ec0 100644 --- a/.jenkins/check/config/filter_cpplint.txt +++ b/.jenkins/check/config/filter_cpplint.txt @@ -8,6 +8,8 @@ "mindspore-lite/mindspore-lite/tools/converter/parser/tflite/tflite_node_parser.h" "runtime/references" "mindspore-lite/mindspore-lite/tools/converter/quantizer/quantize_util.h" "runtime/references" "mindspore-lite/mindspore-lite/tools/benchmark/benchmark.cc" "runtime/threadsafe_fn" +"mindspore-lite/mindspore-lite/tools/benchmark/benchmark_base.h" "whitespace/indent_namespace" +"mindspore-lite/mindspore-lite/tools/benchmark/benchmark_base.cc" "whitespace/indent_namespace" "mindspore-lite/mindspore-lite/tools/benchmark/benchmark_base.cc" "runtime/threadsafe_fn" "mindspore-lite/mindspore-lite/tools/benchmark/benchmark_unified_api.cc" "runtime/threadsafe_fn" "mindspore-lite/mindspore-lite/tools/benchmark/run_benchmark.cc" "runtime/threadsafe_fn" diff --git a/mindspore-lite/tools/benchmark/benchmark_base.cc b/mindspore-lite/tools/benchmark/benchmark_base.cc index a6a15c63e5fbe1c0427ca908ed3f792b11d0761f..333e77ff31063f4e76cc72f142e53131c403dbd3 100644 --- a/mindspore-lite/tools/benchmark/benchmark_base.cc +++ b/mindspore-lite/tools/benchmark/benchmark_base.cc @@ -18,6 +18,12 @@ #define __STDC_FORMAT_MACROS #include #undef __STDC_FORMAT_MACROS +#include +#include +#include +#include +#include +#include #include #include #include @@ -398,7 +404,8 @@ int BenchmarkBase::CheckThreadNumValid() { } int BenchmarkBase::CheckDeviceTypeValid() { - if (flags_->device_ != "CPU" && flags_->device_ != "GPU" && flags_->device_ != "NPU" && flags_->device_ != "Ascend") { + if (flags_->device_ != "CPU" && flags_->device_ != "GPU" && flags_->device_ != "NPU" && flags_->device_ != "Ascend" && + flags_->device_ != "DSP") { MS_LOG(ERROR) << "Device type:" << flags_->device_ << " is not supported."; std::cerr << "Device type:" << flags_->device_ << " is not supported." << std::endl; return RET_ERROR; diff --git a/mindspore-lite/tools/benchmark/benchmark_base.h b/mindspore-lite/tools/benchmark/benchmark_base.h index f7fc67138466768a1ee6b1a3d6aa110a675aee7d..81b4bfb399995fbedb326c2dab81987b9b7c640b 100644 --- a/mindspore-lite/tools/benchmark/benchmark_base.h +++ b/mindspore-lite/tools/benchmark/benchmark_base.h @@ -122,7 +122,7 @@ class MS_API BenchmarkFlags : public virtual FlagParser { AddFlag(&BenchmarkFlags::in_data_file_, "inDataFile", "Input data file, if not set, use random input", ""); AddFlag(&BenchmarkFlags::group_info_file_, "GroupInfoFile", "Communication group info file", ""); AddFlag(&BenchmarkFlags::config_file_, "configFile", "Config file", ""); - AddFlag(&BenchmarkFlags::device_, "device", "CPU | GPU | NPU | Ascend | Auto", "CPU"); + AddFlag(&BenchmarkFlags::device_, "device", "CPU | GPU | NPU | Ascend | DSP | Auto", "CPU"); AddFlag(&BenchmarkFlags::provider_, "provider", "device provider litert | tensorrt | mindrt", "litert"); AddFlag(&BenchmarkFlags::cpu_bind_mode_, "cpuBindMode", "Input 0 for NO_BIND, 1 for HIGHER_CPU, 2 for MID_CPU.", 1); // MarkPerformance diff --git a/mindspore-lite/tools/benchmark/benchmark_unified_api.cc b/mindspore-lite/tools/benchmark/benchmark_unified_api.cc index e59933aa61770188c3e083779cb9f6e01b8cb61d..722d7f74c38944f40828082104bf4c47436b1efa 100644 --- a/mindspore-lite/tools/benchmark/benchmark_unified_api.cc +++ b/mindspore-lite/tools/benchmark/benchmark_unified_api.cc @@ -18,6 +18,12 @@ #define __STDC_FORMAT_MACROS #include #undef __STDC_FORMAT_MACROS +#include +#include +#include +#include +#include +#include #include #include #include @@ -524,6 +530,12 @@ int BenchmarkUnifiedApi::InitMSContext(const std::shared_ptr InitMSContextForAscend(context, &device_list); } + if (flags_->device_ == "DSP" || flags_->device_ == "Auto") { + std::shared_ptr dsp_device_info = std::make_shared(); + device_list.push_back(dsp_device_info); + context->SetEnableParallel(flags_->enable_parallel_); + } + // CPU priority is behind GPU and NPU std::shared_ptr device_info = std::make_shared(); device_info->SetEnableFP16(flags_->enable_fp16_);