Skip to content

Commit

Permalink
[Conformance Test] Fix cache test case failure for auto plugin (openv…
Browse files Browse the repository at this point in the history
…inotoolkit#23473)

### Details:
- check if the blob size remains the same as it was during the initial
caching of the compiled model, rather than comparing it with a specified
number, such as 1 in this case.
- count the size of cached blobs after the model compilation is
completed on all HW plugin within AUTO plugin.

### Tickets:
 - CVS-130395
  • Loading branch information
yangwang201911 authored and bbielawx committed Apr 12, 2024
1 parent 23949d5 commit 6590eb0
Showing 1 changed file with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,23 +242,35 @@ void CompileModelCacheTestBase::run() {
GTEST_FAIL() << "Can't compile network without cache for " << m_functionName << " with precision " << m_precision.get_type_name() << std::endl;
}
auto originalOutputs = get_plugin_outputs();

size_t blobCountInitial = -1;
size_t blobCountAfterwards = -1;
for (int i = 0; i < 2; i++) {
// Step 2: Load with cache. Export or import shall not throw
compiledModel = {}; // Destroy network object
inferRequest = {};
{
core->set_property(ov::cache_dir(m_cacheFolderName));
ASSERT_NO_THROW(compiledModel = core->compile_model(function, targetDevice, configuration));
if (targetDevice.find("AUTO") == std::string::npos)
if (targetDevice.find("AUTO") == std::string::npos) {
// Apply check only for HW plugins
ASSERT_EQ(i != 0, compiledModel.get_property(ov::loaded_from_cache));
}
generate_inputs(targetStaticShapes.front());
ASSERT_NO_THROW(infer());
}
// cache is created and reused
ASSERT_EQ(ov::test::utils::listFilesWithExt(m_cacheFolderName, "blob").size(), 1);
compare(originalOutputs, get_plugin_outputs());
// Destroy objects here
// AUTO plugin will wait all HW plugins to finish compiling model
// No impact for HW plugins
compiledModel = {};
inferRequest = {};
if (i == 0) {
// blob count should be greater than 0 initially
blobCountInitial = ov::test::utils::listFilesWithExt(m_cacheFolderName, "blob").size();
ASSERT_GT(blobCountInitial, 0);
} else {
// cache is created and reused. Blob count should be same as it was first time
blobCountAfterwards = ov::test::utils::listFilesWithExt(m_cacheFolderName, "blob").size();
ASSERT_EQ(blobCountInitial, blobCountAfterwards);
}
}
if ((targetDevice.find("GPU") != std::string::npos)) {
#if !defined(_WIN32) && !defined(_WIN64)
Expand Down

0 comments on commit 6590eb0

Please sign in to comment.