static_thread_pool hangs when the batch is smaller than the pool size.
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Start in include/exec/static_thread_pool.hpp at schedule_all CPO invoke and its start() entry point. Reproduce the provided schedule_all usage with a ready batch smaller than the pool's available parallelism, then trace whether the loop advances and tasks are enqueued. Done means the small batch no longer hangs and its tasks complete.
Written by the indexing model from the issue text.
Description
problem
in include/exec/static_thread_pool.hpp
schedule_all cpo invoke
void start() & noexcept {
std::size_t size = items_.size();
std::size_t nthreads = this->pool_.static_thread_poolilable_parallelism();
bwos_params params = this->pool_.params();
std::size_t local_size = params.blockSize * params.numBlocks;
std::size_t chunk_size = std::min(size / nthreads, local_size * nthreads);
auto& remote_queue = *this->pool_.get_remote_queue();
auto it = std::ranges::begin(this->range_);
std::size_t i0 = 0;
while (i0 + chunk_size < size) {
for (std::size_t i = i0; i < i0 + chunk_size; ++i) {
items_[i].__construct_from(
stdexec::connect,
set_next(this->rcvr_, item_sender_t{this, it + i}),
next_receiver_t{this});
stdexec::start(items_[i].__get());
}
std::unique_lock lock{this->start_mutex_};
this->pool_.bulk_enqueue(remote_queue, std::move(this->tasks_), this->tasks_size_);
lock.unlock();
i0 += chunk_size;
}
When the ready batch is smaller than the pool size (size < nthreads), size / nthreads becomes 0, so chunk_size is
0 and the loop never advances. That spins forever, no tasks are enqueued.
usage pattern:
std::span<const int> node_indices;
auto task = exec::schedule_all(pool,node_indices) |
exec::transform_each(stdexec::then([](int node_index) noexcept {
})) |
exec::ignore_all_values();
stdexec::start_detached(std::move(task));
- Dominant language
- C++
- Stars
- 2.4k
- Forks
- 270
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 37
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NVIDIA/stdexec
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 66/100
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
infiniflow/infinity#3502 ·