Skip to content

[Data] remove shuffle streaming reduce - #64481

Merged
goutamvenkat-anyscale merged 1 commit into
ray-project:masterfrom
owenowenisme:data/remove-streaming-reduce
Jul 2, 2026
Merged

goutamvenkat-anyscale merged 1 commit into
ray-project:masterfrom
owenowenisme:data/remove-streaming-reduce

Conversation

@owenowenisme

@owenowenisme owenowenisme commented Jul 1, 2026 •

Copy link
Copy Markdown
Member

Description

Most APIs won't use streaming reduce, and repartition in particular can't — it need to maintain the "one partition = one block", so it always runs the reducer in blocking mode (disallow_block_splitting=True). On top of that, keeping the streaming-reduce path around makes it harder to implement other APIs (join) that all require the full partition before reducing.

So we're removing the streaming_reduce flag and its incremental-flush logic now. The reduce is unconditionally "accumulate the partition → reduce once → finalize". The disallow_block_splitting / target_max_block_size axis is kept — it's independent and still useful.

Related issues

Link related issues: "Fixes #1234", "Closes #1234", or "Related to #1234".

Additional information

Optional: Add implementation details, API changes, usage examples, screenshots, etc.

Signed-off-by: You-Cheng Lin <[email protected]>
@owenowenisme
owenowenisme requested a review from a team as a code owner July 1, 2026 18:28

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request simplifies the shuffle reduce logic by completely removing the streaming_reduce option. The ShuffleReduceOp and _shuffle_reduce_task have been refactored to always accumulate all shards for a partition and execute the reduce_fn once over the full partition, rather than supporting incremental streaming reductions. All references to streaming_reduce and streaming parameters have been cleaned up across the codebase, including in operator fusion and planning logic. I have no feedback to provide as there are no review comments to evaluate.

@owenowenisme owenowenisme added data Ray Data-related issues go add ONLY when ready to merge, run all tests labels Jul 1, 2026
@goutamvenkat-anyscale

Copy link
Copy Markdown
Contributor

Wait won't this be detrimental for aggs like sum and concat?

@owenowenisme

owenowenisme commented Jul 2, 2026 •

Copy link
Copy Markdown
Member Author

Actually this PR doesn't change behavior for either case today:

  • concat / repartition — already runs in blocking mode because repartition requires one block per partition, so streaming never applied.
  • sum — We don't have cross-flush accumulator state so streaming won't help right now.

Rather than maintaining this complexity, I'd rather remove it now, most shuffle paths need blocking anyway and revisit streaming if we hit a concrete use case where it pays off.

@goutamvenkat-anyscale
goutamvenkat-anyscale merged commit 590b244 into ray-project:master Jul 2, 2026
4 checks passed
owenowenisme added a commit that referenced this pull request Jul 2, 2026
Generalize ShuffleReduceOp / _shuffle_reduce_task to N co-partitioned inputs (pairing per (partition, input), all-inputs-done flush, tables_by_input). This is now based on master after #64481, so the PR carries only multi-input support and not the streaming-reduce removal.
owenowenisme added a commit to owenowenisme/ray that referenced this pull request Jul 8, 2026
Generalize ShuffleReduceOp / _shuffle_reduce_task to N co-partitioned inputs (pairing per (partition, input), all-inputs-done flush, tables_by_input). This is now based on master after ray-project#64481, so the PR carries only multi-input support and not the streaming-reduce removal.

Signed-off-by: You-Cheng Lin <[email protected]>
elliot-barn pushed a commit that referenced this pull request Jul 9, 2026
## Description
Most APIs won't use streaming reduce, and repartition in particular
can't — it need to maintain the "one partition = one block", so it
always runs the reducer in blocking mode
(`disallow_block_splitting=True`). On top of that, keeping the
streaming-reduce path around makes it harder to implement other APIs
(join) that all require the full partition before reducing.

So we're removing the streaming_reduce flag and its incremental-flush
logic now. The reduce is unconditionally "accumulate the partition →
reduce once → finalize". The disallow_block_splitting /
target_max_block_size axis is kept — it's independent and still useful.

## Related issues
> Link related issues: "Fixes #1234", "Closes #1234", or "Related to
#1234".

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.

Signed-off-by: You-Cheng Lin <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
ShockYoungCHN added a commit to ShockYoungCHN/ray that referenced this pull request Jul 9, 2026
…n refs

## Drop streaming_reduce (align with v2 ray-project#64481)

