From 20852390ab20c169a39c46bc0dc3e3a10b252a75 Mon Sep 17 00:00:00 2001 From: Karl Gyllstrom Date: Wed, 11 Mar 2026 10:38:56 -0700 Subject: [PATCH] Fix [[nodiscard]] cudaDeviceEnablePeerAccess warning in gloo Summary: ROCm 7.0+ HIP headers annotate cudaDeviceEnablePeerAccess with [[nodiscard]]. Add (void) cast to suppress the warning. The cast is a no-op on CUDA and older ROCm. ghstack-source-id: 0 Reviewed By: bbeckca Differential Revision: D96004741 --- gloo/cuda_collectives_native.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gloo/cuda_collectives_native.h b/gloo/cuda_collectives_native.h index e6c45c401..dbc62cb3f 100644 --- a/gloo/cuda_collectives_native.h +++ b/gloo/cuda_collectives_native.h @@ -83,7 +83,7 @@ class CudaLocalNativeReduce : public LocalOp { // Enable peer access for devA to memory on devB CUDA_CHECK(cudaSetDevice(devA)); - cudaDeviceEnablePeerAccess(devB, 0); + (void)cudaDeviceEnablePeerAccess(devB, 0); // Use cudaGetLastError so that any error is cleared. auto err = cudaGetLastError(); @@ -196,7 +196,7 @@ class CudaLocalNativeBroadcast : public LocalOp { // Enable peer access for devA to memory on devB CUDA_CHECK(cudaSetDevice(devA)); - cudaDeviceEnablePeerAccess(devB, 0); + (void)cudaDeviceEnablePeerAccess(devB, 0); // Use cudaGetLastError so that any error is cleared. auto err = cudaGetLastError();