From d7ad13ae6ef689985cf10c5756cf41bd1cc5ad96 Mon Sep 17 00:00:00 2001 From: Eyal Chocron Date: Tue, 10 Mar 2026 12:25:15 +0200 Subject: [PATCH] Fix build failure with CUDA < 13.0: unused private fields in SymmetricTensor Building with CUDA 12.x and Clang (`-Werror,-Wunused-private-field`) fails with 5 errors in `symmetric_tensor.h`: ``` error: private field 'mcast_handle_' is not used [-Werror,-Wunused-private-field] error: private field 'cu_dev_' is not used [-Werror,-Wunused-private-field] error: private field 'mc_base_ptr_' is not used [-Werror,-Wunused-private-field] error: private field 'exporter_rank_' is not used [-Werror,-Wunused-private-field] error: private field 'peer_fd_' is not used [-Werror,-Wunused-private-field] ``` These five fields are only used inside `#if (CUDA_VERSION >= 13000)` blocks (in the destructor and `setupMulticast`), but they are declared unconditionally. When building with CUDA 12.x, the usage is compiled out but the declarations remain, triggering Clang's `-Wunused-private-field`. `mc_ptr_` and `is_multicast_setup_` are intentionally left outside the guard because they are used unconditionally in `multicastPtr()`. --- csrc/multidevice/symmetric_tensor.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/csrc/multidevice/symmetric_tensor.h b/csrc/multidevice/symmetric_tensor.h index 5608153e0ce..ec07265a802 100644 --- a/csrc/multidevice/symmetric_tensor.h +++ b/csrc/multidevice/symmetric_tensor.h @@ -71,12 +71,14 @@ class SymmetricTensor { size_t requested_size_; mutable bool are_remote_tensors_setup_ = false; bool is_multicast_setup_ = false; + void* mc_ptr_{nullptr}; +#if (CUDA_VERSION >= 13000) CUmemGenericAllocationHandle mcast_handle_{}; CUdevice cu_dev_{}; - void* mc_ptr_{nullptr}; CUdeviceptr mc_base_ptr_{0}; int exporter_rank_{-1}; int peer_fd_{-1}; +#endif bool is_contiguous_view_setup_ = false; at::Tensor contiguous_view_; };