Skip to content

Give the parallel iota a task size - #8195

Merged
hkaiser merged 1 commit into
masterfrom
task-size-iota
Nov 23, 2026
Merged

hkaiser merged 1 commit into
masterfrom
task-size-iota

Conversation

@hkaiser

@hkaiser hkaiser commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

#7968 sized the algorithms that don't call a user function, but missed iota. This adds it: an iteration of iota assigns an element and increments the value, which takes about a nanosecond when the value is a builtin type, so iota now gets the same size per element as fill (element_operation_size of the iterator). For other value types the size stays unknown.

task_sizes_no_function checks iota with int values (medium with par, small with par_unseq if a lane holds more than one int) and with a value type that isn't builtin but adds a distance and converts to int (unknown).

This touches the same function in iota.hpp as #8192, but the two apply independently of each other.

iota was the only algorithm without a user function that had no task
size. An iteration assigns an element and increments the value: about a
nanosecond if the value is a builtin type, so iota is sized like fill
by its elements; for other value types the size is unknown.

The task_sizes_no_function test checks iota with int values (medium,
and small with par_unseq when a lane holds more than one int) and with
a value type that isn't builtin (unknown).

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

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Performance
    • Parallel sequence generation now uses workload sizing tailored to supported value types, helping the runtime schedule work more appropriately. For other value types, scheduling continues to use a conservative fallback. The sequential behavior is unchanged.

Parallel iota now passes task-size metadata to the indexed partitioner. Builtin operand types use an element-operation size estimate; other types use an unknown size. Tests cover parallel and unsequenced policies.

Changes: Parallel iota task sizing

Layer / File(s) Summary
iota task-size selection and tests
libs/core/algorithms/include/hpx/parallel/algorithms/detail/iota.hpp, libs/core/algorithms/tests/unit/task_sizes/task_sizes_no_function.cpp
The parallel implementation wraps the indexed partitioner task with with_task_size. It uses the iterator element-operation size for builtin operand types and task_size::unknown otherwise. Tests check builtin and non-builtin operands under parallel policy and builtin operands under unsequenced policy.

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

Change: Feature

Possibly related PRs

Merge Risk: Minimal · up to 32dc6

Parallel iota now receives task-size hints, which affect how work is chunked and do not change results. No actionable merge risk remains after review, and tests cover the main cases.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: adding a task size to the parallel iota algorithm. The raw summary confirms iota.hpp now wraps its partitioner task with with_task_size, and the test file checks the r…
Description check Passed The description states that iota missed the task sizing from #7968 and explains the change. It says iota now uses element_operation_size of the iterator for builtin value types and unknown otherwise. …
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: adding a task size to the parallel iota algorithm. The raw summary confirms iota.hpp now wraps its partitioner task with with_task_size, and the test file checks the resulting sizes. The title is specific and matches the objectives, so it passes.

Full details: Description check

Explanation

The description states that iota missed the task sizing from #7968 and explains the change. It says iota now uses element_operation_size of the iterator for builtin value types and unknown otherwise. It also describes the new task_sizes_no_function test cases. The description matches the changeset, so it passes.

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: a46bebd4-1d5c-4364-8e9e-daa85970e87e
Commits

Reviewing files that changed from the base of the PR and between 31d2071 and 32dc662.

Files selected for processing: 2

  • libs/core/algorithms/include/hpx/parallel/algorithms/detail/iota.hpp
  • libs/core/algorithms/tests/unit/task_sizes/task_sizes_no_function.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 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

The CI issue will be fixed separately

@hkaiser
hkaiser merged commit 681ba8c into master Nov 23, 2026
160 of 161 checks passed
@hkaiser
hkaiser deleted the task-size-iota branch November 23, 2026 15:35
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