Skip to content

Duplication of the thread queues in the schedulers#7360

Merged
hkaiser merged 4 commits into
masterfrom
fixing_7111
Jul 13, 2026
Merged

Duplication of the thread queues in the schedulers#7360
hkaiser merged 4 commits into
masterfrom
fixing_7111

Conversation

@hkaiser

@hkaiser hkaiser commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Allow to reduce the work-stealing overheads by minimizing cache interference. The idea is to add a 'passive' queue next to each 'active' one. The 'active' queue is used as long as it holds threads to run. As soon as it runs empty the scheduler swaps the queues and continues executing threads from the now 'active' (formerly 'passive') queue. New threads are scheduled on the currently 'passive' queue. Work-stealing happens from the 'passive' queue first and only if that was unsuccessful tries to steal from the 'active' queues (as before).

Fixes #7111

Depends on #7367

As flyby this adds a fix for a significant performance regression and fixes a race in hpx::thread;;join.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f5666f1-5c01-4323-9db9-3493627b49c4

📥 Commits

Reviewing files that changed from the base of the PR and between d2c8e4d and 5c3b655.

📒 Files selected for processing (5)
  • libs/core/async_base/include/hpx/async_base/launch_policy.hpp
  • libs/core/init_runtime_local/src/init_runtime_local.cpp
  • libs/core/resource_partitioner/tests/unit/scheduling_policy_wiring.cpp
  • libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp
  • libs/core/threading_base/tests/unit/thread_exit_callbacks.cpp
🚧 Files skipped from review as they are similar to previous changes (4)
  • libs/core/init_runtime_local/src/init_runtime_local.cpp
  • libs/core/resource_partitioner/tests/unit/scheduling_policy_wiring.cpp
  • libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp
  • libs/core/threading_base/tests/unit/thread_exit_callbacks.cpp

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added local-priority-fifo-double as a scheduling/queuing option and wired it into runtime scheduler selection.
    • Extended --hpx:queuing parsing and scheduler-name mapping/validation, including the new policy.
    • CI and perftests now run with the new queuing setting.
  • Bug Fixes
    • Improved latch notification/wait behavior under contention.
    • Improved thread joining and thread-exit callback execution/wakeup.
    • Enhanced cleanup and error handling on runtime initialization failures.
  • Tests
    • Added/extended unit tests for scheduler wiring and latch/thread-exit/callback behavior, plus the new queue backend.

Walkthrough

Adds the local_priority_fifo_double scheduling policy with a dual-queue lock-free FIFO backend, scheduler integration, queue-transfer changes, tests, and CI configuration. It also updates coroutine exits, latch notification, thread joining, thread exit callbacks, concurrency containers, launch-policy operators, and runtime error cleanup.

Changes

Local-priority-fifo-double scheduler

