From f1d3ad7c38f665da25288a6028d185bd00650cf9 Mon Sep 17 00:00:00 2001 From: cj401-amd Date: Mon, 26 Jan 2026 12:06:21 -0600 Subject: [PATCH 1/3] suppress error (harmless) message related to cuda due to double plugin registration --- xla/service/computation_placer.cc | 7 +++++-- xla/stream_executor/cuda/cuda_blas.cc | 10 ++++++++++ xla/stream_executor/cuda/cuda_dnn.cc | 10 ++++++++++ xla/stream_executor/cuda/cuda_fft.cc | 10 ++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/xla/service/computation_placer.cc b/xla/service/computation_placer.cc index 35d57b425fab6..59506c26e6eb1 100644 --- a/xla/service/computation_placer.cc +++ b/xla/service/computation_placer.cc @@ -181,8 +181,11 @@ void ComputationPlacer::RegisterComputationPlacer( absl::MutexLock lock(placer_mutex); PlacerFactoryMap& placers = GetPlatformComputationPlacers(); if (placers.find(id) != placers.end()) { - LOG(WARNING) << "Computation placer creation function is already " - "registered for this platform"; + // Silently skip re-registration instead of warning - this can happen + // legitimately when multiple libraries are loaded + VLOG(1) << "Computation placer already registered for this platform, " + "skipping"; + return; } placers[id].creation_function = creation_function; } diff --git a/xla/stream_executor/cuda/cuda_blas.cc b/xla/stream_executor/cuda/cuda_blas.cc index cf946b68cae91..10c311e843097 100644 --- a/xla/stream_executor/cuda/cuda_blas.cc +++ b/xla/stream_executor/cuda/cuda_blas.cc @@ -1399,6 +1399,16 @@ absl::Status CUDABlas::GetVersion(std::string *version) { } void initialize_cublas() { + // Check if already registered before attempting - prevents duplicate + // registration error messages (can happen with multiple library loads) + auto already_registered = PluginRegistry::Instance()->HasFactory( + kCudaPlatformId, PluginKind::kBlas); + + if (already_registered) { + // Already registered, skip silently (mimics ROCm behavior) + return; + } + absl::Status status = PluginRegistry::Instance()->RegisterFactory( kCudaPlatformId, "cuBLAS", diff --git a/xla/stream_executor/cuda/cuda_dnn.cc b/xla/stream_executor/cuda/cuda_dnn.cc index 631b8489c22c7..7cc04ecacd11a 100644 --- a/xla/stream_executor/cuda/cuda_dnn.cc +++ b/xla/stream_executor/cuda/cuda_dnn.cc @@ -6947,6 +6947,16 @@ absl::Status CudnnGraph::PopulateOrUpdateRawCommandBuffer( } // namespace gpu void initialize_cudnn() { + // Check if already registered before attempting - prevents duplicate + // registration error messages (can happen with multiple library loads) + auto already_registered = PluginRegistry::Instance()->HasFactory( + cuda::kCudaPlatformId, PluginKind::kDnn); + + if (already_registered) { + // Already registered, skip silently (mimics ROCm behavior) + return; + } + absl::Status status = PluginRegistry::Instance()->RegisterFactory( cuda::kCudaPlatformId, "cuDNN", diff --git a/xla/stream_executor/cuda/cuda_fft.cc b/xla/stream_executor/cuda/cuda_fft.cc index 5500b2c4586cd..54568733d4fe6 100644 --- a/xla/stream_executor/cuda/cuda_fft.cc +++ b/xla/stream_executor/cuda/cuda_fft.cc @@ -460,6 +460,16 @@ STREAM_EXECUTOR_CUDA_DEFINE_FFT(double, Z2Z, D2Z, Z2D) } // namespace gpu void initialize_cufft() { + // Check if already registered before attempting - prevents duplicate + // registration error messages (can happen with multiple library loads) + auto already_registered = PluginRegistry::Instance()->HasFactory( + cuda::kCudaPlatformId, PluginKind::kFft); + + if (already_registered) { + // Already registered, skip silently (mimics ROCm behavior) + return; + } + absl::Status status = PluginRegistry::Instance()->RegisterFactory( cuda::kCudaPlatformId, "cuFFT", From f72ed81cabb74fe95412e92872f0b038539450f2 Mon Sep 17 00:00:00 2001 From: cj401-amd Date: Mon, 26 Jan 2026 13:07:04 -0600 Subject: [PATCH 2/3] restore LOG(WARNING) for ComputationPlacer --- xla/service/computation_placer.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/xla/service/computation_placer.cc b/xla/service/computation_placer.cc index 59506c26e6eb1..95c337bc4b425 100644 --- a/xla/service/computation_placer.cc +++ b/xla/service/computation_placer.cc @@ -181,10 +181,8 @@ void ComputationPlacer::RegisterComputationPlacer( absl::MutexLock lock(placer_mutex); PlacerFactoryMap& placers = GetPlatformComputationPlacers(); if (placers.find(id) != placers.end()) { - // Silently skip re-registration instead of warning - this can happen - // legitimately when multiple libraries are loaded - VLOG(1) << "Computation placer already registered for this platform, " - "skipping"; + LOG(WARNING) << "Computation placer creation function is already " + "registered for this platform"; return; } placers[id].creation_function = creation_function; From be50dc1f9b01ee6ff9141843f000a1e1d838c281 Mon Sep 17 00:00:00 2001 From: cj401-amd Date: Tue, 27 Jan 2026 08:13:57 -0600 Subject: [PATCH 3/3] update to remove the wrong return --- xla/service/computation_placer.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/xla/service/computation_placer.cc b/xla/service/computation_placer.cc index 95c337bc4b425..35d57b425fab6 100644 --- a/xla/service/computation_placer.cc +++ b/xla/service/computation_placer.cc @@ -183,7 +183,6 @@ void ComputationPlacer::RegisterComputationPlacer( if (placers.find(id) != placers.end()) { LOG(WARNING) << "Computation placer creation function is already " "registered for this platform"; - return; } placers[id].creation_function = creation_function; }