support cache dir in multi/auto/batch (#13507)

* support cache dir in multi/auto

Signed-off-by: fishbell <bell.song@intel.com>

* support cache_dir in bat h

Signed-off-by: fishbell <bell.song@intel.com>

* fix case failure

Signed-off-by: fishbell <bell.song@intel.com>

* clang format

Signed-off-by: fishbell <bell.song@intel.com>

Signed-off-by: fishbell <bell.song@intel.com>
This commit is contained in:
yanlan song
2022-10-19 10:15:03 +08:00
committed by GitHub
parent 226e94aa66
commit 5e2869cd14
4 changed files with 131 additions and 17 deletions

View File

@@ -27,7 +27,9 @@
namespace AutoBatchPlugin {
using namespace InferenceEngine;
std::vector<std::string> supported_configKeys = {CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG), CONFIG_KEY(AUTO_BATCH_TIMEOUT)};
std::vector<std::string> supported_configKeys = {CONFIG_KEY(AUTO_BATCH_DEVICE_CONFIG),
CONFIG_KEY(AUTO_BATCH_TIMEOUT),
CONFIG_KEY(CACHE_DIR)};
template <Precision::ePrecision precision>
Blob::Ptr create_shared_blob_on_top_of_batched_blob(Blob::Ptr batched_blob,
@@ -695,8 +697,15 @@ DeviceInformation AutoBatchInferencePlugin::ParseMetaDevice(const std::string& d
if (!deviceIDLocal.empty()) {
tconfig[PluginConfigParams::KEY_DEVICE_ID] = deviceIDLocal;
}
return GetCore()->GetSupportedConfig(deviceName, tconfig);
// passthrough the cache dir to core->loadnetwork when underlying device does not support cache dir
auto deviceConfig = GetCore()->GetSupportedConfig(deviceName, tconfig);
if (tconfig.find(CONFIG_KEY(CACHE_DIR)) != tconfig.end() &&
deviceConfig.find(CONFIG_KEY(CACHE_DIR)) == deviceConfig.end()) {
auto tmpiter = tconfig.find(CONFIG_KEY(CACHE_DIR));
if (tmpiter != tconfig.end())
deviceConfig.insert({tmpiter->first, tmpiter->second});
}
return deviceConfig;
};
auto metaDevice = ParseBatchDevice(devicesBatchCfg);