Skip to content

Conversation

@copybara-service
Copy link

@copybara-service copybara-service bot commented Jan 7, 2026

Use an unbounded thread pool for StreamExecutor PjRt clients

If tsl::thread::ThreadPool runs out of threads, it runs the callback inline on the thread that called Schedule(). This pattern is known to be prone to deadlocks (e.g., if Schedule is called while holding a mutex that the callable needs to acquire, it will deadlock) and may harm the asynchrony in the tail case, so switching to an unbounded thread pool based on tsl::UnboundedWorkQueue.

Since tsl::thread::ThreadPool is not extensible, this requires replacing the executor type from tsl::thread::ThreadPool to AsyncWorkRunner. The existing thread pool is still kept because ExecutableBuildOptions::set_compile_thread_pool() requires tsl::thread::ThreadPool.

Reverts 485e912

@copybara-service copybara-service bot force-pushed the test_853019406 branch 2 times, most recently from 74513a4 to 7a28b74 Compare January 7, 2026 19:13
If `tsl::thread::ThreadPool` runs out of threads, it runs the callback inline on the thread that called `Schedule()`. This pattern is known to be prone to deadlocks (e.g., if `Schedule` is called while holding a mutex that the callable needs to acquire, it will deadlock) and may harm the asynchrony in the tail case, so switching to an unbounded thread pool based on `tsl::UnboundedWorkQueue`.

Since `tsl::thread::ThreadPool` is not extensible, this requires replacing the executor type from `tsl::thread::ThreadPool` to `AsyncWorkRunner`. The existing thread pool is still kept because `ExecutableBuildOptions::set_compile_thread_pool()` requires `tsl::thread::ThreadPool`.

PiperOrigin-RevId: 853352782
@copybara-service copybara-service bot merged commit f4bab1d into main Jan 7, 2026
@copybara-service copybara-service bot deleted the test_853019406 branch January 7, 2026 19:58
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.

1 participant