Layer / File(s) Summary
Dual-queue FIFO backend and queue primitives
libs/core/schedulers/..., libs/core/concurrency/...
Adds active/passive queue behavior, parity switching, steal-aware pops, queue-transfer changes, acquire loads, explicit non-copyability, and updated padding calculations.
Policy contract and scheduler-name mapping
libs/core/resource_partitioner/...
Adds the scheduling policy and conversion helpers, updates scheduler-name handling and validation, and exports partitioner symbols.
Scheduler construction and dispatch
libs/core/threadmanager/..., libs/core/thread_pools/...
Constructs and dispatches the new scheduler variant and switches the scheduled-thread-pool instantiation.
Scheduler coverage and CI configuration
libs/core/command_line_handling_local/..., libs/core/resource_partitioner/tests/..., libs/core/schedulers/tests/..., .github/workflows/*, .jenkins/...
Documents the queueing option, adds backend and policy-wiring tests, extends scheduler coverage, and configures CI and perftests.

Runtime synchronization and lifecycle updates

Layer / File(s) Summary
Coroutine exit handling
libs/core/coroutines/...
Removes the exception pointer parameter from do_return(), stores caught exceptions directly in coroutine state, and const-qualifies invoke_directly() input.
Latch waiting and notification
libs/core/synchronization/...
Adds predicate-based wait loops, stronger atomic ordering, shared waiter notification, const-qualified parameters, and stress tests for notification races and rearming.
Thread exit-callback state and joining
libs/core/threading_base/..., libs/core/threading/...
Adds per-thread callback synchronization and state tracking, changes joining to condition-variable waiting, and adds callback concurrency tests.
Initialization cleanup on errors
libs/core/init_runtime_local/..., libs/full/init_runtime/...
Deletes the resource partitioner in exception and command-line-error handlers before returning failure.
Constexpr launch-policy operators
libs/core/async_base/...
Marks launch-policy compound assignment operators as constexpr without changing their assignment logic.

Estimated code review effort: 5 (Critical) | ~120 minutes

Suggested labels: category: algorithms, category: components

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Several changes touch unrelated areas like coroutines, latch, async_base, deque, and thread_data beyond the scheduler queue work. Split unrelated fixes into separate PRs or explain why each is required for the scheduler-duplication change.
Docstring Coverage ⚠️ Warning Docstring coverage is 39.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main change: duplicating scheduler thread queues.
Description check ✅ Passed The description aligns with the queue-duplication and passive/active stealing changes in the PR.
Linked Issues check ✅ Passed The new double-queue backend, scheduler wiring, and tests implement the #7111 queue-duplication objective.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fixing_7111

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

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
libs/core/command_line_handling_local/src/parse_command_line_local.cpp (1)

561-569: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Missing space in updated help text.

'local-priority-fifo','local-priority-fifo-double' lacks the space after the comma, inconsistent with the rest of the list's formatting ('abp-priority-fifo', 'abp-priority-lifo', ...).

✏️ Proposed fix
-                "'local', 'local-priority-fifo','local-priority-fifo-double', "
+                "'local', 'local-priority-fifo', 'local-priority-fifo-double', "
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/core/command_line_handling_local/src/parse_command_line_local.cpp`
around lines 561 - 569, The help text in parse_command_line_local’s hpx:queuing
option has a formatting inconsistency where the list item for
local-priority-fifo and local-priority-fifo-double is missing a space after the
comma. Update the string in the argument description to match the formatting
used by the other scheduling policy names so the options list reads
consistently.
🧹 Nitpick comments (1)
.github/workflows/linux_debug.yml (1)

39-40: 🩺 Stability & Availability | 🔵 Trivial

Confirm forcing local-priority-fifo-double doesn't reduce default-scheduler coverage in this job.

HPX_WITH_TESTS_COMMAND_LINE=--hpx:queuing=local-priority-fifo-double applies to the entire test/examples run for this workflow, not just the resource-partitioner scheduler tests. If this is the only debug CI job exercising the default queuing policy end-to-end, switching it wholesale to the new experimental scheduler could mask regressions in the default scheduler for this configuration, and could also make this job flaky if the new backend has undiscovered issues. Worth confirming this is intentional (e.g., another job still covers default queuing) rather than an oversight.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/linux_debug.yml around lines 39 - 40, The workflow-wide
HPX_WITH_TESTS_COMMAND_LINE override is forcing local-priority-fifo-double for
every test/example in the debug job, which may reduce default-scheduler
coverage. Update the linux_debug workflow so the experimental scheduler is
applied only to the intended resource-partitioner scheduler tests, or verify
that another job still covers the default queuing path end-to-end; use the
workflow step setting HPX_WITH_TESTS_COMMAND_LINE as the place to narrow or
split the command.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner_fwd.hpp`:
- Around line 98-107: The public scheduler policy enum in
resource_partitioner::partitioner_fwd must keep existing numeric values stable;
the new local_priority_fifo_double entry should not shift any existing policies.
Update the enum definition so local_priority_fifo_double uses the next unused
value while leaving local_priority_lifo, static_, static_priority,
abp_priority_fifo, abp_priority_lifo, shared_priority,
local_workrequesting_fifo, local_workrequesting_lifo, and
local_workrequesting_mc unchanged.

---

Outside diff comments:
In `@libs/core/command_line_handling_local/src/parse_command_line_local.cpp`:
- Around line 561-569: The help text in parse_command_line_local’s hpx:queuing
option has a formatting inconsistency where the list item for
local-priority-fifo and local-priority-fifo-double is missing a space after the
comma. Update the string in the argument description to match the formatting
used by the other scheduling policy names so the options list reads
consistently.

---

Nitpick comments:
In @.github/workflows/linux_debug.yml:
- Around line 39-40: The workflow-wide HPX_WITH_TESTS_COMMAND_LINE override is
forcing local-priority-fifo-double for every test/example in the debug job,
which may reduce default-scheduler coverage. Update the linux_debug workflow so
the experimental scheduler is applied only to the intended resource-partitioner
scheduler tests, or verify that another job still covers the default queuing
path end-to-end; use the workflow step setting HPX_WITH_TESTS_COMMAND_LINE as
the place to narrow or split the command.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 19482f86-b100-4ab9-be3b-c19995304b75

📥 Commits

Reviewing files that changed from the base of the PR and between e2ac8af and 4f410e8.

📒 Files selected for processing (20)
  • .github/workflows/linux_debug.yml
  • .github/workflows/macos_debug.yml
  • .github/workflows/windows_release_2022.yml
  • .jenkins/lsu-perftests/launch_perftests.sh
  • libs/core/command_line_handling_local/src/parse_command_line_local.cpp
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner_fwd.hpp
  • libs/core/resource_partitioner/src/detail_partitioner.cpp
  • libs/core/resource_partitioner/tests/unit/cross_pool_injection.cpp
  • libs/core/resource_partitioner/tests/unit/shutdown_suspended_pus.cpp
  • libs/core/resource_partitioner/tests/unit/suspend_pool.cpp
  • libs/core/resource_partitioner/tests/unit/suspend_pool_external.cpp
  • libs/core/resource_partitioner/tests/unit/suspend_runtime.cpp
  • libs/core/resource_partitioner/tests/unit/suspend_thread.cpp
  • libs/core/resource_partitioner/tests/unit/suspend_thread_external.cpp
  • libs/core/resource_partitioner/tests/unit/suspend_thread_timed.cpp
  • libs/core/schedulers/include/hpx/schedulers/lockfree_queue_backends.hpp
  • libs/core/schedulers/include/hpx/schedulers/thread_queue.hpp
  • libs/core/thread_pools/src/scheduled_thread_pool.cpp
  • libs/core/threadmanager/include/hpx/threadmanager/threadmanager.hpp
  • libs/core/threadmanager/src/threadmanager.cpp

@StellarBot

Copy link
Copy Markdown
Collaborator
Performance test report

HPX Performance

Comparison

BENCHMARKFORK_JOIN_EXECUTORPARALLEL_EXECUTORSCHEDULER_EXECUTOR
For Each(=)(=)(=)

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T14:08:29+00:002026-07-08T19:32:56+00:00
HPX Commit0eeca86df3552e
Envfile
Clusternamerostamrostam
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Datetime2026-03-09T09:15:24.034803-05:002026-07-08T19:49:46.772973-05:00

Comparison

BENCHMARKNO-EXECUTOR
Future Overhead - Create Thread Hierarchical - Latch++

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T14:08:29+00:002026-07-08T19:32:56+00:00
HPX Commit0eeca86df3552e
Envfile
Clusternamerostamrostam
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Datetime2026-03-09T09:17:15.638328-05:002026-07-08T19:51:50.884984-05:00

Comparison

BENCHMARKFORK_JOIN_EXECUTOR_DEFAULT_FORK_JOIN_POLICY_ALLOCATORPARALLEL_EXECUTOR_DEFAULT_PARALLEL_POLICY_ALLOCATORSCHEDULER_EXECUTOR_DEFAULT_SCHEDULER_EXECUTOR_ALLOCATOR
Stream Benchmark - Add=(=)--
Stream Benchmark - Scale(=)---
Stream Benchmark - Triad(=)---
Stream Benchmark - Copy(=)++++

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T18:50:37+00:002026-07-08T19:32:56+00:00
HPX Commitba89f5ddf3552e
Envfile
Clusternamerostamrostam
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Datetime2026-03-09T17:49:10.837937-05:002026-07-08T19:52:36.154740-05:00

Explanation of Symbols

SymbolMEANING
=No performance change (confidence interval within ±1%)
(=)Probably no performance change (confidence interval within ±2%)
(+)/(-)Very small performance improvement/degradation (≤1%)
+/-Small performance improvement/degradation (≤5%)
++/--Large performance improvement/degradation (≤10%)
+++/---Very large performance improvement/degradation (>10%)
?Probably no change, but quite large uncertainty (confidence interval with ±5%)
??Unclear result, very large uncertainty (±10%)
???Something unexpected…

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
libs/core/threading_base/src/thread_data.cpp (1)

135-154: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Preserve ran_exit_funcs_ on the empty fast path

run_thread_exit_callbacks() now returns before setting ran_exit_funcs_ = true when there are no exit callbacks. That re-opens the window for a concurrent add_thread_exit_callback() to succeed while the thread is still active, and the callback can then be dropped; free_thread_exit_callbacks() will also trip HPX_ASSERT(exit_funcs_.empty() || ran_exit_funcs_) in debug. Keep the guard set on the empty path, or move the fast-path check after locking.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/core/threading_base/src/thread_data.cpp` around lines 135 - 154, Update
thread_data::run_thread_exit_callbacks() so ran_exit_funcs_ is set to true even
when exit_funcs_ is empty; either assign it before returning from the fast path
or acquire the spinlock before checking. Preserve the synchronization semantics
so add_thread_exit_callback() cannot enqueue callbacks after exit processing has
completed, and free_thread_exit_callbacks() remains assertion-safe.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@libs/core/threading_base/src/thread_data.cpp`:
- Around line 135-154: Update thread_data::run_thread_exit_callbacks() so
ran_exit_funcs_ is set to true even when exit_funcs_ is empty; either assign it
before returning from the fast path or acquire the spinlock before checking.
Preserve the synchronization semantics so add_thread_exit_callback() cannot
enqueue callbacks after exit processing has completed, and
free_thread_exit_callbacks() remains assertion-safe.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 112f37af-2cd9-4b04-bc95-fd9cc63cf6f7

📥 Commits

Reviewing files that changed from the base of the PR and between 29b4f12 and 83e1ed7.

📒 Files selected for processing (5)
  • libs/core/coroutines/include/hpx/coroutines/detail/context_base.hpp
  • libs/core/coroutines/src/detail/coroutine_impl.cpp
  • libs/core/synchronization/include/hpx/synchronization/latch.hpp
  • libs/core/threading_base/include/hpx/threading_base/thread_data.hpp
  • libs/core/threading_base/src/thread_data.cpp

@hkaiser
hkaiser force-pushed the fixing_7111 branch 2 times, most recently from 4eb6655 to 3cd437a Compare July 10, 2026 13:21

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@libs/core/threading_base/src/thread_data.cpp`:
- Around line 146-156: Update the exit-callback draining path in the relevant
thread-data cleanup function to set ran_exit_funcs_ = true after callbacks are
drained, matching the early-return path. Ensure the flag is set before releasing
or exiting the drain logic so add_thread_exit_callback() and
free_thread_exit_callbacks() observe the correct state.
- Around line 137-144: Update the exit-callback handling around the early
`has_exit_funcs_` check so it acquires `spinlock_pool::spinlock_for(this)`
before checking the flag and setting `ran_exit_funcs_`. Keep the check and state
update within the same critical section used by `add_thread_exit_callback()`,
avoiding any unlocked early return.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2604af2f-f03c-4f2b-b7f3-90e6d0f7b838

📥 Commits

Reviewing files that changed from the base of the PR and between 83e1ed7 and 4eb6655.

📒 Files selected for processing (6)
  • libs/core/coroutines/include/hpx/coroutines/detail/context_base.hpp
  • libs/core/coroutines/src/detail/coroutine_impl.cpp
  • libs/core/schedulers/include/hpx/schedulers/lockfree_queue_backends.hpp
  • libs/core/synchronization/include/hpx/synchronization/latch.hpp
  • libs/core/threading_base/include/hpx/threading_base/thread_data.hpp
  • libs/core/threading_base/src/thread_data.cpp
🚧 Files skipped from review as they are similar to previous changes (5)
  • libs/core/threading_base/include/hpx/threading_base/thread_data.hpp
  • libs/core/coroutines/include/hpx/coroutines/detail/context_base.hpp
  • libs/core/schedulers/include/hpx/schedulers/lockfree_queue_backends.hpp
  • libs/core/coroutines/src/detail/coroutine_impl.cpp
  • libs/core/synchronization/include/hpx/synchronization/latch.hpp

Comment thread libs/core/threading_base/src/thread_data.cpp Outdated
Comment thread libs/core/threading_base/src/thread_data.cpp
@hkaiser
hkaiser force-pushed the fixing_7111 branch 2 times, most recently from 852d3f6 to 079e469 Compare July 10, 2026 13:40
@StellarBot

Copy link
Copy Markdown
Collaborator
Performance test report

HPX Performance

Comparison

BENCHMARKFORK_JOIN_EXECUTORPARALLEL_EXECUTORSCHEDULER_EXECUTOR
For Each(=)(=)(=)

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T14:08:29+00:002026-07-10T13:40:03+00:00
HPX Commit0eeca864283b63
Datetime2026-03-09T09:15:24.034803-05:002026-07-10T08:53:28.357341-05:00
Envfile
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Clusternamerostamrostam

Comparison

BENCHMARKNO-EXECUTOR
Future Overhead - Create Thread Hierarchical - Latch+++

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T14:08:29+00:002026-07-10T13:40:03+00:00
HPX Commit0eeca864283b63
Datetime2026-03-09T09:17:15.638328-05:002026-07-10T08:55:23.025695-05:00
Envfile
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Clusternamerostamrostam

Comparison

BENCHMARKFORK_JOIN_EXECUTOR_DEFAULT_FORK_JOIN_POLICY_ALLOCATORPARALLEL_EXECUTOR_DEFAULT_PARALLEL_POLICY_ALLOCATORSCHEDULER_EXECUTOR_DEFAULT_SCHEDULER_EXECUTOR_ALLOCATOR
Stream Benchmark - Add=(=)--
Stream Benchmark - Scale(=)---
Stream Benchmark - Triad(=)----
Stream Benchmark - Copy(=)+++++

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T18:50:37+00:002026-07-10T13:40:03+00:00
HPX Commitba89f5d4283b63
Datetime2026-03-09T17:49:10.837937-05:002026-07-10T08:56:08.676571-05:00
Envfile
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Clusternamerostamrostam

Explanation of Symbols

SymbolMEANING
=No performance change (confidence interval within ±1%)
(=)Probably no performance change (confidence interval within ±2%)
(+)/(-)Very small performance improvement/degradation (≤1%)
+/-Small performance improvement/degradation (≤5%)
++/--Large performance improvement/degradation (≤10%)
+++/---Very large performance improvement/degradation (>10%)
?Probably no change, but quite large uncertainty (confidence interval with ±5%)
??Unclear result, very large uncertainty (±10%)
???Something unexpected…

hkaiser added 2 commits July 12, 2026 11:08
- Allow to reduce the work-stealing overheads by minimizing cache interference.
  The idea is to add a 'passive' queue next to each 'active' one. The 'active' queue
  is used as long as it holds threads to run. As soon as it runs empty the scheduler
  swaps the queues and continues executing threads from the now 'active' (formerly
  'passive') queue. New threads are scheduled on the currently 'passive' queue.
  Work-stealing happens from the 'passive' queue first and only if that was unsuccessful
  tries to steal from the 'active' queues (as before).

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
- flyby: working around clang-format problem

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@libs/core/resource_partitioner/src/detail_partitioner.cpp`:
- Around line 80-133: Update get_scheduling_policy to detect an empty or null
scheduler_name before any prefix matching and return
scheduling_policy::unspecified. Preserve the existing prefix-based policy
selection for non-empty names so setup_schedulers() can handle missing
hpx.scheduler entries through its command_line_error path.

In `@libs/core/threading/src/thread.cpp`:
- Around line 210-228: Update the join state in the callback/wait path around
add_thread_exit_callback and detach_locked so cv and done have shared ownership
rather than stack lifetime. Store both in a shared state object captured by the
exit callback and retained by the waiter through completion, then use that
shared state for notification and waiting while preserving the existing
added-condition behavior.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: afe45c74-d906-42a3-90ae-1391bbe91711

📥 Commits

Reviewing files that changed from the base of the PR and between 079e469 and 769b5cf.

📒 Files selected for processing (39)
  • .github/workflows/linux_debug.yml
  • .github/workflows/macos_debug.yml
  • .github/workflows/windows_release_2022.yml
  • .jenkins/lsu-perftests/launch_perftests.sh
  • libs/core/command_line_handling_local/src/parse_command_line_local.cpp
  • libs/core/concurrency/include/hpx/concurrency/deque.hpp
  • libs/core/concurrency/include/hpx/concurrency/queue.hpp
  • libs/core/coroutines/include/hpx/coroutines/detail/context_base.hpp
  • libs/core/coroutines/src/detail/coroutine_impl.cpp
  • libs/core/init_runtime_local/src/init_runtime_local.cpp
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner.hpp
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner_fwd.hpp
  • libs/core/resource_partitioner/src/detail_partitioner.cpp
  • libs/core/resource_partitioner/tests/unit/CMakeLists.txt
  • libs/core/resource_partitioner/tests/unit/cross_pool_injection.cpp
  • libs/core/resource_partitioner/tests/unit/scheduling_policy_wiring.cpp
  • libs/core/resource_partitioner/tests/unit/shutdown_suspended_pus.cpp
  • libs/core/resource_partitioner/tests/unit/suspend_pool.cpp
  • libs/core/resource_partitioner/tests/unit/suspend_pool_external.cpp
  • libs/core/resource_partitioner/tests/unit/suspend_runtime.cpp
  • libs/core/resource_partitioner/tests/unit/suspend_thread.cpp
  • libs/core/resource_partitioner/tests/unit/suspend_thread_external.cpp
  • libs/core/resource_partitioner/tests/unit/suspend_thread_timed.cpp
  • libs/core/schedulers/include/hpx/schedulers/lockfree_queue_backends.hpp
  • libs/core/schedulers/include/hpx/schedulers/thread_queue.hpp
  • libs/core/schedulers/tests/unit/CMakeLists.txt
  • libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp
  • libs/core/synchronization/include/hpx/synchronization/latch.hpp
  • libs/core/synchronization/tests/unit/CMakeLists.txt
  • libs/core/synchronization/tests/unit/latch_notification.cpp
  • libs/core/thread_pools/src/scheduled_thread_pool.cpp
  • libs/core/threading/src/thread.cpp
  • libs/core/threading_base/include/hpx/threading_base/thread_data.hpp
  • libs/core/threading_base/src/thread_data.cpp
  • libs/core/threading_base/tests/unit/CMakeLists.txt
  • libs/core/threading_base/tests/unit/thread_exit_callbacks.cpp
  • libs/core/threadmanager/include/hpx/threadmanager/threadmanager.hpp
  • libs/core/threadmanager/src/threadmanager.cpp
  • libs/full/init_runtime/src/hpx_init.cpp
🚧 Files skipped from review as they are similar to previous changes (21)
  • libs/core/resource_partitioner/tests/unit/suspend_thread_timed.cpp
  • .jenkins/lsu-perftests/launch_perftests.sh
  • libs/core/resource_partitioner/tests/unit/suspend_pool.cpp
  • .github/workflows/linux_debug.yml
  • libs/core/command_line_handling_local/src/parse_command_line_local.cpp
  • .github/workflows/macos_debug.yml
  • .github/workflows/windows_release_2022.yml
  • libs/core/resource_partitioner/tests/unit/cross_pool_injection.cpp
  • libs/core/thread_pools/src/scheduled_thread_pool.cpp
  • libs/core/resource_partitioner/tests/unit/shutdown_suspended_pus.cpp
  • libs/core/resource_partitioner/tests/unit/suspend_pool_external.cpp
  • libs/core/threadmanager/include/hpx/threadmanager/threadmanager.hpp
  • libs/core/threading_base/include/hpx/threading_base/thread_data.hpp
  • libs/core/coroutines/include/hpx/coroutines/detail/context_base.hpp
  • libs/core/concurrency/include/hpx/concurrency/queue.hpp
  • libs/core/threadmanager/src/threadmanager.cpp
  • libs/core/concurrency/include/hpx/concurrency/deque.hpp
  • libs/core/threading_base/src/thread_data.cpp
  • libs/core/coroutines/src/detail/coroutine_impl.cpp
  • libs/core/synchronization/include/hpx/synchronization/latch.hpp
  • libs/core/schedulers/include/hpx/schedulers/lockfree_queue_backends.hpp

Comment thread libs/core/resource_partitioner/src/detail_partitioner.cpp
Comment thread libs/core/threading/src/thread.cpp Outdated
@hkaiser
hkaiser force-pushed the fixing_7111 branch 3 times, most recently from e2590b9 to aa7b7c5 Compare July 12, 2026 21:52

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🧹 Nitpick comments (2)
libs/core/threading_base/include/hpx/threading_base/thread_data.hpp (1)

597-604: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Two coexisting per-object lock mechanisms.

mtx_ now guards exit_funcs_/description_, while interrupt(), backtrace_, and get_backtrace/set_backtrace still use the separate spinlock_pool::spinlock_for(this) hash-based lock (Lines 378-469, unchanged). Consider consolidating onto mtx_ for consistency and to avoid maintaining two locking schemes on the same object, unless the split is intentional (e.g., to avoid contention between hot exit-callback paths and rarely-used backtrace/interrupt paths).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/core/threading_base/include/hpx/threading_base/thread_data.hpp` around
lines 597 - 604, Consolidate the per-object locking in thread_data around the
existing mtx_ member: update interrupt(), backtrace access, and
get_backtrace/set_backtrace to use mtx_ instead of
spinlock_pool::spinlock_for(this), while preserving their current
synchronization behavior. Remove the now-unneeded hash-based lock usage for this
object and retain mtx_ as the single lock guarding all affected state.
libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp (1)

218-289: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Unbounded spin-wait risks a hang instead of a clear test failure.

The stealer (Lines 247-268) and owner (Lines 271-289) loops spin on yield() forever until producers_done && backend.empty(). If a regression in the backend under test causes an item to be lost (never observable via pop), these loops spin forever and the test hangs rather than failing with a diagnostic message — relying solely on an external CTest timeout to eventually kill it.

Consider bounding the spin with an iteration/time cap and asserting failure explicitly so a regression produces a fast, informative failure instead of a hang.

♻️ Example: bound the spin with a retry cap
         consumers.emplace_back([&backend, &producers_done, &collected, s]() {
             std::uint64_t val = 0;
+            std::uint64_t idle_spins = 0;
+            constexpr std::uint64_t max_idle_spins = 10'000'000;
             while (true)
             {
                 if (backend.pop(val, /*steal=*/true))
                 {
                     collected[s].push_back(val);
+                    idle_spins = 0;
                 }
                 else if (producers_done.load(std::memory_order_acquire) &&
                     backend.empty())
                 {
                     break;
                 }
                 else
                 {
+                    HPX_TEST(++idle_spins < max_idle_spins);
+                    if (idle_spins >= max_idle_spins)
+                        break;
                     std::this_thread::yield();
                 }
             }
         });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp` around
lines 218 - 289, Bound the retry loops in test_concurrent_stress for both the
stealer and owner consumers so they cannot spin indefinitely when items are
lost. Track failed pop attempts or elapsed time, and assert a clear test failure
with diagnostic context once the cap is exceeded, while preserving the existing
producers_done && backend.empty() termination path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@libs/core/threading_base/src/thread_data.cpp`:
- Around line 313-324: Update thread_data::get_lco_description and
thread_data::set_lco_description to acquire mtx_ before reading or swapping
lco_description_, matching the locking used for description_. Preserve the
existing return values and swap behavior while ensuring concurrent access is
synchronized.
- Around line 138-155: Update thread_data::run_thread_exit_callbacks to
move/remove the current front callback from exit_funcs_ while mtx_ is held,
before releasing the lock to invoke it. Then execute the moved callback outside
the lock, ensuring callbacks added during f() remain queued and the executed
callback is not popped afterward.

