Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions faiss/gpu/impl/IVFInterleaved.cu
Original file line number Diff line number Diff line change
Expand Up @@ -192,24 +192,43 @@ void runIVFInterleavedScan(
// caught for exceptions at a higher level
FAISS_ASSERT(k <= GPU_MAX_SELECTION_K);

const auto ivf_interleaved_call = [&](const auto func) {
func(queries,
listIds,
listData,
listIndices,
indicesOptions,
listLengths,
k,
metric,
useResidual,
residualBase,
scalarQ,
outDistances,
outIndices,
res);
};

if (k == 1) {
IVF_INTERLEAVED_CALL(1);
ivf_interleaved_call(ivfInterleavedScanImpl<IVFINTERLEAVED_1_PARAMS>);
} else if (k <= 32) {
IVF_INTERLEAVED_CALL(32);
ivf_interleaved_call(ivfInterleavedScanImpl<IVFINTERLEAVED_32_PARAMS>);
} else if (k <= 64) {
IVF_INTERLEAVED_CALL(64);
ivf_interleaved_call(ivfInterleavedScanImpl<IVFINTERLEAVED_64_PARAMS>);
} else if (k <= 128) {
IVF_INTERLEAVED_CALL(128);
ivf_interleaved_call(ivfInterleavedScanImpl<IVFINTERLEAVED_128_PARAMS>);
} else if (k <= 256) {
IVF_INTERLEAVED_CALL(256);
ivf_interleaved_call(ivfInterleavedScanImpl<IVFINTERLEAVED_256_PARAMS>);
} else if (k <= 512) {
IVF_INTERLEAVED_CALL(512);
ivf_interleaved_call(ivfInterleavedScanImpl<IVFINTERLEAVED_512_PARAMS>);
} else if (k <= 1024) {
IVF_INTERLEAVED_CALL(1024);
ivf_interleaved_call(
ivfInterleavedScanImpl<IVFINTERLEAVED_1024_PARAMS>);
}
#if GPU_MAX_SELECTION_K >= 2048
else if (k <= 2048) {
IVF_INTERLEAVED_CALL(2048);
ivf_interleaved_call(
ivfInterleavedScanImpl<IVFINTERLEAVED_2048_PARAMS>);
}
#endif
}
Expand Down
215 changes: 12 additions & 203 deletions faiss/gpu/impl/IVFInterleaved.cuh

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion faiss/gpu/impl/scan/IVFInterleaved1.cu
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace faiss {
namespace gpu {

IVF_INTERLEAVED_IMPL(128, 1, 1)
IVF_INTERLEAVED_IMPL(IVFINTERLEAVED_1_PARAMS)

}
} // namespace faiss
2 changes: 1 addition & 1 deletion faiss/gpu/impl/scan/IVFInterleaved1024.cu
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace faiss {
namespace gpu {

IVF_INTERLEAVED_IMPL(128, 1024, 8)
IVF_INTERLEAVED_IMPL(IVFINTERLEAVED_1024_PARAMS)

}
} // namespace faiss
2 changes: 1 addition & 1 deletion faiss/gpu/impl/scan/IVFInterleaved128.cu
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace faiss {
namespace gpu {

IVF_INTERLEAVED_IMPL(128, 128, 3)
IVF_INTERLEAVED_IMPL(IVFINTERLEAVED_128_PARAMS)

}
} // namespace faiss
2 changes: 1 addition & 1 deletion faiss/gpu/impl/scan/IVFInterleaved2048.cu
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace faiss {
namespace gpu {

#if GPU_MAX_SELECTION_K >= 2048
IVF_INTERLEAVED_IMPL(64, 2048, 8)
IVF_INTERLEAVED_IMPL(IVFINTERLEAVED_2048_PARAMS)
#endif

} // namespace gpu
Expand Down
2 changes: 1 addition & 1 deletion faiss/gpu/impl/scan/IVFInterleaved256.cu
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace faiss {
namespace gpu {

IVF_INTERLEAVED_IMPL(128, 256, 4)
IVF_INTERLEAVED_IMPL(IVFINTERLEAVED_256_PARAMS)

}
} // namespace faiss
2 changes: 1 addition & 1 deletion faiss/gpu/impl/scan/IVFInterleaved32.cu
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace faiss {
namespace gpu {

IVF_INTERLEAVED_IMPL(128, 32, 2)
IVF_INTERLEAVED_IMPL(IVFINTERLEAVED_32_PARAMS)

}
} // namespace faiss
2 changes: 1 addition & 1 deletion faiss/gpu/impl/scan/IVFInterleaved512.cu
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace faiss {
namespace gpu {

IVF_INTERLEAVED_IMPL(128, 512, 8)
IVF_INTERLEAVED_IMPL(IVFINTERLEAVED_512_PARAMS)

}
} // namespace faiss
2 changes: 1 addition & 1 deletion faiss/gpu/impl/scan/IVFInterleaved64.cu
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace faiss {
namespace gpu {

IVF_INTERLEAVED_IMPL(128, 64, 3)
IVF_INTERLEAVED_IMPL(IVFINTERLEAVED_64_PARAMS)

}
} // namespace faiss
Loading