Skip to content

Commit

Permalink
Remove deprecated option and enable compilation without device
Browse files Browse the repository at this point in the history
  • Loading branch information
DariaMityagina committed Jun 18, 2021
1 parent 9dd0531 commit ef95552
Show file tree
Hide file tree
Showing 17 changed files with 8 additions and 65 deletions.
2 changes: 0 additions & 2 deletions inference-engine/include/vpu/myriad_plugin_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ DECLARE_VPU_MYRIAD_CONFIG_KEY(PLATFORM);
* @brief Supported keys definition for VPU_MYRIAD_CONFIG_KEY(PLATFORM) option.
*/
INFERENCE_ENGINE_DEPRECATED("")
DECLARE_VPU_MYRIAD_CONFIG_VALUE(2450);
INFERENCE_ENGINE_DEPRECATED("")
DECLARE_VPU_MYRIAD_CONFIG_VALUE(2480);

/**
Expand Down
1 change: 0 additions & 1 deletion inference-engine/src/vpu/myriad_plugin/myriad_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ IE_SUPPRESS_DEPRECATED_END
void MyriadConfig::parse(const std::map<std::string, std::string>& config) {
IE_SUPPRESS_DEPRECATED_START
static const std::unordered_map<std::string, ncDevicePlatform_t> platformsDeprecated = {
{ VPU_MYRIAD_CONFIG_VALUE(2450), NC_MYRIAD_2 },
{ VPU_MYRIAD_CONFIG_VALUE(2480), NC_MYRIAD_X },
{ std::string(), NC_ANY_PLATFORM }
};
Expand Down
10 changes: 5 additions & 5 deletions inference-engine/src/vpu/myriad_plugin/myriad_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,15 @@ DevicePtr MyriadExecutor::openDevice(std::vector<DevicePtr>& devicePool,
return device->isBooted() && device->isNotFull()
&& device->isSuitableForConfig(config);
});

// Return mock device. If try infer with it, exception will be thrown
if (availableDevices.empty() && config.platform() != NC_ANY_PLATFORM) {
if (availableDevices.empty()) {
if (config.platform() == NC_ANY_PLATFORM) {
_log->warning("No booted device");
}
DeviceDesc device;
device._platform = config.platform();
device._protocol = config.protocol();
return std::make_shared<DeviceDesc>(device);
} else if (availableDevices.empty()) {
IE_THROW() << "Can not init Myriad device: " << ncStatusToStr(nullptr, booted);
}

auto deviceWithMinExecutors = std::min_element(availableDevices.begin(), availableDevices.end(),
Expand Down Expand Up @@ -376,7 +376,7 @@ void MyriadExecutor::allocateGraph(DevicePtr &device, GraphDesc &graphDesc,
IE_THROW() << "Failed to get output description: " << ncStatusToStr(graphDesc._graphHandle, status);
}

unsigned int fifo_elements = (device->_platform == NC_MYRIAD_2 && executors == 1) ? 4 : 2 * executors;
unsigned int fifo_elements = (executors == 1) ? 4 : 2 * executors;

status = ncFifoCreate("input", NC_FIFO_HOST_WO, &graphDesc._inputFifoHandle);
if (status != NC_OK) {
Expand Down
3 changes: 1 addition & 2 deletions inference-engine/src/vpu/myriad_plugin/myriad_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ struct DeviceDesc {
}

ncDevicePlatform_t revision() const {
VPU_THROW_UNLESS(_platform != NC_ANY_PLATFORM, "Cannot get a revision from not booted device");
return _platform;
return ncDevicePlatform_t::NC_MYRIAD_X;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,3 @@ TEST_F(MyriadLoadNetworkTestCase, smoke_ThrowsExeptionWhenNameIsInvalid) {
ASSERT_ANY_THROW(ExeNetwork exe_network =
ie->LoadNetwork(cnnNetwork, "MYRIAD", config));
}

TEST_F(MyriadLoadNetworkTestCase, smoke_ThrowsExeptionWhenPlatformConflictWithProtocol) {
std::string wrong_platform;
auto devices = getDevicesList();
ASSERT_TRUE(devices.size());

auto device_to_load = devices[0];

IE_SUPPRESS_DEPRECATED_START
if(isMyriadXDevice(device_to_load)) {
wrong_platform = VPU_MYRIAD_2450;
} else {
wrong_platform = VPU_MYRIAD_2480;
}
IE_SUPPRESS_DEPRECATED_END

std::map<std::string, std::string> config = {
{KEY_DEVICE_ID, device_to_load},
{KEY_VPU_MYRIAD_PLATFORM, wrong_platform},
};

ASSERT_ANY_THROW(ExeNetwork exe_network =
ie->LoadNetwork(cnnNetwork, "MYRIAD", config));
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ const std::vector<BehTestParams> deviceSpecificConfigurations = {
BEH_MYRIAD.withConfig({{InferenceEngine::MYRIAD_PROTOCOL, InferenceEngine::MYRIAD_PCIE}}),

// Deprecated
BEH_MYRIAD.withConfig({{VPU_MYRIAD_CONFIG_KEY(PLATFORM), VPU_MYRIAD_CONFIG_VALUE(2450)}}),
BEH_MYRIAD.withConfig({{VPU_MYRIAD_CONFIG_KEY(PLATFORM), VPU_MYRIAD_CONFIG_VALUE(2480)}}),

BEH_MYRIAD.withConfig({{VPU_MYRIAD_CONFIG_KEY(PROTOCOL), VPU_MYRIAD_CONFIG_VALUE(USB)}}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ TEST_P(myriadIncorrectModelsConfigsTests_nightly, LoadNetworkWithIncorrectConfig
//------------------------------------------------------------------------------

static const std::vector<config_t> myriadCorrectPlatformConfigValues = {
{{VPU_MYRIAD_CONFIG_KEY(PLATFORM), VPU_MYRIAD_CONFIG_VALUE(2450)}},
{{VPU_MYRIAD_CONFIG_KEY(PLATFORM), VPU_MYRIAD_CONFIG_VALUE(2480)}},
{{VPU_MYRIAD_CONFIG_KEY(PLATFORM), ""}}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,9 @@ static bool hasAppropriateStick(const config_t &config) {
if (platform == config.end() || platform->second.empty()) {
suitsConfig = hasMyriad2() || hasMyriadX();
} else {
bool hasRequestedMyriad2 =
platform->second == VPU_MYRIAD_CONFIG_VALUE(2450) && hasMyriad2();
bool hasRequestedMyriadX =
platform->second == VPU_MYRIAD_CONFIG_VALUE(2480) && hasMyriadX();
suitsConfig = hasRequestedMyriad2 || hasRequestedMyriadX;
suitsConfig = hasRequestedMyriadX;
}

return suitsConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ IE_SUPPRESS_DEPRECATED_START

static const std::vector<config_t> myriadCorrectPlatformConfigValues = {
// Deprecated
{{VPU_MYRIAD_CONFIG_KEY(PLATFORM), VPU_MYRIAD_CONFIG_VALUE(2450)}},
{{VPU_MYRIAD_CONFIG_KEY(PLATFORM), VPU_MYRIAD_CONFIG_VALUE(2480)}},
{{VPU_MYRIAD_CONFIG_KEY(PLATFORM), ""}}
};
Expand All @@ -47,12 +46,10 @@ static const std::vector<config_t> myriadCorrectProtocolConfigValues = {
static const std::vector<config_t> myriadIncorrectProtocolConfigValues = {
// Protocols
{{InferenceEngine::MYRIAD_PROTOCOL, "0"}},
{{InferenceEngine::MYRIAD_PROTOCOL, "2450"}},
{{InferenceEngine::MYRIAD_PROTOCOL, "PCI"}},

// Deprecated
{{VPU_MYRIAD_CONFIG_KEY(PROTOCOL), "0"}},
{{VPU_MYRIAD_CONFIG_KEY(PROTOCOL), "2450"}},
{{VPU_MYRIAD_CONFIG_KEY(PROTOCOL), "PCI"}},
};

Expand Down
1 change: 0 additions & 1 deletion inference-engine/thirdparty/movidius/mvnc/include/mvnc.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ typedef enum {

typedef enum {
NC_ANY_PLATFORM = 0,
NC_MYRIAD_2 = 2450,
NC_MYRIAD_X = 2480,
} ncDevicePlatform_t;

Expand Down
3 changes: 0 additions & 3 deletions inference-engine/thirdparty/movidius/mvnc/src/mvnc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ char* ncProtocolToStr(const ncDeviceProtocol_t deviceProtocol) {

char* ncPlatformToStr(const ncDevicePlatform_t platform) {
switch(platform) {
case NC_MYRIAD_2: return "NC_MYRIAD_2";
case NC_MYRIAD_X: return "NC_MYRIAD_X";
default: return "NC_ANY_PLATFORM";
}
Expand Down Expand Up @@ -2670,8 +2669,6 @@ static ncStatus_t getDeviceOption(struct _devicePrivate_t *d,
case NC_RO_DEVICE_PLATFORM:
if (d->dev_attr.fw_version[1] == 0x2480){
*(ncDevicePlatform_t *) data = NC_MYRIAD_X;
} else if (d->dev_attr.fw_version[1] == 0x2450) {
*(ncDevicePlatform_t *) data = NC_MYRIAD_2;
} else {
*(ncDevicePlatform_t *) data = NC_ANY_PLATFORM;
}
Expand Down
2 changes: 0 additions & 2 deletions inference-engine/thirdparty/movidius/mvnc/src/mvnc_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ XLinkPlatform_t convertPlatformToXlink(
const ncDevicePlatform_t ncProtocol) {
switch (ncProtocol) {
case NC_ANY_PLATFORM: return X_LINK_ANY_PLATFORM;
case NC_MYRIAD_2: return X_LINK_MYRIAD_2;
case NC_MYRIAD_X: return X_LINK_MYRIAD_X;
default: return X_LINK_ANY_PLATFORM;
}
Expand All @@ -49,7 +48,6 @@ ncDevicePlatform_t convertPlatformToNC(
const XLinkPlatform_t xLinkProtocol) {
switch (xLinkProtocol) {
case X_LINK_ANY_PLATFORM: return NC_ANY_PLATFORM;
case X_LINK_MYRIAD_2: return NC_MYRIAD_2;
case X_LINK_MYRIAD_X: return NC_MYRIAD_X;
default:
mvLog(MVLOG_WARN, "This convertation not supported, set to NC_ANY_PLATFORM");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ static const std::vector<ncDeviceProtocol_t> myriadProtocols = {
};

static const std::vector<ncDevicePlatform_t> myriadPlatforms = {
NC_MYRIAD_2,
NC_MYRIAD_X
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ long getAmountOfMyriadXDevices(ncDeviceProtocol_t deviceProtocol) {
return getAmountOfDevices(deviceProtocol, NC_MYRIAD_X);
}

long getAmountOfMyriad2Devices(ncDeviceProtocol_t deviceProtocol) {
return getAmountOfDevices(deviceProtocol, NC_MYRIAD_2);
}

long getAmountOfBootedDevices(ncDeviceProtocol_t deviceProtocol) {
return getAmountOfDevices(deviceProtocol, NC_ANY_PLATFORM, X_LINK_BOOTED);
}
Expand Down Expand Up @@ -114,7 +110,6 @@ bool isSameProtocolDevice(const std::string &deviceName, const ncDeviceProtocol_
bool
isSamePlatformUSBDevice(const std::string &deviceName, const ncDevicePlatform_t expectedPlatform) {
switch (expectedPlatform) {
case NC_MYRIAD_2: return isMyriad2USBDevice(deviceName);
case NC_MYRIAD_X: return isMyriadXUSBDevice(deviceName);
case NC_ANY_PLATFORM:
return isMyriad2USBDevice(deviceName) || isMyriadXUSBDevice(deviceName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,7 @@ TEST_F(MvncOpenUSBDevice, CheckErrorWhenPlatformConflictWithName) {

ASSERT_TRUE(availableDevices.size());

if(isMyriadXUSBDevice(availableDevices[0])) {
wrongPlatform = NC_MYRIAD_2;
} else {
if(!isMyriadXUSBDevice(availableDevices[0])) {
wrongPlatform = NC_MYRIAD_X;
}

Expand Down
4 changes: 0 additions & 4 deletions inference-engine/tools/compile_tool/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ static std::map<std::string, std::string> configure() {
auto config = parseConfigFile();

if (isMYRIAD) {
IE_SUPPRESS_DEPRECATED_START
config[VPU_MYRIAD_CONFIG_KEY(PLATFORM)] = "VPU_MYRIAD_2480";
IE_SUPPRESS_DEPRECATED_END

if (!FLAGS_VPU_NUMBER_OF_SHAVES.empty()) {
config[InferenceEngine::MYRIAD_NUMBER_OF_SHAVES] = FLAGS_VPU_NUMBER_OF_SHAVES;
}
Expand Down
4 changes: 0 additions & 4 deletions inference-engine/tools/vpu/vpu_compile/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ static bool parseCommandLine(int *argc, char ***argv) {
static std::map<std::string, std::string> configure(const std::string &configFile, const std::string &xmlFileName) {
auto config = parseConfig(configFile);

IE_SUPPRESS_DEPRECATED_START
config[VPU_MYRIAD_CONFIG_KEY(PLATFORM)] = "VPU_MYRIAD_2480";
IE_SUPPRESS_DEPRECATED_END

if (!FLAGS_VPU_NUMBER_OF_SHAVES.empty()) {
config[InferenceEngine::MYRIAD_NUMBER_OF_SHAVES] = FLAGS_VPU_NUMBER_OF_SHAVES;
}
Expand Down

0 comments on commit ef95552

Please sign in to comment.