Skip to content

Commit

Permalink
Enable for faiss tests (facebookresearch#3002)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebookresearch#3002

title

Reviewed By: jbardini

Differential Revision: D48266242

fbshipit-source-id: b53e186f1954916a90dc8dbba67963f40d0aead7
  • Loading branch information
fgasperij authored and facebook-github-bot committed Aug 14, 2023
1 parent ef7e945 commit e3deb71
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 66 deletions.
4 changes: 2 additions & 2 deletions tests/test_RCQ_cropping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/* This test creates a 3-level RCQ and performs a search on it.
* Then it crops the RCQ to just the 2 first levels and verifies that
* the 3-level vectors are in a subtree that was visited in the 2-level RCQ. */
TEST(RCQ_cropping, test_cropping) {
TEST(RCQCropping, test_cropping) {
size_t nq = 10, nt = 2000, nb = 1000, d = 32;

using idx_t = faiss::idx_t;
Expand Down Expand Up @@ -74,7 +74,7 @@ TEST(RCQ_cropping, test_cropping) {
}
}

TEST(RCQ_cropping, search_params) {
TEST(RCQCropping, search_params) {
size_t nq = 10, nt = 2000, nb = 1000, d = 32;

using idx_t = faiss::idx_t;
Expand Down
2 changes: 1 addition & 1 deletion tests/test_approx_topk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void test_approx_topk(
}

//
TEST(TEST_APPROX_TOPK, COMMON) {
TEST(testApproxTopk, COMMON) {
constexpr bool verbose = false;

//
Expand Down
8 changes: 4 additions & 4 deletions tests/test_code_distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,18 @@ void test(

constexpr size_t NELEMENTS = 10000;

TEST(TEST_CODE_DISTANCE, SUBQ4_NBITS8) {
TEST(TestCodeDistance, SUBQ4_NBITS8) {
test(256, 4, 8, NELEMENTS);
}

TEST(TEST_CODE_DISTANCE, SUBQ8_NBITS8) {
TEST(TestCodeDistance, SUBQ8_NBITS8) {
test(256, 8, 8, NELEMENTS);
}

TEST(TEST_CODE_DISTANCE, SUBQ16_NBITS8) {
TEST(TestCodeDistance, SUBQ16_NBITS8) {
test(256, 16, 8, NELEMENTS);
}

TEST(TEST_CODE_DISTANCE, SUBQ32_NBITS8) {
TEST(TestCodeDistance, SUBQ32_NBITS8) {
test(256, 32, 8, NELEMENTS);
}
90 changes: 45 additions & 45 deletions tests/test_cppcontrib_sa_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,147 +1034,147 @@ void testMinMaxIndexPQDecoder(
constexpr size_t NSAMPLES = 256;

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D256_IVF256_PQ16) {
TEST(testCppcontribSaDecode, D256_IVF256_PQ16) {
using T = faiss::cppcontrib::Index2LevelDecoder<256, 256, 16>;
testIndex2LevelDecoder<T>(NSAMPLES, 256, "IVF256,PQ16np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D256_IVF256_PQ8) {
TEST(testCppcontribSaDecode, D256_IVF256_PQ8) {
using T = faiss::cppcontrib::Index2LevelDecoder<256, 256, 32>;
testIndex2LevelDecoder<T>(NSAMPLES, 256, "IVF256,PQ8np");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D192_IVF256_PQ24) {
TEST(testCppcontribSaDecode, D192_IVF256_PQ24) {
using T = faiss::cppcontrib::Index2LevelDecoder<192, 192, 8>;
testIndex2LevelDecoder<T>(NSAMPLES, 192, "IVF256,PQ24np");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D192_IVF256_PQ16) {
TEST(testCppcontribSaDecode, D192_IVF256_PQ16) {
using T = faiss::cppcontrib::Index2LevelDecoder<192, 192, 12>;
testIndex2LevelDecoder<T>(NSAMPLES, 192, "IVF256,PQ16np");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D192_IVF256_PQ12) {
TEST(testCppcontribSaDecode, D192_IVF256_PQ12) {
using T = faiss::cppcontrib::Index2LevelDecoder<192, 192, 16>;
testIndex2LevelDecoder<T>(NSAMPLES, 192, "IVF256,PQ12np");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D160_IVF256_PQ40) {
TEST(testCppcontribSaDecode, D160_IVF256_PQ40) {
using T = faiss::cppcontrib::Index2LevelDecoder<160, 160, 4>;
testIndex2LevelDecoder<T>(NSAMPLES, 160, "IVF256,PQ40np");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D160_IVF256_PQ20) {
TEST(testCppcontribSaDecode, D160_IVF256_PQ20) {
using T = faiss::cppcontrib::Index2LevelDecoder<160, 160, 8>;
testIndex2LevelDecoder<T>(NSAMPLES, 160, "IVF256,PQ20np");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D160_IVF256_PQ10) {
TEST(testCppcontribSaDecode, D160_IVF256_PQ10) {
using T = faiss::cppcontrib::Index2LevelDecoder<160, 160, 16>;
testIndex2LevelDecoder<T>(NSAMPLES, 160, "IVF256,PQ10np");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D160_IVF256_PQ8) {
TEST(testCppcontribSaDecode, D160_IVF256_PQ8) {
using T = faiss::cppcontrib::Index2LevelDecoder<160, 160, 20>;
testIndex2LevelDecoder<T>(NSAMPLES, 160, "IVF256,PQ8np");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D128_IVF256_PQ8) {
TEST(testCppcontribSaDecode, D128_IVF256_PQ8) {
using T = faiss::cppcontrib::Index2LevelDecoder<128, 128, 16>;
testIndex2LevelDecoder<T>(NSAMPLES, 128, "IVF256,PQ8np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D128_IVF256_PQ4) {
TEST(testCppcontribSaDecode, D128_IVF256_PQ4) {
using T = faiss::cppcontrib::Index2LevelDecoder<128, 128, 32>;
testIndex2LevelDecoder<T>(NSAMPLES, 128, "IVF256,PQ4np");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D64_IVF256_PQ16) {
TEST(testCppcontribSaDecode, D64_IVF256_PQ16) {
using T = faiss::cppcontrib::Index2LevelDecoder<64, 64, 8>;
testIndex2LevelDecoder<T>(NSAMPLES, 64, "IVF256,PQ8np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D64_IVF256_PQ8) {
TEST(testCppcontribSaDecode, D64_IVF256_PQ8) {
using T = faiss::cppcontrib::Index2LevelDecoder<64, 64, 16>;
testIndex2LevelDecoder<T>(NSAMPLES, 64, "IVF256,PQ4np");
}

#if defined(__AVX2__)
TEST(TEST_CPPCONTRIB_SA_DECODE, D40_IVF256_PQ20) {
TEST(testCppcontribSaDecode, D40_IVF256_PQ20) {
using T = faiss::cppcontrib::Index2LevelDecoder<40, 40, 2>;
testIndex2LevelDecoder<T>(NSAMPLES, 40, "IVF256,PQ20np");
}
#endif

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D256_Residual4x8_PQ16) {
TEST(testCppcontribSaDecode, D256_Residual4x8_PQ16) {
using T = faiss::cppcontrib::Index2LevelDecoder<256, 64, 16>;
testIndex2LevelDecoder<T>(NSAMPLES, 256, "Residual4x8,PQ16");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D256_Residual4x8_PQ8) {
TEST(testCppcontribSaDecode, D256_Residual4x8_PQ8) {
using T = faiss::cppcontrib::Index2LevelDecoder<256, 64, 32>;
testIndex2LevelDecoder<T>(NSAMPLES, 256, "Residual4x8,PQ8");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D160_Residual4x8_PQ10) {
TEST(testCppcontribSaDecode, D160_Residual4x8_PQ10) {
using T = faiss::cppcontrib::Index2LevelDecoder<160, 40, 16>;
testIndex2LevelDecoder<T>(NSAMPLES, 160, "Residual4x8,PQ10");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D160_Residual2x8_PQ10) {
TEST(testCppcontribSaDecode, D160_Residual2x8_PQ10) {
using T = faiss::cppcontrib::Index2LevelDecoder<160, 80, 16>;
testIndex2LevelDecoder<T>(NSAMPLES, 160, "Residual2x8,PQ10");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D160_Residual1x8_PQ10) {
TEST(testCppcontribSaDecode, D160_Residual1x8_PQ10) {
using T = faiss::cppcontrib::Index2LevelDecoder<160, 160, 16>;
testIndex2LevelDecoder<T>(NSAMPLES, 160, "Residual1x8,PQ10");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D128_Residual4x8_PQ8) {
TEST(testCppcontribSaDecode, D128_Residual4x8_PQ8) {
using T = faiss::cppcontrib::Index2LevelDecoder<128, 32, 16>;
testIndex2LevelDecoder<T>(NSAMPLES, 128, "Residual4x8,PQ8");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D128_Residual4x8_PQ4) {
TEST(testCppcontribSaDecode, D128_Residual4x8_PQ4) {
using T = faiss::cppcontrib::Index2LevelDecoder<128, 32, 32>;
testIndex2LevelDecoder<T>(NSAMPLES, 128, "Residual4x8,PQ4");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D64_Residual4x8_PQ8) {
TEST(testCppcontribSaDecode, D64_Residual4x8_PQ8) {
using T = faiss::cppcontrib::Index2LevelDecoder<64, 16, 8>;
testIndex2LevelDecoder<T>(NSAMPLES, 64, "Residual4x8,PQ8");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D64_Residual4x8_PQ4) {
TEST(testCppcontribSaDecode, D64_Residual4x8_PQ4) {
using T = faiss::cppcontrib::Index2LevelDecoder<64, 16, 16>;
testIndex2LevelDecoder<T>(NSAMPLES, 64, "Residual4x8,PQ4");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D256_IVF1024_PQ16) {
TEST(testCppcontribSaDecode, D256_IVF1024_PQ16) {
// It is acceptable to use COARSE_BITS=16 in this case,
// because there's only one coarse quantizer element.
using T = faiss::cppcontrib::Index2LevelDecoder<256, 256, 16, 16>;
testIndex2LevelDecoder<T>(NSAMPLES * 4, 256, "IVF1024,PQ16np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D64_Residual1x9_PQ8) {
TEST(testCppcontribSaDecode, D64_Residual1x9_PQ8) {
// It is acceptable to use COARSE_BITS=16 in this case,
// because there's only one coarse quantizer element.
// It won't work for "Residual2x9,PQ8".
Expand All @@ -1183,122 +1183,122 @@ TEST(TEST_CPPCONTRIB_SA_DECODE, D64_Residual1x9_PQ8) {
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D256_PQ16) {
TEST(testCppcontribSaDecode, D256_PQ16) {
using T = faiss::cppcontrib::IndexPQDecoder<256, 16>;
testIndexPQDecoder<T>(NSAMPLES, 256, "PQ16np");
}

//
TEST(TEST_CPPCONTRIB_SA_DECODE, D160_PQ20) {
TEST(testCppcontribSaDecode, D160_PQ20) {
using T = faiss::cppcontrib::IndexPQDecoder<160, 8>;
testIndexPQDecoder<T>(NSAMPLES, 160, "PQ20np");
}

#if defined(__AVX2__)
TEST(TEST_CPPCONTRIB_SA_DECODE, D40_PQ20) {
TEST(testCppcontribSaDecode, D40_PQ20) {
using T = faiss::cppcontrib::IndexPQDecoder<40, 2>;
testIndexPQDecoder<T>(NSAMPLES, 40, "PQ20np");
}
#endif

// test IndexRowwiseMinMaxFP16
TEST(TEST_CPPCONTRIB_SA_DECODE, D256_MINMAXFP16_IVF256_PQ16) {
TEST(testCppcontribSaDecode, D256_MINMAXFP16_IVF256_PQ16) {
using SubT = faiss::cppcontrib::Index2LevelDecoder<256, 256, 16>;
using T = faiss::cppcontrib::IndexMinMaxFP16Decoder<SubT>;
testMinMaxIndex2LevelDecoder<T>(NSAMPLES, 256, "MinMaxFP16,IVF256,PQ16np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D256_MINMAXFP16_PQ16) {
TEST(testCppcontribSaDecode, D256_MINMAXFP16_PQ16) {
using SubT = faiss::cppcontrib::IndexPQDecoder<256, 16>;
using T = faiss::cppcontrib::IndexMinMaxFP16Decoder<SubT>;
testMinMaxIndexPQDecoder<T>(NSAMPLES, 256, "MinMaxFP16,PQ16np");
}

// test IndexRowwiseMinMax
TEST(TEST_CPPCONTRIB_SA_DECODE, D256_MINMAX_IVF256_PQ16) {
TEST(testCppcontribSaDecode, D256_MINMAX_IVF256_PQ16) {
using SubT = faiss::cppcontrib::Index2LevelDecoder<256, 256, 16>;
using T = faiss::cppcontrib::IndexMinMaxDecoder<SubT>;
testMinMaxIndex2LevelDecoder<T>(NSAMPLES, 256, "MinMax,IVF256,PQ16np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D256_MINMAX_PQ16) {
TEST(testCppcontribSaDecode, D256_MINMAX_PQ16) {
using SubT = faiss::cppcontrib::IndexPQDecoder<256, 16>;
using T = faiss::cppcontrib::IndexMinMaxDecoder<SubT>;
testMinMaxIndexPQDecoder<T>(NSAMPLES, 256, "MinMax,PQ16np");
}

// implemented for AVX2 and ARM so far
#if defined(__AVX2__) || defined(__ARM_NEON)
TEST(TEST_CPPCONTRIB_SA_DECODE, D256_PQ16x10) {
TEST(testCppcontribSaDecode, D256_PQ16x10) {
using T = faiss::cppcontrib::IndexPQDecoder<256, 16, 10>;
testIndexPQDecoder<T>(NSAMPLES * 4, 256, "PQ16x10np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D256_PQ16x12) {
TEST(testCppcontribSaDecode, D256_PQ16x12) {
using T = faiss::cppcontrib::IndexPQDecoder<256, 16, 12>;
testIndexPQDecoder<T>(NSAMPLES * 16, 256, "PQ16x12np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D160_PQ20x10) {
TEST(testCppcontribSaDecode, D160_PQ20x10) {
using T = faiss::cppcontrib::IndexPQDecoder<160, 8, 10>;
testIndexPQDecoder<T>(NSAMPLES * 4, 160, "PQ20x10np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D160_PQ20x12) {
TEST(testCppcontribSaDecode, D160_PQ20x12) {
using T = faiss::cppcontrib::IndexPQDecoder<160, 8, 12>;
testIndexPQDecoder<T>(NSAMPLES * 16, 160, "PQ20x12np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D256_IVF256_PQ16x10) {
TEST(testCppcontribSaDecode, D256_IVF256_PQ16x10) {
using T = faiss::cppcontrib::Index2LevelDecoder<256, 256, 16, 8, 10>;
testIndex2LevelDecoder<T>(NSAMPLES * 4, 256, "IVF256,PQ16x10np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D256_IVF256_PQ16x12) {
TEST(testCppcontribSaDecode, D256_IVF256_PQ16x12) {
using T = faiss::cppcontrib::Index2LevelDecoder<256, 256, 16, 8, 12>;
testIndex2LevelDecoder<T>(NSAMPLES * 16, 256, "IVF256,PQ16x12np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D256_MINMAXFP16_IVF256_PQ16x10) {
TEST(testCppcontribSaDecode, D256_MINMAXFP16_IVF256_PQ16x10) {
using SubT = faiss::cppcontrib::Index2LevelDecoder<256, 256, 16, 8, 10>;
using T = faiss::cppcontrib::IndexMinMaxFP16Decoder<SubT>;
testMinMaxIndex2LevelDecoder<T>(
NSAMPLES * 4, 256, "MinMaxFP16,IVF256,PQ16x10np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D256_MINMAXFP16_IVF1024_PQ16x10) {
TEST(testCppcontribSaDecode, D256_MINMAXFP16_IVF1024_PQ16x10) {
using SubT = faiss::cppcontrib::Index2LevelDecoder<256, 256, 16, 10, 10>;
using T = faiss::cppcontrib::IndexMinMaxFP16Decoder<SubT>;
testMinMaxIndex2LevelDecoder<T>(
NSAMPLES * 4, 256, "MinMaxFP16,IVF1024,PQ16x10np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D256_MINMAXFP16_IVF1024_PQ16x10_ALTERNATIVE) {
TEST(testCppcontribSaDecode, D256_MINMAXFP16_IVF1024_PQ16x10_ALTERNATIVE) {
using SubT = faiss::cppcontrib::Index2LevelDecoder<256, 256, 16, 16, 10>;
using T = faiss::cppcontrib::IndexMinMaxFP16Decoder<SubT>;
testMinMaxIndex2LevelDecoder<T>(
NSAMPLES * 4, 256, "MinMaxFP16,IVF1024,PQ16x10np");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D160_Residual4x8_PQ8x10) {
TEST(testCppcontribSaDecode, D160_Residual4x8_PQ8x10) {
using T = faiss::cppcontrib::Index2LevelDecoder<160, 40, 20, 8, 10>;
testIndex2LevelDecoder<T>(NSAMPLES * 4, 160, "Residual4x8,PQ8x10");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D256_Residual1x9_PQ16x10) {
TEST(testCppcontribSaDecode, D256_Residual1x9_PQ16x10) {
// It is acceptable to use COARSE_BITS=16 in this case,
// because there's only one coarse quantizer element.
// It won't work for "Residual2x9,PQ16x10".
using T = faiss::cppcontrib::Index2LevelDecoder<256, 256, 16, 16, 10>;
testIndex2LevelDecoder<T>(NSAMPLES * 4, 256, "Residual1x9,PQ16x10");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D256_Residual4x10_PQ16x10) {
TEST(testCppcontribSaDecode, D256_Residual4x10_PQ16x10) {
using T = faiss::cppcontrib::Index2LevelDecoder<256, 64, 16, 10, 10>;
testIndex2LevelDecoder<T>(NSAMPLES * 4, 256, "Residual4x10,PQ16x10");
}

TEST(TEST_CPPCONTRIB_SA_DECODE, D256_Residual4x12_PQ16x12) {
TEST(testCppcontribSaDecode, D256_Residual4x12_PQ16x12) {
using T = faiss::cppcontrib::Index2LevelDecoder<256, 64, 16, 12, 12>;
testIndex2LevelDecoder<T>(NSAMPLES * 16, 256, "Residual4x12,PQ16x12");
}
Expand Down
8 changes: 4 additions & 4 deletions tests/test_cppcontrib_uintreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,18 @@ void TestUintReaderBits() {
TestUintReader<17, CODE_BITS>();
}

TEST(TEST_CPPCONTRIB_UINTREADER, Test8bit) {
TEST(testCppcontribUintreader, Test8bit) {
TestUintReaderBits<8>();
}

TEST(TEST_CPPCONTRIB_UINTREADER, Test10bit) {
TEST(testCppcontribUintreader, Test10bit) {
TestUintReaderBits<10>();
}

TEST(TEST_CPPCONTRIB_UINTREADER, Test12bit) {
TEST(testCppcontribUintreader, Test12bit) {
TestUintReaderBits<12>();
}

TEST(TEST_CPPCONTRIB_UINTREADER, Test16bit) {
TEST(testCppcontribUintreader, Test16bit) {
TestUintReaderBits<16>();
}
Loading

0 comments on commit e3deb71

Please sign in to comment.