Skip to content

Commit 3b18988

Browse files
qukhancopybara-github
authored andcommitted
Skip in-memory XNNPack weight cache tests on Windows.
That feature is not supported on Windows. PiperOrigin-RevId: 775659160
1 parent 5bc82fc commit 3b18988

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tflite/delegates/xnnpack/weight_cache_test.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,11 @@ struct BuildMMapWeightCacheProviderTest : testing::TestWithParam<TestVariant> {
681681
enum { kBufferId1, kBufferId2, kBufferId3, kBufferId4 };
682682

683683
void SetUp() override {
684+
if (use_in_memory_cache &&
685+
!TfLiteXNNPackDelegateCanUseInMemoryWeightCacheProvider()) {
686+
GTEST_SKIP() << "In-memory weight cache isn't enabled for this build or "
687+
"isn't supported by the current system, skipping test.";
688+
}
684689
AddTensors();
685690
EndSetup();
686691
}
@@ -833,6 +838,10 @@ struct LoadMMapWeightCacheProviderTest : BuildMMapWeightCacheProviderTest {
833838

834839
void SetUp() override {
835840
BuildMMapWeightCacheProviderTest::SetUp();
841+
if (IsSkipped()) {
842+
return;
843+
}
844+
836845
ASSERT_TRUE(cache_provider.StartBuildStep());
837846

838847
pack_id_1 = ctx.PackTensors(&cache_provider.GetCacheProvider(), kAlgoSeed1,
@@ -889,6 +898,13 @@ TEST_P(LoadMMapWeightCacheProviderTest, LookUpSucceeds) {
889898
}
890899

891900
struct MMapWeightCacheProviderTest : testing::TestWithParam<TestVariant> {
901+
void SetUp() override {
902+
if (use_in_memory_cache &&
903+
!TfLiteXNNPackDelegateCanUseInMemoryWeightCacheProvider()) {
904+
GTEST_SKIP() << "In-memory weight cache isn't enabled for this build or "
905+
"isn't supported by the current system, skipping test.";
906+
}
907+
}
892908
bool use_explicit_fd = GetParam().use_explicit_fd;
893909
const char* const explicit_fd_path = GetParam().explicit_fd_path;
894910
const bool use_in_memory_cache = GetParam().use_in_memory_cache;

0 commit comments

Comments
 (0)