Skip to content

Commit eabb08c

Browse files
gyllstromkfacebook-github-bot
authored andcommitted
Fix [[nodiscard]] build errors and BUCK deps across comms, gloo, caffe2 (#494)
Summary: X-link: meta-pytorch/torchcomms#960 X-link: pytorch/pytorch#176671 ROCm 7.0+ HIP headers annotate API functions (hipStreamDestroy, hipMemcpyAsync, hipStreamSynchronize, hipSetDevice, hipGetDevice, hipFree, hipHostUnregister, hipDeviceEnablePeerAccess, cuGetErrorString) with [[nodiscard]]. Combined with -Werror, this causes build failures wherever return values are discarded. Originally discovered building with ROCm 7.2 headers, but confirmed to also affect ROCm 7.0 builds (reported independently by yvliu and hqguo). The [[nodiscard]] attribute is present in both ROCm 7.0 and 7.2 HIP headers — the fix is the same for both versions. Changes: - Add (void) casts to suppress [[nodiscard]] warnings across comms/ (tcp_devmem, ctran, rcclx), gloo/, and caffe2/ (nativert) — 12 C++ files - Fix BUCK dependency issues in comms/tcp_devmem/nccl (replace devmgr-client with common:common) and comms/tcp_devmem/unpack (explicit glog dep path) that surface when building these targets under ROCm constraints The (void) casts are no-ops on CUDA and older ROCm — safe to land regardless of ROCm version. Reviewed By: bbeckca Differential Revision: D93759269
1 parent bcd1672 commit eabb08c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

gloo/cuda_collectives_native.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class CudaLocalNativeReduce : public LocalOp<T> {
8383

8484
// Enable peer access for devA to memory on devB
8585
CUDA_CHECK(cudaSetDevice(devA));
86-
cudaDeviceEnablePeerAccess(devB, 0);
86+
(void)cudaDeviceEnablePeerAccess(devB, 0);
8787

8888
// Use cudaGetLastError so that any error is cleared.
8989
auto err = cudaGetLastError();
@@ -196,7 +196,7 @@ class CudaLocalNativeBroadcast : public LocalOp<T> {
196196

197197
// Enable peer access for devA to memory on devB
198198
CUDA_CHECK(cudaSetDevice(devA));
199-
cudaDeviceEnablePeerAccess(devB, 0);
199+
(void)cudaDeviceEnablePeerAccess(devB, 0);
200200

201201
// Use cudaGetLastError so that any error is cleared.
202202
auto err = cudaGetLastError();

0 commit comments

Comments
 (0)