Skip to content

implemented the changes for P4453 - #349

Merged
dietmarkuehl merged 18 commits into
mainfrom
implement-p4453
Nov 22, 2026
Merged

dietmarkuehl merged 18 commits into
mainfrom
implement-p4453

Conversation

@dietmarkuehl

Copy link
Copy Markdown
Member

No description provided.

@coveralls

coveralls commented Nov 20, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 92.914% (-0.08%) from 92.992% — implement-p4453 into main

@Cra3z

Cra3z commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

TSan isn't aware that the reference counting for std::exception_ptr is atomic. Looks like we should set up TSAN_OPTIONS to suppress these false positives.

@dietmarkuehl

Copy link
Copy Markdown
Member Author

TSan isn't aware that the reference counting for std::exception_ptr is atomic. Looks like we should set up TSAN_OPTIONS to suppress these false positives.

I see that exec-parallel-scheduler.test.cpp uses task<int>: I wonder if that is actually rather a case of the issue which is supposed to be prevented by the new Remarks, i.e., an already destroyed object ends up being used? I didn't change anything with respect to that, yet, i.e., I didn't change task to destroy the held scheduler before completing. I haven't looked at the issue properly, yet.

@Cra3z

Cra3z commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

From the call stack reported by TSan, the problem occurs at

try {
test_std::sync_wait(test_std::schedule(sch) | test_std::then([] { throw 114; }));
} catch (int n) {
ASSERT(n == 114);
}
, which should have nothing to do with this PR. I also encountered this TSan error during CI testing on my previous PR, and sometimes it just passes on retry. This is related to std::exception_ptr being used across threads (one thread catches an exception and gets its exception_ptr using std::current_exception, and then another thread rethrows it with std::rethrow_exception; even if the former is guaranteed to happen before the latter, TSan may still report an error under Clang + libc++, as TSan doesn't know that decrementing the reference count in __cxa_end_catch in libc++abi.so is atomic).
repro: https://godbolt.org/z/rvdqexrr3

@dietmarkuehl
dietmarkuehl marked this pull request as ready for review November 22, 2026 00:06
@dietmarkuehl
dietmarkuehl requested a review from camio as a code owner November 22, 2026 00:06
Copilot AI balanced review requested due to automatic review settings November 22, 2026 00:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are still critical correctness and portability issues—make_sched’s behavior and diagnostic are inconsistent regarding get_scheduler(env), and the scheduler-allocator test has configuration-dependent missing includes plus an incorrect allocator implementation—so the change cannot be safely approved yet.

3 open issues
What changed in this PR

Implements P4453-related updates in beman::execution by adding a get_scheduler_allocator query, wiring it through the public API surface (headers + modules), and updating task scheduler construction/lifetime behavior with accompanying tests and build/CI/docs adjustments.

Changes:

  • Add get_scheduler_allocator CPO (header + module) and re-export it via the main execution interfaces.
  • Update task internals to construct/manage schedulers using the scheduler allocator query and adjust lifetime handling.
  • Add/extend tests (including a dedicated exec-get-scheduler-allocator test) and wire in TSan suppressions; update docs and Doxygen workflow pinning.
File Description
tests/​beman/​execution/​tsan.supp Adds ThreadSanitizer suppressions for known exception/refcount races in underlying runtimes.
tests/​beman/​execution/​exec-task.test.cpp Updates task-related tests to cover scheduler/allocator lifetime behavior and related imports.
tests/​beman/​execution/​exec-get-scheduler-allocator.test.cpp Introduces a new test validating get_scheduler_allocator selection/fallback behavior and related requirements.
tests/​beman/​execution/​CMakeLists.txt Registers the new test and configures TSan runs to use the provided suppressions file via environment options.
src/​beman/​execution/​get_scheduler_allocator.cppm Adds a new module unit exporting the get_scheduler_allocator API.
src/​beman/​execution/​execution.cppm Imports and re-exports get_scheduler_allocator from the main beman.execution module.
src/​beman/​execution/​CMakeLists.txt Updates the build configuration to include the new header/module sources.
include/​beman/​execution/​execution.hpp Exposes get_scheduler_allocator through the public umbrella header (include/import wiring).
include/​beman/​execution/​detail/​task.hpp Adjusts task scheduler construction and lifetime management to use the scheduler allocator query and updated storage paths.
include/​beman/​execution/​detail/​get_scheduler_allocator.hpp Introduces the get_scheduler_allocator customization point with fallback behavior (e.g., to get_allocator).
docs/​overview.md Updates the overview documentation to reflect additional scheduler-related requirements (including forward progress guarantee querying).
.github/​workflows/​doxygen-gh-pages.yml Pins a specific Doxygen version for the GitHub Pages documentation build workflow.

Review effort: Balanced
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

Comment thread include/beman/execution/detail/task.hpp Resolved
Comment thread include/beman/execution/detail/task.hpp Resolved
Comment thread include/beman/execution/detail/task.hpp Resolved
@dietmarkuehl
dietmarkuehl merged commit 2799c6e into main Nov 22, 2026
42 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.

4 participants