---

Nitpick comments:
In `@libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp`:
- Around line 218-289: Bound the retry loops in test_concurrent_stress for both
the stealer and owner consumers so they cannot spin indefinitely when items are
lost. Track failed pop attempts or elapsed time, and assert a clear test failure
with diagnostic context once the cap is exceeded, while preserving the existing
producers_done && backend.empty() termination path.

In `@libs/core/threading_base/include/hpx/threading_base/thread_data.hpp`:
- Around line 597-604: Consolidate the per-object locking in thread_data around
the existing mtx_ member: update interrupt(), backtrace access, and
get_backtrace/set_backtrace to use mtx_ instead of
spinlock_pool::spinlock_for(this), while preserving their current
synchronization behavior. Remove the now-unneeded hash-based lock usage for this
object and retain mtx_ as the single lock guarding all affected state.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0fe9c6e8-8abf-466b-a141-aecea0ecd500

📥 Commits

Reviewing files that changed from the base of the PR and between e2590b9 and aa7b7c5.

📒 Files selected for processing (16)
  • libs/core/init_runtime_local/src/init_runtime_local.cpp
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner.hpp
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner_fwd.hpp
  • libs/core/resource_partitioner/src/detail_partitioner.cpp
  • libs/core/resource_partitioner/tests/unit/CMakeLists.txt
  • libs/core/resource_partitioner/tests/unit/scheduling_policy_wiring.cpp
  • libs/core/schedulers/tests/unit/CMakeLists.txt
  • libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp
  • libs/core/synchronization/tests/unit/CMakeLists.txt
  • libs/core/synchronization/tests/unit/latch_notification.cpp
  • libs/core/threading/src/thread.cpp
  • libs/core/threading_base/include/hpx/threading_base/thread_data.hpp
  • libs/core/threading_base/src/thread_data.cpp
  • libs/core/threading_base/tests/unit/CMakeLists.txt
  • libs/core/threading_base/tests/unit/thread_exit_callbacks.cpp
  • libs/full/init_runtime/src/hpx_init.cpp