Upstream v2 removed the ``streaming_reduce`` flag and its
incremental-flush logic in commit 590b244 (ray-project#64481). Reason from
that commit message: repartition needs "one partition = one block"
so it always runs blocking anyway, and keeping the streaming path
around obstructs future APIs (join) that also require full-partition
input.

Same reasoning applies verbatim to the external variant: scope is
keyed Repartition only, ``disallow_block_splitting=True`` +
``coalesce_output=True`` always set → the streaming code path in
``external_hash_shuffle_reduce_task`` was already unreachable.

Removed:
- ``streaming_reduce`` ctor param + attribute + section comment
  on ``ExternalHashShuffleReduceOp``.
- ``streaming`` param on ``external_hash_shuffle_reduce_task``.
- Incremental-flush branch inside ``_decode_region`` (no longer a
  generator, so its call site drops the ``yield from``).
- ``streaming_reduce = not logical_op.sort`` in the planner.
- ``streaming_reduce=False`` from the smoke test call.
- The isinstance-branched already-fused check in
  ``operator_fusion.py`` (both variants store the transformer in
  ``_fused_output_map_transformer`` now, so no branching needed).

## Fix stale operator_fusion.py refs from earlier renames

The reduce-op alignment commits (c24757a, a734985) renamed
attributes and ctor params on ``ExternalHashShuffleReduceOp``:
- ``_reduce_num_cpus`` → ``_shuffle_reduce_task_num_cpus``
- ``downstream_map_*`` (ctor kwargs) → ``fused_output_map_*``
- ``_downstream_map_transformer`` (attribute) →
  ``_fused_output_map_transformer``

``_get_fused_map_into_shuffle_reduce_operator`` still used the old
names, so any ``Repartition -> Write`` (or similar map-fusable
downstream) with ``use_external_hash_shuffle=True`` would blow up
with ``AttributeError`` when the fusion rule fired. Not caught by
the smoke test (no downstream map) — real bug for downstream users.

Fixed all four names to match the current class API.

Also updated the docstring: with the API converged, the "two
different field names" bit no longer applies — both variants share
the ``fused_output_map_*`` API; only the extra
external-specific knobs (``coalesce_output``, ``max_bytes_per_fetch``,
``reduce_prefetch_dir``) require branch-specific construction.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: Yuanzhuo Yang <[email protected]>
ShockYoungCHN added a commit to ShockYoungCHN/ray that referenced this pull request Jul 10, 2026
Delete every "same as v2" / "mirrors v2" / "matches v2" / "v2's X"
comment across the external-shuffle sources. The comparisons were
useful during the initial port when the design was mid-diff; now that
external stands on its own, those references have decayed into noise
and (in some cases) point at file:line refs that no longer exist.

Sweep touched:

- ``hash_shuffle_external.py`` module docstring: drop the "vs v2"
  section and the "reuses v2's contracts verbatim" line. Kept the
  concrete design summary — those bullets describe external's own
  behavior.
- ``external_hash_shuffle_reduce_task`` docstring: drop "mirrors v2's
  decision in ray-project#64481" — the reasoning ("repartition needs one
  partition = one block, so incremental flush is dead code") stands on
  its own.
- ``ExternalHashShuffleReduceOp``: drop "Same as v2:" /
  "no v2 counterpart" prefixes on the disallow_block_splitting and
  external-knob comments. The behavior descriptions were already
  self-contained.
- ``ExternalHashShuffleMapOp``: drop "matching v2" / "mirrors v2's
  _partition_bytes" / "(v2 gets them from ray.get below)" — replace
  with descriptions of what the code itself does.
- Empty-input shortcut in reduce task: drop "same as v2" from the
  "may be nothing" note.
- Arrow-conversion comment: drop "Match v2's boundary convention".
- ``operator_fusion.py``: the ``else: # V2 ShuffleReduceOp`` branch
  marker becomes ``else: # plasma-based ShuffleReduceOp`` — same
  meaning, no version-number ambiguity.
- ``plan_all_to_all_op.py`` v2 planner docstring: "for V2 hash
  shuffle" → "for the plasma-based hash shuffle".

Only remaining ``v2`` string is the ``hash_shuffle_v2`` import path,
which is the module name we borrow shared helpers (_concat_reduce,
_sort_reduce, _make_hash_partition_fn) from — not a comparison.

Smoke tests still pass.

Signed-off-by: Yuanzhuo Yang <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
## Description
Most APIs won't use streaming reduce, and repartition in particular
can't — it need to maintain the "one partition = one block", so it
always runs the reducer in blocking mode
(`disallow_block_splitting=True`). On top of that, keeping the
streaming-reduce path around makes it harder to implement other APIs
(join) that all require the full partition before reducing.

So we're removing the streaming_reduce flag and its incremental-flush
logic now. The reduce is unconditionally "accumulate the partition →
reduce once → finalize". The disallow_block_splitting /
target_max_block_size axis is kept — it's independent and still useful.

## Related issues
> Link related issues: "Fixes ray-project#1234", "Closes ray-project#1234", or "Related to
ray-project#1234".

## Additional information
> Optional: Add implementation details, API changes, usage examples,
screenshots, etc.

Signed-off-by: You-Cheng Lin <[email protected]>
Signed-off-by: 400Ping <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ray fails to serialize self-reference objects

2 participants