faiss/gpu/perf: check CUDA return in PerfIVFPQAdd (clang21 nodiscard) (#5368)

Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/5368

Under Clang 21 (and its HIP/hipify path for AMD GPU builds), the AMD GPU build of the FAISS GPU perf benchmark fails `-Werror,-Wunused-value`:

  error: ignoring return value of type 'hipError_t' declared with 'nodiscard' attribute [-Werror,-Wunused-value]

`cudaProfilerStop()` / `cudaDeviceSynchronize()` return `cudaError_t`/`hipError_t`, which is `[[nodiscard]]`; the two bare calls -- at the top of `main()` and just before the timing loop -- silently dropped that. Both are wrapped in `CUDA_VERIFY()`, exactly as the rest of this same file already does, so a real device error surfaces rather than being masked.

Differential Revision: D110259824

fbshipit-source-id: 30e2def26e3c8607ec37decef8b3a91aaf790473
This commit is contained in:
Jim Meyering
2026-07-01 00:02:10 -07:00
committed by meta-codesync[bot]
parent bd6760153c
commit 8d0d1a2b33
+2 -2
View File
@@ -31,7 +31,7 @@ DEFINE_bool(reserve_memory, false, "whether or not to pre-reserve memory");
int main(int argc, char** argv) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
cudaProfilerStop();
CUDA_VERIFY(cudaProfilerStop());
int dim = FLAGS_dim;
int numCentroids = FLAGS_centroids;
@@ -72,7 +72,7 @@ int main(int argc, char** argv) {
}
}
cudaDeviceSynchronize();
CUDA_VERIFY(cudaDeviceSynchronize());
CUDA_VERIFY(cudaProfilerStart());
float totalGpuTime = 0.0f;