🚧 Files skipped from review as they are similar to previous changes (13)
  • libs/core/schedulers/tests/unit/CMakeLists.txt
  • libs/core/threading_base/tests/unit/CMakeLists.txt
  • libs/core/synchronization/tests/unit/CMakeLists.txt
  • libs/core/resource_partitioner/tests/unit/CMakeLists.txt
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner.hpp
  • libs/core/init_runtime_local/src/init_runtime_local.cpp
  • libs/core/resource_partitioner/tests/unit/scheduling_policy_wiring.cpp
  • libs/core/threading_base/tests/unit/thread_exit_callbacks.cpp
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner_fwd.hpp
  • libs/core/threading/src/thread.cpp
  • libs/full/init_runtime/src/hpx_init.cpp
  • libs/core/resource_partitioner/src/detail_partitioner.cpp
  • libs/core/synchronization/tests/unit/latch_notification.cpp

Comment thread libs/core/threading_base/src/thread_data.cpp
Comment thread libs/core/threading_base/src/thread_data.cpp
@StellarBot

Copy link
Copy Markdown
Collaborator
Performance test report

HPX Performance

Comparison

BENCHMARKFORK_JOIN_EXECUTORPARALLEL_EXECUTORSCHEDULER_EXECUTOR
For Each(=)(=)(=)

