Skip to content

PR #38932: [xla:gpu] Add rendezvous before AND after first collective call - #111968

Merged
copybara-service[bot] merged 1 commit into
masterfrom
exported_pr_881031754
Mar 10, 2026
Merged

copybara-service[bot] merged 1 commit into
masterfrom
exported_pr_881031754

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Mar 9, 2026 •

Copy link
Copy Markdown

PR #38932: [xla:gpu] Add rendezvous before AND after first collective call

Imported from GitHub PR openxla/xla#38932

Some times NCCL call can race with a cuBLAS initialization that happens before the collective operation, and this leads to deadlocks inside CUDA driver. The problem is a known bug in CUDA when lazy loading kernels can deadlock in done concurrently with other operations. Adding a rendezvous before and after first call to collective operations guarantees that NCCL and cuBLAS initialization doesn't race during the first call to XLA program. After the first execution all state is correctly initialized and all thunks can be executed concurrently.

Lock Holder — Thread 526 (LWP 223074): deep in libcuda resource management

  #0  libcuda_a39aa780397842086045a7b3bcbbdc8b990f1dc2 ()                   ← STUCK HERE
  #1  libcuda_78bd8cb6e161b9259f49c55b198c2ebb6b6ca573 ()
  #2  libcuda_415ad33a27adbd9e7ac386d1436fb472f9a186a7 ()
  #3  libcuda_6604415c014ac9883d5d8d7bd3eaec3cc6f61dd5 ()
  #4  libcuda_a8b7e1669b1e305583a2c856187aa476dd35a0b6 ()
  #5  libcuda_da6ad49bd9734e0ae200848c0cf7d7cc9853ac2e ()
  #6  libcuda_6c7099fa0c13dab048e8a079f9c9d18af0a9c817 ()
  #7  libcuda_755905f93113a0709483448e98a77986387cc1d2 ()                   ← rwlock acquired here
  #8  libcuda_41c3d2e54bbc2cab9a8c690af0d80fdf54a7bea4 ()
  #9  cuKernelSetAttribute ()
  #10 libcublasLt_4379571754809d5aed869096e4697c8475997ae4 ()
  #11 libcublasLt_461e95d2ff5949df0a29da83ada6c345d9c1ebb0 ()
  #12 libcublasLt_c7ad85ac4de152e94520edbfab34aa5b3ebef088 ()
  #13 libcublasLt_9c76814a7f6623e89ce420723203783b4100e387 ()
  #14 cublasLtTSSMatmul ()
  #15 libcublas_9cdbde38fcd4e96fade46520882865abc4593db8 ()
  #16 libcublas_dcfa9499b939b7c46fe3e9c6c04d82164096c00d ()
  #17 libcublas_cc7e69e32c54abdbb393ffdb179bca77b461347e ()
  #18 libcublas_5c324fb9d1a4eecb9e11bd58d3b1b5be99cdcfd2 ()
  #19 libcublas_c381464be92fab0a975a57336c63cd0671b27bc8 ()
  #20 cublasGemmEx ()
  #21 stream_executor::cuda::CUDABlas::DoBlasGemmWithAlgorithm(...) ()
  #22 xla::gpu::RunGemm(...) ()
  #23 xla::gpu::GemmThunk::ExecuteOnStream(Thunk::ExecuteParams const&) ()
  #24 xla::gpu::SequentialThunk::ExecuteOnStream(...) ()
  #25 xla::gpu::WhileThunk::ExecuteOnStream(...) ()
  #26 xla::gpu::SequentialThunk::ExecuteOnStream(...) ()
  #27 xla::gpu::(anonymous namespace)::ExecuteThunksImpl(...) ()
  #28 xla::gpu::GpuExecutable::ExecuteThunks(...) ()
  #29 xla::StreamExecutorGpuClient::RunAsync(...) ()
  #30 xla::PjRtStreamExecutorRawLoadedExecutable::Execute(...)::$_1::operator()() ()
  #31 xla::PjRtStreamExecutorRawLoadedExecutable::Execute(...) && ()
  #32 xla::CommonPjRtLoadedExecutable::ExecuteLaunch(...) const ()
  #33 absl::internal_any_invocable::RemoteInvoker<..., CommonPjRtLoadedExecutable::Execute(...)::$_3&>(...) ()
  #34 xla::WorkerThread::WorkLoop() ()
  #35 tsl::(anonymous namespace)::PThread::ThreadFn(void*) ()
  #36 start_thread () at pthread_create.c:447
  #37 clone3 () at clone3.S:78

  rwlock Waiters (×7 identical) — all blocked on rwlock 0x2265a900

  #0  __futex_abstimed_wait_common (futex_word=0x2265a90c, expected=3)
  #2  __pthread_rwlock_wrlock_full64 (rwlock=0x2265a900)
  #3  ___pthread_rwlock_wrlock (rwlock=0x2265a900)
  #4  libcuda_755905f93113a0709483448e98a77986387cc1d2 ()
  #5  libcuda_41c3d2e54bbc2cab9a8c690af0d80fdf54a7bea4 ()
  #6  cuKernelSetAttribute ()
  #7-#14 [cublasLt → cublasLtTSSMatmul]
  #15-#20 [cublas → cublasGemmEx]
  #21 stream_executor::cuda::CUDABlas::DoBlasGemmWithAlgorithm(...) ()
  #22 xla::gpu::RunGemm(...) ()
  #23 xla::gpu::GemmThunk::ExecuteOnStream(...) ()
  #24-#37 [SequentialThunk → WhileThunk → ExecuteThunksImpl → GpuExecutable → RunAsync → Execute → WorkLoop]

Copybara import of the project:

--
37a1c5d4123ad8dd337f933692b57374eca71407 by Eugene Zhulenev [email protected]:

[xla:gpu] Add rendezvous before AND after first collective call

Merging this change closes #38932

Reverts changelist 881077358

FUTURE_COPYBARA_INTEGRATE_REVIEW=openxla/xla#38932 from ezhulenev:rendezvous-around-collective-call 37a1c5d4123ad8dd337f933692b57374eca71407

@copybara-service
copybara-service Bot force-pushed the exported_pr_881031754 branch from 7436912 to c3e78d4 Compare March 10, 2026 12:04
Reverts changelist 881077358

PiperOrigin-RevId: 881389959
@copybara-service
copybara-service Bot force-pushed the exported_pr_881031754 branch from c3e78d4 to 6e38277 Compare March 10, 2026 13:32
@copybara-service copybara-service Bot closed this Mar 10, 2026
@copybara-service
copybara-service Bot deleted the exported_pr_881031754 branch March 10, 2026 13:36
@copybara-service
copybara-service Bot merged commit 6e38277 into master Mar 10, 2026
466 of 620 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New TFLiteConverter not working with tf.complex64

1 participant