Skip to content

Fix review findings in coroutines, contains, and segmented comparisons - #8211

Merged
hkaiser merged 5 commits into
masterfrom
fix-cr8099-quick-findings
Nov 24, 2026
Merged

hkaiser merged 5 commits into
masterfrom
fix-cr8099-quick-findings

Conversation

@hkaiser

@hkaiser hkaiser commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

These are the review findings on the V2.0.1 release PR #8099 that apply to master as well and have a small, self-contained fix. All code involved came from earlier PRs, so the fixes go to master first and can then be picked into 2.0.1.

The final awaiter of coroutines returning hpx::future gives up the
coroutine's reference with a release-only decrement. As in
intrusive_ptr_release, the thread that drops the last reference needs an
acquire fence before it destroys the shared state, so that the
destruction is ordered after the writes of the other holders.

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
The sequential search computed the length of the range first. For a
single-pass range (std::istream_iterator, for instance) that consumed the
input, so the search found nothing. loop_pred stops at the end of the
range anyway.

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
When the two ranges of a segmented equal or mismatch are on different
localities, the values of the second range are captured and compared on
the locality of the first. The comparison passed mutable references to
these values to the predicate, even if the second range has const
elements; on the same locality the predicate sees const references.

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
The parallel segmented mismatch returned the first mismatch of a batch
without looking at the comparisons that came after it, so an error of
one of those was lost. Collect the results of the batch with
get_capture_results, which reports the errors of all its comparisons.

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
The test returned 0, so its HPX_TEST failures didn't change its exit
status.

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
@hkaiser hkaiser added this to the 2.1.0 milestone Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Range containment now works with single-pass input ranges, including streams and empty ranges.
    • Comparisons on segmented ranges now respect const input iterators.
    • Segmented mismatch operations now collect comparison results before identifying the first mismatch, improving result handling.

The changes update contains for single-pass ranges, adjust final-suspend behavior, and change iterator selection and result collection in segmented comparisons. A regression test now returns the HPX test error report.

Changes: Single-pass contains

Layer / File(s) Summary
Search and single-pass tests
libs/core/algorithms/include/hpx/parallel/algorithms/detail/contains.hpp, libs/core/algorithms/tests/unit/container_algorithms/contains_range.cpp
contains searches without a distance prepass. Tests cover values at the beginning and end of a stream, an absent value, and an empty stream.

Coroutine final suspend

Layer / File(s) Summary
Final-suspend behavior
libs/core/futures/include/hpx/futures/traits/detail/future_await_traits.hpp
When requires_delete() is true, await_suspend performs an acquire thread fence and returns false. Otherwise, it returns true.

Segmented comparison

Layer / File(s) Summary
Comparison dispatch and result collection
libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/detail/capture_dispatch.hpp, libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/mismatch.hpp
Captured comparisons select cbegin() or begin() based on the raw second iterator's reference type. Mismatch processing collects comparison results before scanning them in segment order.

Test error reporting

Layer / File(s) Summary
Regression test exit status
libs/core/algorithms/tests/regressions/static_chunker_2282.cpp
The test's main returns the result of hpx::util::report_errors(), instead of returning 0.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: charan6924, zak-k-abdi, msimberg

Merge Risk: Minimal · up to e5936

These are small targeted fixes: single-pass contains, an acquire fence in the coroutine final awaiter, const-correct segmented comparisons, mismatch error reporting, and a test exit status. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: fixes from review findings in coroutines, contains, and segmented comparisons. It is accurate to the changeset, which covers the final awaiter fence, sequential contai…
Description check Passed The description states that the PR applies review findings from the V2.0.1 release PR to master. It lists each fix with its related issue or PR: the coroutine final awaiter fence, the policy-free hpx:…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: fixes from review findings in coroutines, contains, and segmented comparisons. It is accurate to the changeset, which covers the final awaiter fence, sequential contains, captured_comparison constness, segmented mismatch, and a test return value. It is somewhat broad because it does not name each fix, but it is related to the main change and is not vague.

Full details: Description check

Explanation

The description states that the PR applies review findings from the V2.0.1 release PR to master. It lists each fix with its related issue or PR: the coroutine final awaiter fence, the policy-free hpx::ranges::contains length prepass, segmented equal and mismatch constness, segmented parallel mismatch error reporting, and the static_chunker_2282 return value. These match the changed files, so the description is related to the changeset.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 510b4f30-c997-415d-ae92-81e023b4b4d8
Commits

Reviewing files that changed from the base of the PR and between c571037 and e593644.

Files selected for processing: 6

  • libs/core/algorithms/include/hpx/parallel/algorithms/detail/contains.hpp
  • libs/core/algorithms/tests/regressions/static_chunker_2282.cpp
  • libs/core/algorithms/tests/unit/container_algorithms/contains_range.cpp
  • libs/core/futures/include/hpx/futures/traits/detail/future_await_traits.hpp
  • libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/detail/capture_dispatch.hpp
  • libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/mismatch.hpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

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

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.

1 participant