Info

PropertyBeforeAfter
HPX Commit0eeca86aec19d6
HPX Datetime2026-03-09T14:08:29+00:002026-07-12T21:52:38+00:00
Clusternamerostamrostam
Envfile
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Datetime2026-03-09T09:15:24.034803-05:002026-07-12T19:09:55.617964-05:00
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu

Comparison

BENCHMARKNO-EXECUTOR
Future Overhead - Create Thread Hierarchical - Latch+++

Info

PropertyBeforeAfter
HPX Commit0eeca86aec19d6
HPX Datetime2026-03-09T14:08:29+00:002026-07-12T21:52:38+00:00
Clusternamerostamrostam
Envfile
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Datetime2026-03-09T09:17:15.638328-05:002026-07-12T19:11:53.154406-05:00
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu

Comparison

BENCHMARKFORK_JOIN_EXECUTOR_DEFAULT_FORK_JOIN_POLICY_ALLOCATORPARALLEL_EXECUTOR_DEFAULT_PARALLEL_POLICY_ALLOCATORSCHEDULER_EXECUTOR_DEFAULT_SCHEDULER_EXECUTOR_ALLOCATOR
Stream Benchmark - Add=(=)--
Stream Benchmark - Scale(=)---
Stream Benchmark - Triad(=)----
Stream Benchmark - Copy(=)++++++

Info

PropertyBeforeAfter
HPX Commitba89f5daec19d6
HPX Datetime2026-03-09T18:50:37+00:002026-07-12T21:52:38+00:00
Clusternamerostamrostam
Envfile
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Datetime2026-03-09T17:49:10.837937-05:002026-07-12T19:12:38.372233-05:00
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu

Explanation of Symbols

SymbolMEANING
=No performance change (confidence interval within ±1%)
(=)Probably no performance change (confidence interval within ±2%)
(+)/(-)Very small performance improvement/degradation (≤1%)
+/-Small performance improvement/degradation (≤5%)
++/--Large performance improvement/degradation (≤10%)
+++/---Very large performance improvement/degradation (>10%)
?Probably no change, but quite large uncertainty (confidence interval with ±5%)
??Unclear result, very large uncertainty (±10%)
???Something unexpected…

- flyby: fix command line handling of --hpx:queuing option
- flyby: fixing races during hpx::thread::join

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
libs/core/init_runtime_local/src/init_runtime_local.cpp (1)

503-506: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Cleanup call is correct; message prefix now inconsistent with a sibling message.

