Skip to content

Fix copy_if, the scans and merge not compiling with guided_chunk_size - #8178

Merged
hkaiser merged 1 commit into
TheHPXProject:masterfrom
vivs24307-maker:fix/guided-chunk-size-scan-merge
Nov 22, 2026
Merged

hkaiser merged 1 commit into
TheHPXProject:masterfrom
vivs24307-maker:fix/guided-chunk-size-scan-merge

Conversation

@vivs24307-maker

Copy link
Copy Markdown
Contributor

Follow-up to #8115 (#8123 fixed the algorithms using the static partitioner)

Proposed Changes

  • The scan partitioner passed arguments to get_bulk_iteration_shape_variable that it doesn't take, so copy_if, remove_copy_if, unique_copy, partition_copy and the four scans didn't compile with guided_chunk_size.
  • The for_each partitioner didn't pass the number of cores to the reshape function in the variable chunk size path, so merge didn't compile.
  • Added a regression test checking these algorithms against the standard library with guided_chunk_size.

Any background context you want to provide?

These were the remaining algorithms from #8115, as discussed there.

Checklist

Not all points below apply to all pull requests.

  • I have added a new feature and have added tests to go along with it.
  • I have fixed a bug and have added a regression test.
  • I have added a test using random numbers; I have made sure it uses a seed, and that random numbers generated are valid inputs for the tests.

Signed-off-by: vivs24307-maker <vivs24307@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of parallel copy, scan, and merge operations when using guided chunk sizes across a range of input sizes.
  • Tests
    • Added regression coverage comparing parallel algorithm results with standard-library results.

The variable-chunk-size path now passes the core count to reshape, and the shape helper no longer forwards the work-item vector or test function. A regression test checks several parallel algorithms with guided chunk sizes.

Changes: Guided chunk-size algorithms

Layer / File(s) Summary
Chunk shape and partitioner arguments
libs/core/algorithms/include/hpx/parallel/util/detail/chunk_size.hpp, libs/core/algorithms/include/hpx/parallel/util/foreach_partitioner.hpp
The std::true_type overload delegates to the variable-chunk shape helper without forwarding the work-item vector or test function. The variable-chunk-size path passes cores to reshape.
Guided chunk-size regression coverage
libs/core/algorithms/tests/regressions/guided_chunk_size_scan_merge.cpp, libs/core/algorithms/tests/regressions/CMakeLists.txt
The regression test compares selected HPX algorithm results with standard-library results across seven input sizes and four guided chunk sizes. The test is added to the regression test list.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested labels: type: defect, category: algorithms

Merge Risk: Minimal · up to f107c

This change fixes compilation of several parallel algorithms when guided chunk sizes are used, and adds a regression test. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: fixing compilation of copy_if, the scan algorithms, and merge when guided_chunk_size is used. The changeset touches the chunk-size shape call, the for_each partitioner…
Description check Passed The description explains the cause of each compile failure. It names the scan partitioner and the for_each partitioner, lists the affected algorithms, and describes the added regression test. It match…
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: fixing compilation of copy_if, the scan algorithms, and merge when guided_chunk_size is used. The changeset touches the chunk-size shape call, the for_each partitioner reshape call, and adds a regression test for those algorithms, so the title matches the change.

Full details: Description check

Explanation

The description explains the cause of each compile failure. It names the scan partitioner and the for_each partitioner, lists the affected algorithms, and describes the added regression test. It matches the changeset.

Finishing Touches

Generate unit tests (beta)

  • 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: 2149b054-77b2-4cc1-8ea1-0a33b66149ec
Commits

Reviewing files that changed from the base of the PR and between 161df7f and f107c5a.

Files selected for processing: 4

  • libs/core/algorithms/include/hpx/parallel/util/detail/chunk_size.hpp
  • libs/core/algorithms/include/hpx/parallel/util/foreach_partitioner.hpp
  • libs/core/algorithms/tests/regressions/CMakeLists.txt
  • libs/core/algorithms/tests/regressions/guided_chunk_size_scan_merge.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 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.

@hkaiser hkaiser left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, both fixes are right, and the test covers all the algorithms that go through these two paths. LGTM.

@hkaiser
hkaiser merged commit d651126 into TheHPXProject:master Nov 22, 2026
160 checks passed
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.

2 participants