From 0fa5b0afcbb8f2318a70fccf209491723df64ff6 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 29 Jun 2026 17:07:36 -0700 Subject: [PATCH] faiss/gpu/perf: check cudaProfilerStop() return (fix clang21 -Wunused-value) (#5362) Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/5362 Under clang21, this fails to compile in the HIP-ified build with -Werror,-Wunused-value: the leading cudaProfilerStop() in PerfClustering.cpp ignores its return value, which clang21 (via HIP's hipProfilerStop -> hipError_t) treats as [[nodiscard]]: PerfClustering.cpp:46:5: error: ignoring return value of type 'hipError_t' declared with 'nodiscard' attribute [-Werror,-Wunused-value] hipProfilerStop(); Wrap it in CUDA_VERIFY(...) so the return code is inspected, exactly like every other CUDA-profiler / sync call in this same file (lines 91, 121, 124). This is the file's own convention; no behavior change for the success path. Differential Revision: D110109331 fbshipit-source-id: eab3962d0dc53046464711b89a18e8dd18691673 --- faiss/gpu/perf/PerfClustering.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faiss/gpu/perf/PerfClustering.cpp b/faiss/gpu/perf/PerfClustering.cpp index 72bc73827..64354244d 100644 --- a/faiss/gpu/perf/PerfClustering.cpp +++ b/faiss/gpu/perf/PerfClustering.cpp @@ -42,7 +42,7 @@ using namespace faiss::gpu; int main(int argc, char** argv) { gflags::ParseCommandLineFlags(&argc, &argv, true); - cudaProfilerStop(); + CUDA_VERIFY(cudaProfilerStop()); auto seed = FLAGS_seed != -1 ? FLAGS_seed : time(nullptr); printf("using seed %ld\n", seed);