Skip to content

[V4] Explicit scheduling#104

Merged
ConorWilliams merged 68 commits intomodulesfrom
v4-explicit-sched
Apr 30, 2026
Merged

[V4] Explicit scheduling#104
ConorWilliams merged 68 commits intomodulesfrom
v4-explicit-sched

Conversation

@ConorWilliams
Copy link
Copy Markdown
Owner

@ConorWilliams ConorWilliams commented Apr 26, 2026

Summary by CodeRabbit

  • New Features

    • Added context-switching awaitable support for tasks across multiple scheduler pools.
    • Enhanced benchmark suite with pool switching and random pool selection measurements.
  • Bug Fixes

    • Corrected spelling errors in code comments.
  • Tests

    • Added comprehensive explicit scheduling test coverage.
    • Expanded awaitable concept validation tests.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 26, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7e56f764-19da-4306-8640-b3cce4e04aae

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch v4-explicit-sched

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@benchmark/src/libfork/switch_random.cpp`:
- Around line 89-95: The split logic for threads_total uses threads_a and
threads_b but forcibly sets threads_b = 1 when zero, which turns a 1-thread run
into two workers; change the behavior so threads_b is not silently increased:
compute threads_a = (threads_total + 1) / 2 and threads_b = threads_total -
threads_a and if threads_b == 0, leave it zero (or clamp to max(0,...)) and
adjust downstream code that constructs pool_b to skip creating pool_b when
threads_b == 0; update any code that assumes pool_b exists to handle the
zero-worker case (references: variables threads_total, threads_a, threads_b and
the pool creation logic in switch_random.cpp).

In `@test/src/explicit_scheduling.cpp`:
- Around line 757-759: The split currently over-allocates by one because pool_b
is constructed with thr - half + 1; change the construction of TestType pool_b
to use thr - half so the two pools sum to thr (i.e., replace TestType pool_b{thr
- half + 1} with TestType pool_b{thr - half}), keeping the computation of half
(std::size_t const half = thr / 2 + (thr % 2)) and the existing TestType
pool_a{half} unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: de3c1a9b-eed7-4aac-adc4-d4418adab1c1

📥 Commits

Reviewing files that changed from the base of the PR and between 586bd4c and 0e80b01.

📒 Files selected for processing (16)
  • CMakeLists.txt
  • benchmark/src/libfork/CMakeLists.txt
  • benchmark/src/libfork/switch_io_pool.cpp
  • benchmark/src/libfork/switch_random.cpp
  • src/batteries/deque.cxx
  • src/batteries/slab_stack.cxx
  • src/core/awaitables.cxx
  • src/core/concepts/awaitable.cxx
  • src/core/core.cxx
  • src/core/execute.cxx
  • src/core/final_suspend.cxx
  • src/core/handles.cxx
  • src/core/promise.cxx
  • test/src/adaptors.cpp
  • test/src/concepts.cpp
  • test/src/explicit_scheduling.cpp

Comment thread benchmark/src/libfork/switch_random.cpp
Comment thread test/src/explicit_scheduling.cpp
@ConorWilliams ConorWilliams merged commit 4392ccd into modules Apr 30, 2026
7 of 10 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.

1 participant