delete_partitioner() before reporting is a good fix and safe even if the partitioner was never constructed. Separately, the prefix was corrected here from hpx::init: to hpx::local::init:, but ensure_no_runtime_is_up() (Line 421-423, unchanged) still emits "hpx::init: can't initialize runtime system...", so the two error paths in this same file/namespace now disagree on the prefix.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/core/init_runtime_local/src/init_runtime_local.cpp` around lines 503 -
506, Align the error prefix in ensure_no_runtime_is_up() with the local
initialization path by changing its hpx::init prefix to hpx::local::init:. Keep
the existing message text and cleanup behavior unchanged.
libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp (1)

254-327: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider extracting the shared stealer/owner consumer loop.

The stealer-thread lambda and the owner-thread lambda are nearly identical (poll/steal-vs-not, stall-timeout check, break condition), differing only in the steal flag, the collected index, and the failure message. Factoring the common loop into a helper taking bool steal and a collected index would remove ~35 lines of duplication.

♻️ Sketch of a shared helper
+auto make_consumer = [&backend, &producers_done, &collected, stress_stall_timeout](
+                          std::size_t idx, bool steal) {
+    return [&backend, &producers_done, &collected, idx, steal, stress_stall_timeout]() {
+        std::uint64_t val = 0;
+        auto last_progress = std::chrono::steady_clock::now();
+        while (true)
+        {
+            if (backend.pop(val, steal))
+            {
+                collected[idx].push_back(val);
+                last_progress = std::chrono::steady_clock::now();
+            }
+            else if (producers_done.load(std::memory_order_acquire) &&
+                backend.empty())
+            {
+                break;
+            }
+            else
+            {
+                if (std::chrono::steady_clock::now() - last_progress >
+                    stress_stall_timeout)
+                {
+                    HPX_TEST_MSG(false,
+                        (steal ? "stealer" : "owner") +
+                        std::string(" thread stalled: no progress for 30s"));
+                    return;
+                }
+                std::this_thread::yield();
+            }
+        }
+    };
+};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp` around
lines 254 - 327, Extract the duplicated consumer polling logic from the stealer
and owner lambdas into a shared helper that accepts the steal flag,
collected-vector index, and thread-role label or failure-message context. Update
both consumer creations to invoke this helper while preserving their existing
pop behavior, termination condition, progress tracking, stall timeout, and
diagnostics.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@libs/core/threading_base/tests/unit/thread_exit_callbacks.cpp`:
- Around line 7-11: Update the header comment in the thread exit-callback tests
to remove references to the deleted has_exit_funcs_ atomic and lock-free fast
path. Describe the current synchronization model instead:
run_thread_exit_callbacks() and free_thread_exit_callbacks() acquire mtx_, while
running_exit_funcs_ and ran_exit_funcs_ guard callback state.

---

Nitpick comments:
In `@libs/core/init_runtime_local/src/init_runtime_local.cpp`:
- Around line 503-506: Align the error prefix in ensure_no_runtime_is_up() with
the local initialization path by changing its hpx::init prefix to
hpx::local::init:. Keep the existing message text and cleanup behavior
unchanged.

In `@libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp`:
- Around line 254-327: Extract the duplicated consumer polling logic from the
stealer and owner lambdas into a shared helper that accepts the steal flag,
collected-vector index, and thread-role label or failure-message context. Update
both consumer creations to invoke this helper while preserving their existing
pop behavior, termination condition, progress tracking, stall timeout, and
diagnostics.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 01da29c3-b59c-4b28-9b31-ce89409c2f74

📥 Commits

Reviewing files that changed from the base of the PR and between aa7b7c5 and 402d9f8.

📒 Files selected for processing (16)
  • libs/core/init_runtime_local/src/init_runtime_local.cpp
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner.hpp
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner_fwd.hpp
  • libs/core/resource_partitioner/src/detail_partitioner.cpp
  • libs/core/resource_partitioner/tests/unit/CMakeLists.txt
  • libs/core/resource_partitioner/tests/unit/scheduling_policy_wiring.cpp
  • libs/core/schedulers/tests/unit/CMakeLists.txt
  • libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp
  • libs/core/synchronization/tests/unit/CMakeLists.txt
  • libs/core/synchronization/tests/unit/latch_notification.cpp
  • libs/core/threading/src/thread.cpp
  • libs/core/threading_base/include/hpx/threading_base/thread_data.hpp
  • libs/core/threading_base/src/thread_data.cpp
  • libs/core/threading_base/tests/unit/CMakeLists.txt
  • libs/core/threading_base/tests/unit/thread_exit_callbacks.cpp
  • libs/full/init_runtime/src/hpx_init.cpp
🚧 Files skipped from review as they are similar to previous changes (9)
  • libs/core/threading_base/tests/unit/CMakeLists.txt
  • libs/full/init_runtime/src/hpx_init.cpp
  • libs/core/schedulers/tests/unit/CMakeLists.txt
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner_fwd.hpp
  • libs/core/resource_partitioner/tests/unit/scheduling_policy_wiring.cpp
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner.hpp
  • libs/core/resource_partitioner/src/detail_partitioner.cpp
  • libs/core/threading/src/thread.cpp
  • libs/core/synchronization/tests/unit/latch_notification.cpp

Comment thread libs/core/threading_base/tests/unit/thread_exit_callbacks.cpp Outdated
@StellarBot

Copy link
Copy Markdown
Collaborator
Performance test report

HPX Performance

Comparison

BENCHMARKFORK_JOIN_EXECUTORPARALLEL_EXECUTORSCHEDULER_EXECUTOR
For Each(=)(=)(=)

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T14:08:29+00:002026-07-13T00:27:42+00:00
HPX Commit0eeca8655c5237
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Clusternamerostamrostam
Envfile
Datetime2026-03-09T09:15:24.034803-05:002026-07-12T19:37:07.681581-05:00

Comparison

BENCHMARKNO-EXECUTOR
Future Overhead - Create Thread Hierarchical - Latch+++

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T14:08:29+00:002026-07-13T00:27:42+00:00
HPX Commit0eeca8655c5237
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Clusternamerostamrostam
Envfile
Datetime2026-03-09T09:17:15.638328-05:002026-07-12T19:39:04.861323-05:00

Comparison

BENCHMARKFORK_JOIN_EXECUTOR_DEFAULT_FORK_JOIN_POLICY_ALLOCATORPARALLEL_EXECUTOR_DEFAULT_PARALLEL_POLICY_ALLOCATORSCHEDULER_EXECUTOR_DEFAULT_SCHEDULER_EXECUTOR_ALLOCATOR
Stream Benchmark - Add(=)(=)--
Stream Benchmark - Scale(=)---
Stream Benchmark - Triad(=)---
Stream Benchmark - Copy(=)++++++

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T18:50:37+00:002026-07-13T00:27:42+00:00
HPX Commitba89f5d55c5237
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Clusternamerostamrostam
Envfile
Datetime2026-03-09T17:49:10.837937-05:002026-07-12T19:39:50.187620-05:00

Explanation of Symbols

SymbolMEANING
=No performance change (confidence interval within ±1%)
(=)Probably no performance change (confidence interval within ±2%)
(+)/(-)Very small performance improvement/degradation (≤1%)
+/-Small performance improvement/degradation (≤5%)
++/--Large performance improvement/degradation (≤10%)
+++/---Very large performance improvement/degradation (>10%)
?Probably no change, but quite large uncertainty (confidence interval with ±5%)
??Unclear result, very large uncertainty (±10%)
???Something unexpected…

@StellarBot

Copy link
Copy Markdown
Collaborator
Performance test report

HPX Performance

Comparison

BENCHMARKFORK_JOIN_EXECUTORPARALLEL_EXECUTORSCHEDULER_EXECUTOR
For Each(=)(=)(=)

Info

PropertyBeforeAfter
HPX Commit0eeca86b76a437
HPX Datetime2026-03-09T14:08:29+00:002026-07-13T00:44:12+00:00
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Datetime2026-03-09T09:15:24.034803-05:002026-07-12T19:52:05.088161-05:00
Clusternamerostamrostam
Envfile

Comparison

BENCHMARKNO-EXECUTOR
Future Overhead - Create Thread Hierarchical - Latch+++

Info

PropertyBeforeAfter
HPX Commit0eeca86b76a437
HPX Datetime2026-03-09T14:08:29+00:002026-07-13T00:44:12+00:00
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Datetime2026-03-09T09:17:15.638328-05:002026-07-12T19:54:05.201150-05:00
Clusternamerostamrostam
Envfile

Comparison

BENCHMARKFORK_JOIN_EXECUTOR_DEFAULT_FORK_JOIN_POLICY_ALLOCATORPARALLEL_EXECUTOR_DEFAULT_PARALLEL_POLICY_ALLOCATORSCHEDULER_EXECUTOR_DEFAULT_SCHEDULER_EXECUTOR_ALLOCATOR
Stream Benchmark - Add(=)(=)--
Stream Benchmark - Scale(=)---
Stream Benchmark - Triad(=)----
Stream Benchmark - Copy(=)++++++

Info

PropertyBeforeAfter
HPX Commitba89f5db76a437
HPX Datetime2026-03-09T18:50:37+00:002026-07-13T00:44:12+00:00
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Datetime2026-03-09T17:49:10.837937-05:002026-07-12T19:54:50.542606-05:00
Clusternamerostamrostam
Envfile

Explanation of Symbols

SymbolMEANING
=No performance change (confidence interval within ±1%)
(=)Probably no performance change (confidence interval within ±2%)
(+)/(-)Very small performance improvement/degradation (≤1%)
+/-Small performance improvement/degradation (≤5%)
++/--Large performance improvement/degradation (≤10%)
+++/---Very large performance improvement/degradation (>10%)
?Probably no change, but quite large uncertainty (confidence interval with ±5%)
??Unclear result, very large uncertainty (±10%)
???Something unexpected…

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp (1)

240-252: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Producer push loop has no stall/timeout guard, unlike consumers.

The consumer loop (lines 229-288) explicitly adds a 30s stall-timeout to avoid a silent CI hang if an item is ever lost. The producer retry loop (while (!backend.push(...)) yield();) has no equivalent bound — if push() ever fails to make progress (e.g. a capacity/parity bug under concurrent toggling), the producer spins forever and t.join() at line 305 blocks indefinitely, turning the failure into an opaque CI timeout instead of the actionable HPX_TEST_MSG failure this test otherwise aims for.

Example: bound the producer retry with the same stall-detection pattern used for consumers
         producers.emplace_back([&backend, p]() {
             std::uint64_t const base = p * items_per_producer;
+            auto last_progress = std::chrono::steady_clock::now();
             for (std::uint64_t i = 0; i != items_per_producer; ++i)
             {
-                while (!backend.push(base + i))
-                {
-                    std::this_thread::yield();
-                }
+                while (!backend.push(base + i))
+                {
+                    if (std::chrono::steady_clock::now() - last_progress >
+                        stress_stall_timeout)
+                    {
+                        HPX_TEST_MSG(false, "producer thread stalled: "
+                            "no progress for 30s (possible push bug)");
+                        return;
+                    }
+                    std::this_thread::yield();
+                }
+                last_progress = std::chrono::steady_clock::now();
             }
         });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp` around
