Remove catch(...) code style (#14433)

* remove ... in /src/bindings/c and resolve format

* remove ... in auto and resolve format

* remove ... in auto batch and resolve format

* remove ... in hetero and resolve format

* IE exception

* IE exception

* const

* const

* resolve format and ov::Exception

* ov::Exception

* reset IE::Exception

* remove ov::Exception

* InferenceEngine->IE in auto_schedule.cpp

* fix coredump while runing test case smoke_AutoMultiMock_NumStreamsAndDefaultPerfHintToHWTest

* fix coredump issue of running LoadNetworkWithSecondaryConfigsMockTest

* fix commpile fail in CI

* resolve core dump of running exec_network_get_metrics.cpp and disable some test cases for KEEMBAY and MYRIAD in exec_network_get_metrics.cpp

* remove test cases of MYRIAD and resolve core dump of running KEEMBAYin exec_network_get_metrics.cpp

* resolve conflic of common.h

* resolve conflic of common.h

* resolve common.h complie fail

---------

Co-authored-by: guozhong <guozhong.wang@intel.com>
Co-authored-by: Ilya Churaev <ilya.churaev@intel.com>
This commit is contained in:
authored and GitHub committed 2023-02-16 11:44:24 +08:00
1 parent 0a224a8804
commit 3f06d871bf
12 files changed
+24 -16

No files matched your search

+1 -1
View File
@@ -196,7 +196,7 @@ std::map<IE::ColorFormat, colorformat_e> colorformat_map = {{IE::ColorFormat::RA
CATCH_IE_EXCEPTION(INFER_NOT_STARTED, InferNotStarted) \
CATCH_IE_EXCEPTION(NETWORK_NOT_READ, NetworkNotRead) \
CATCH_IE_EXCEPTION(INFER_CANCELLED, InferCancelled) \
catch (...) { \
catch (const std::exception&) { \
return IEStatusCode::UNEXPECTED; \
}
+2 -2
View File
@@ -92,7 +92,7 @@ IE::Parameter AutoExecutableNetwork::GetMetric(const std::string& name) const {
bThroughputEnabledInPlugin =
_autoSContext->_core->GetConfig(deviceInfo.deviceName,
CONFIG_KEY(PERFORMANCE_HINT)).as<std::string>() == CONFIG_VALUE(THROUGHPUT);
} catch (...) {
} catch (const IE::Exception&) {
LOG_DEBUG_TAG("GetMetric:%s for %s", "PERF_HINT config not supported",
deviceInfo.deviceName.c_str());
}
@@ -117,7 +117,7 @@ IE::Parameter AutoExecutableNetwork::GetMetric(const std::string& name) const {
METRIC_KEY(OPTIMAL_BATCH_SIZE), options).as<unsigned int>();
LOG_DEBUG_TAG("BATCHING:%s:%ld", "optimal batch size",
optimalBatchSize);
} catch (...) {
} catch (const IE::Exception&) {
LOG_DEBUG_TAG("BATCHING:%s", "metric OPTIMAL_BATCH_SIZE not supported");
}
}
+3 -3
View File
@@ -212,7 +212,7 @@ void AutoSchedule::init(const ScheduleContext::Ptr& sContext) {
deviceName.c_str(),
cfg.c_str(),
contextPtr->executableNetwork->GetConfig(cfg).as<std::string>().c_str());
} catch (...) {
} catch (const IE::Exception&) {
}
}
});
@@ -323,7 +323,7 @@ void AutoSchedule::TryToLoadNetWork(AutoLoadContext& context, const std::string&
int maxNumThreads = 0;
try {
maxNumThreads = _autoSContext->_core->GetConfig(device, GPU_CONFIG_KEY(MAX_NUM_THREADS)).as<int>();
} catch (...) {
} catch (const IE::Exception&) {
LOG_DEBUG_TAG("cannot get MAX_NUM_THREADS from GPU");
}
if (maxNumThreads == static_cast<int>(std::thread::hardware_concurrency())) {
@@ -537,7 +537,7 @@ IInferPtr AutoSchedule::CreateInferRequest() {
try {
perfmode = _passthroughExeNet->GetConfig(
CONFIG_KEY(PERFORMANCE_HINT)).as<std::string>();
} catch(...) {
} catch (const IE::Exception&) {
LOG_INFO("query perf hint from passthrough network failed");
}
if (_autoSContext->_batchingDisabled || perfmode != CONFIG_VALUE(THROUGHPUT)) {
+1 -1
View File
@@ -308,7 +308,7 @@ IInferPtr MultiSchedule::CreateInferRequest() {
try {
perfmode = _passthroughExeNet->GetConfig(
CONFIG_KEY(PERFORMANCE_HINT)).as<std::string>();
} catch(...) {
} catch (const IE::Exception&) {
LOG_INFO("query perf hint from passthrough network failed");
}
if (_multiSContext->_batchingDisabled || perfmode != CONFIG_VALUE(THROUGHPUT)) {
+2 -2
View File
@@ -533,7 +533,7 @@ IExecutableNetworkInternal::Ptr MultiDeviceInferencePlugin::LoadNetworkImpl(cons
deviceName.c_str(),
sThreadNums.c_str());
}
} catch (...) {
} catch (const IE::Exception&) {
LOG_DEBUG_TAG("deviceName:%s cannot get streamNums and threadNums from exec_net", deviceName.c_str());
}
std::unique_lock<std::mutex> lock{load_mutex};
@@ -592,7 +592,7 @@ IExecutableNetworkInternal::Ptr MultiDeviceInferencePlugin::LoadNetworkImpl(cons
num_plugins_supporting_perf_counters +=
n.second->GetConfig(PluginConfigParams::KEY_PERF_COUNT).as<std::string>() ==
PluginConfigParams::YES;
} catch (...) {
} catch (const IE::Exception&) {
}
}
// MULTI can enable the perf counters only if all devices support/enable that
+1 -1
View File
@@ -148,7 +148,7 @@ struct PluginConfig {
<< " for key: " << kvp.first;
}
_batchTimeout = kvp.second;
} catch (...) {
} catch (const std::exception&) {
IE_THROW() << "Unsupported config value: " << kvp.second
<< " for key: " << kvp.first;
}
+1 -1
View File
@@ -52,7 +52,7 @@ inline int parseInteger(const char* str) {
std::string var(str ? str : "");
try {
return std::stoi(var);
} catch (...) {
} catch (const std::exception&) {
return INT32_MAX;
}
}
+2 -2
View File
@@ -902,7 +902,7 @@ InferenceEngine::IExecutableNetworkInternal::Ptr AutoBatchInferencePlugin::LoadN
if (!batched_inputs.size() || !batched_outputs.size())
IE_THROW(NotImplemented)
<< "Auto-batching supports only networks with inputs/outputs featuring batched dim!";
} catch (...) {
} catch (const InferenceEngine::Exception&) {
metaDevice.batchForDevice = 1;
}
@@ -969,7 +969,7 @@ InferenceEngine::IExecutableNetworkInternal::Ptr AutoBatchInferencePlugin::LoadN
reshaped.reshape(shapes);
executableNetworkWithBatch = ctx ? core->LoadNetwork(reshaped, ctx, deviceConfigNoAutoBatch)
: core->LoadNetwork(reshaped, deviceName, deviceConfigNoAutoBatch);
} catch (...) {
} catch (const InferenceEngine::Exception&) {
metaDevice.batchForDevice = 1;
}
}
+1 -1
View File
@@ -48,7 +48,7 @@ StatusCode HeteroAsyncInferRequest::Wait(int64_t millis_timeout) {
auto waitStatus = StatusCode::OK;
try {
waitStatus = AsyncInferRequestThreadSafeDefault::Wait(millis_timeout);
} catch (...) {
} catch (const InferenceEngine::Exception&) {
for (auto&& requestDesc : _heteroInferRequest->_inferRequests) {
requestDesc._request->Wait(InferRequest::RESULT_READY);
}
@@ -295,6 +295,8 @@ public:
std::vector<std::string> configKeys = {"SUPPORTED_CONFIG_KEYS", "NUM_STREAMS"};
ON_CALL(*core, GetMetric(_, StrEq(METRIC_KEY(SUPPORTED_CONFIG_KEYS)), _)).WillByDefault(Return(configKeys));
ON_CALL(*core, GetConfig(_, StrEq(GPU_CONFIG_KEY(MAX_NUM_THREADS)))).WillByDefault(Return(12));
ON_CALL(*plugin, ParseMetaDevices)
.WillByDefault(
[this](const std::string& priorityDevices, const std::map<std::string, std::string>& config) {
@@ -174,6 +174,8 @@ public:
std::vector<std::string> configKeys = {"SUPPORTED_CONFIG_KEYS", "NUM_STREAMS"};
ON_CALL(*core, GetMetric(_, StrEq(METRIC_KEY(SUPPORTED_CONFIG_KEYS)), _)).WillByDefault(Return(configKeys));
ON_CALL(*core, GetConfig(_, StrEq(GPU_CONFIG_KEY(MAX_NUM_THREADS)))).WillByDefault(Return(12));
ON_CALL(*plugin, ParseMetaDevices)
.WillByDefault(
[this](const std::string& priorityDevices, const std::map<std::string, std::string>& config) {
@@ -194,10 +194,13 @@ TEST_P(ExecNetworkGetMetric, OPTIMAL_NUMBER_OF_INFER_REQUESTS) {
metaDevices.push_back({actualDeviceName, {{CONFIG_KEY(PERFORMANCE_HINT),
InferenceEngine::PluginConfigParams::THROUGHPUT}}, actualCustomerNum, ""});
// enable autoBatch
IE_SET_METRIC(OPTIMAL_BATCH_SIZE, optimalBatchNum, 8);
IE_SET_METRIC(OPTIMAL_BATCH_SIZE, gpuOptimalBatchNum, 8);
IE_SET_METRIC(OPTIMAL_BATCH_SIZE, keembayOptimalBatchNum, 1);
IE_SET_METRIC(RANGE_FOR_STREAMS, rangeOfStreams, std::make_tuple<unsigned int, unsigned int>(1, 3));
ON_CALL(*core.get(), GetMetric(StrEq(CommonTestUtils::DEVICE_GPU), StrEq(METRIC_KEY(OPTIMAL_BATCH_SIZE)), _))
.WillByDefault(RETURN_MOCK_VALUE(optimalBatchNum));
.WillByDefault(RETURN_MOCK_VALUE(gpuOptimalBatchNum));
ON_CALL(*core.get(), GetMetric(StrEq(CommonTestUtils::DEVICE_KEEMBAY), StrEq(METRIC_KEY(OPTIMAL_BATCH_SIZE)), _))
.WillByDefault(RETURN_MOCK_VALUE(keembayOptimalBatchNum));
ON_CALL(*core.get(), GetMetric(_, StrEq(METRIC_KEY(RANGE_FOR_STREAMS)), _))
.WillByDefault(RETURN_MOCK_VALUE(rangeOfStreams));
ON_CALL(*core.get(), GetConfig(_, StrEq(CONFIG_KEY(PERFORMANCE_HINT))))
@@ -212,6 +215,7 @@ TEST_P(ExecNetworkGetMetric, OPTIMAL_NUMBER_OF_INFER_REQUESTS) {
} else {
metaDevices.push_back({CommonTestUtils::DEVICE_CPU, {}, cpuCustomerNum, ""});
metaDevices.push_back({actualDeviceName, {}, actualCustomerNum, ""});
ON_CALL(*core, GetConfig(_, StrEq(GPU_CONFIG_KEY(MAX_NUM_THREADS)))).WillByDefault(Return(8));
}
ON_CALL(*plugin, SelectDevice(_, _, _)).WillByDefault(Return(metaDevices[1]));
ON_CALL(*plugin, ParseMetaDevices(_, _)).WillByDefault(Return(metaDevices));