mirror of
https://github.com/facebookresearch/faiss.git
synced 2026-10-12 02:13:36 +00:00
fix: initializing order of gpu compile options (#4581)
Summary: # issue I met gpu_compile_options initialization order issue over gcc 8.4.0. Maybe related with LTO bug? # solution make it deterministic, no "crossing fingers" required. 😸 Pull Request resolved: https://github.com/facebookresearch/faiss/pull/4581 Reviewed By: subhadeepkaran Differential Revision: D82647834 Pulled By: pankajsingh88 fbshipit-source-id: ead9515dc6e84987e6c8f5471318a34cc5b81086
This commit is contained in:
committed by
meta-codesync[bot]
parent
f58fd4c8ca
commit
97dc014472
@@ -748,20 +748,19 @@ bool isGpuIndexImplemented(faiss::Index* index) {
|
||||
} // namespace gpu
|
||||
|
||||
// This is the one defined in utils.cpp
|
||||
// Crossing fingers that the InitGpuCompileOptions_instance will
|
||||
// be instanciated after this global variable
|
||||
extern std::string gpu_compile_options;
|
||||
extern std::string& ref_gpu_compile_options();
|
||||
|
||||
struct InitGpuCompileOptions {
|
||||
InitGpuCompileOptions() {
|
||||
gpu_compile_options = "GPU ";
|
||||
ref_gpu_compile_options() = std::string("GPU ") +
|
||||
#ifdef USE_NVIDIA_CUVS
|
||||
gpu_compile_options += "NVIDIA_CUVS ";
|
||||
"NVIDIA_CUVS " +
|
||||
#endif
|
||||
|
||||
#ifdef USE_AMD_ROCM
|
||||
gpu_compile_options += "AMD_ROCM ";
|
||||
"AMD_ROCM " +
|
||||
#endif
|
||||
"";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -102,7 +102,10 @@ int sgemv_(
|
||||
namespace faiss {
|
||||
|
||||
// this will be set at load time from GPU Faiss
|
||||
std::string gpu_compile_options;
|
||||
std::string& ref_gpu_compile_options() {
|
||||
static std::string gpu_compile_options;
|
||||
return gpu_compile_options;
|
||||
}
|
||||
|
||||
std::string get_compile_options() {
|
||||
std::string options;
|
||||
@@ -124,7 +127,7 @@ std::string get_compile_options() {
|
||||
options += "GENERIC ";
|
||||
#endif
|
||||
|
||||
options += gpu_compile_options;
|
||||
options += ref_gpu_compile_options();
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user