lines 240 - 252, Update the producer retry loop in the producer thread setup to
use the same 30-second stall-detection and failure-reporting pattern as the
consumer loop, replacing the unbounded while (!backend.push(...)) spin. Ensure
stalled pushes trigger an actionable HPX_TEST_MSG failure and allow the thread
to exit so t.join() cannot hang indefinitely.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp`:
- Around line 240-252: Update the producer retry loop in the producer thread
setup to use the same 30-second stall-detection and failure-reporting pattern as
the consumer loop, replacing the unbounded while (!backend.push(...)) spin.
Ensure stalled pushes trigger an actionable HPX_TEST_MSG failure and allow the
thread to exit so t.join() cannot hang indefinitely.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e9ecb2b7-499f-474e-8377-c81a5e8f685f

📥 Commits

Reviewing files that changed from the base of the PR and between aa7b7c5 and fd761f1.

📒 Files selected for processing (16)
  • libs/core/init_runtime_local/src/init_runtime_local.cpp
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner.hpp
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner_fwd.hpp
  • libs/core/resource_partitioner/src/detail_partitioner.cpp
  • libs/core/resource_partitioner/tests/unit/CMakeLists.txt
  • libs/core/resource_partitioner/tests/unit/scheduling_policy_wiring.cpp
  • libs/core/schedulers/tests/unit/CMakeLists.txt
  • libs/core/schedulers/tests/unit/lockfree_fifo_double_backend.cpp
  • libs/core/synchronization/tests/unit/CMakeLists.txt
  • libs/core/synchronization/tests/unit/latch_notification.cpp
  • libs/core/threading/src/thread.cpp
  • libs/core/threading_base/include/hpx/threading_base/thread_data.hpp
  • libs/core/threading_base/src/thread_data.cpp
  • libs/core/threading_base/tests/unit/CMakeLists.txt
  • libs/core/threading_base/tests/unit/thread_exit_callbacks.cpp
  • libs/full/init_runtime/src/hpx_init.cpp
🚧 Files skipped from review as they are similar to previous changes (15)
  • libs/core/threading_base/tests/unit/CMakeLists.txt
  • libs/core/schedulers/tests/unit/CMakeLists.txt
  • libs/core/resource_partitioner/tests/unit/scheduling_policy_wiring.cpp
  • libs/core/resource_partitioner/tests/unit/CMakeLists.txt
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner_fwd.hpp
  • libs/core/init_runtime_local/src/init_runtime_local.cpp
  • libs/core/threading_base/tests/unit/thread_exit_callbacks.cpp
  • libs/core/resource_partitioner/src/detail_partitioner.cpp
  • libs/core/synchronization/tests/unit/CMakeLists.txt
  • libs/core/threading_base/include/hpx/threading_base/thread_data.hpp
  • libs/core/threading/src/thread.cpp
  • libs/core/resource_partitioner/include/hpx/resource_partitioner/partitioner.hpp
  • libs/full/init_runtime/src/hpx_init.cpp
  • libs/core/threading_base/src/thread_data.cpp
  • libs/core/synchronization/tests/unit/latch_notification.cpp

@StellarBot

Copy link
Copy Markdown
Collaborator
Performance test report

HPX Performance

Comparison

BENCHMARKFORK_JOIN_EXECUTORPARALLEL_EXECUTORSCHEDULER_EXECUTOR
For Each(=)(=)(=)

Info

PropertyBeforeAfter
HPX Commit0eeca86e153ce6
HPX Datetime2026-03-09T14:08:29+00:002026-07-13T00:57:48+00:00
Datetime2026-03-09T09:15:24.034803-05:002026-07-12T20:07:07.967430-05:00
Clusternamerostamrostam
Envfile
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8

Comparison

BENCHMARKNO-EXECUTOR
Future Overhead - Create Thread Hierarchical - Latch+++

Info

PropertyBeforeAfter
HPX Commit0eeca86e153ce6
HPX Datetime2026-03-09T14:08:29+00:002026-07-13T00:57:48+00:00
Datetime2026-03-09T09:17:15.638328-05:002026-07-12T20:09:08.554588-05:00
Clusternamerostamrostam
Envfile
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8

Comparison

BENCHMARKFORK_JOIN_EXECUTOR_DEFAULT_FORK_JOIN_POLICY_ALLOCATORPARALLEL_EXECUTOR_DEFAULT_PARALLEL_POLICY_ALLOCATORSCHEDULER_EXECUTOR_DEFAULT_SCHEDULER_EXECUTOR_ALLOCATOR
Stream Benchmark - Add(=)(=)--
Stream Benchmark - Scale(=)---
Stream Benchmark - Triad(=)----
Stream Benchmark - Copy(=)++++++

Info

PropertyBeforeAfter
HPX Commitba89f5de153ce6
HPX Datetime2026-03-09T18:50:37+00:002026-07-13T00:57:48+00:00
Datetime2026-03-09T17:49:10.837937-05:002026-07-12T20:09:53.517642-05:00
Clusternamerostamrostam
Envfile
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8

Explanation of Symbols

SymbolMEANING
=No performance change (confidence interval within ±1%)
(=)Probably no performance change (confidence interval within ±2%)
(+)/(-)Very small performance improvement/degradation (≤1%)
+/-Small performance improvement/degradation (≤5%)
++/--Large performance improvement/degradation (≤10%)
+++/---Very large performance improvement/degradation (>10%)
?Probably no change, but quite large uncertainty (confidence interval with ±5%)
??Unclear result, very large uncertainty (±10%)
???Something unexpected…

@hkaiser
hkaiser force-pushed the fixing_7111 branch 2 times, most recently from 8595bee to d2c8e4d Compare July 13, 2026 13:51
@StellarBot

Copy link
Copy Markdown
Collaborator
Performance test report

HPX Performance

Comparison

BENCHMARKFORK_JOIN_EXECUTORPARALLEL_EXECUTORSCHEDULER_EXECUTOR
For Each(=)(=)(=)

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T14:08:29+00:002026-07-13T13:51:31+00:00
HPX Commit0eeca86637cf66
Datetime2026-03-09T09:15:24.034803-05:002026-07-13T09:04:42.044603-05:00
Envfile
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Clusternamerostamrostam
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu

Comparison

BENCHMARKNO-EXECUTOR
Future Overhead - Create Thread Hierarchical - Latch+++

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T14:08:29+00:002026-07-13T13:51:31+00:00
HPX Commit0eeca86637cf66
Datetime2026-03-09T09:17:15.638328-05:002026-07-13T09:06:42.405637-05:00
Envfile
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Clusternamerostamrostam
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu

Comparison

BENCHMARKFORK_JOIN_EXECUTOR_DEFAULT_FORK_JOIN_POLICY_ALLOCATORPARALLEL_EXECUTOR_DEFAULT_PARALLEL_POLICY_ALLOCATORSCHEDULER_EXECUTOR_DEFAULT_SCHEDULER_EXECUTOR_ALLOCATOR
Stream Benchmark - Add(=)(=)--
Stream Benchmark - Scale=---
Stream Benchmark - Triad(=)---
Stream Benchmark - Copy(=)++++++

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T18:50:37+00:002026-07-13T13:51:31+00:00
HPX Commitba89f5d637cf66
Datetime2026-03-09T17:49:10.837937-05:002026-07-13T09:07:27.587556-05:00
Envfile
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Clusternamerostamrostam
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu

Explanation of Symbols

SymbolMEANING
=No performance change (confidence interval within ±1%)
(=)Probably no performance change (confidence interval within ±2%)
(+)/(-)Very small performance improvement/degradation (≤1%)
+/-Small performance improvement/degradation (≤5%)
++/--Large performance improvement/degradation (≤10%)
+++/---Very large performance improvement/degradation (>10%)
?Probably no change, but quite large uncertainty (confidence interval with ±5%)
??Unclear result, very large uncertainty (±10%)
???Something unexpected…

- flyby: fixing more nitpicks reported by CodeRabbit

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
@StellarBot

Copy link
Copy Markdown
Collaborator
Performance test report

HPX Performance

Comparison

BENCHMARKFORK_JOIN_EXECUTORPARALLEL_EXECUTORSCHEDULER_EXECUTOR
For Each(=)(=)(=)

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T14:08:29+00:002026-07-13T16:30:36+00:00
HPX Commit0eeca8651f86e8
Datetime2026-03-09T09:15:24.034803-05:002026-07-13T13:03:34.796602-05:00
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Envfile
Clusternamerostamrostam
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu

Comparison

BENCHMARKNO-EXECUTOR
Future Overhead - Create Thread Hierarchical - Latch+++

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T14:08:29+00:002026-07-13T16:30:36+00:00
HPX Commit0eeca8651f86e8
Datetime2026-03-09T09:17:15.638328-05:002026-07-13T13:05:34.987210-05:00
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Envfile
Clusternamerostamrostam
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu

Comparison

BENCHMARKFORK_JOIN_EXECUTOR_DEFAULT_FORK_JOIN_POLICY_ALLOCATORPARALLEL_EXECUTOR_DEFAULT_PARALLEL_POLICY_ALLOCATORSCHEDULER_EXECUTOR_DEFAULT_SCHEDULER_EXECUTOR_ALLOCATOR
Stream Benchmark - Add=(=)--
Stream Benchmark - Scale(=)---
Stream Benchmark - Triad(=)----
Stream Benchmark - Copy+++++++

Info

PropertyBeforeAfter
HPX Datetime2026-03-09T18:50:37+00:002026-07-13T16:30:36+00:00
HPX Commitba89f5d51f86e8
Datetime2026-03-09T17:49:10.837937-05:002026-07-13T13:06:20.148354-05:00
Compiler/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8/opt/apps/llvm/18.1.8/bin/clang++ 18.1.8
Envfile
Clusternamerostamrostam
Hostnamemedusa08.rostam.cct.lsu.edumedusa08.rostam.cct.lsu.edu

Explanation of Symbols

SymbolMEANING
=No performance change (confidence interval within ±1%)
(=)Probably no performance change (confidence interval within ±2%)
(+)/(-)Very small performance improvement/degradation (≤1%)
+/-Small performance improvement/degradation (≤5%)
++/--Large performance improvement/degradation (≤10%)
+++/---Very large performance improvement/degradation (>10%)
?Probably no change, but quite large uncertainty (confidence interval with ±5%)
??Unclear result, very large uncertainty (±10%)
???Something unexpected…

@hkaiser
hkaiser merged commit 20bc3d4 into master Jul 13, 2026
85 of 94 checks passed
@hkaiser
hkaiser deleted the fixing_7111 branch July 13, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate queues in scheduler(s)

2 participants