Skip to content

Move replicated-output dedup to the Dask and Ray frontends - #22394

Merged
rapids-bot[bot] merged 13 commits into
NVIDIA:mainfrom
Matt711:bug/polars/multi-rank-fixes
May 13, 2026
Merged

Move replicated-output dedup to the Dask and Ray frontends#22394
rapids-bot[bot] merged 13 commits into
NVIDIA:mainfrom
Matt711:bug/polars/multi-rank-fixes

Conversation

@Matt711

@Matt711 Matt711 commented May 6, 2026

Copy link
Copy Markdown
Member

Description

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@Matt711
Matt711 requested a review from madsbk May 6, 2026 12:39
@Matt711
Matt711 requested a review from a team as a code owner May 6, 2026 12:39
@Matt711 Matt711 added bug Something isn't working non-breaking Non-breaking change labels May 6, 2026
@copy-pr-bot

copy-pr-bot Bot commented May 6, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added Python Affects Python cuDF API. cudf-polars Issues specific to cudf-polars labels May 6, 2026
madsbk added a commit to madsbk/cudf that referenced this pull request May 7, 2026
Comment thread python/cudf_polars/cudf_polars/experimental/rapidsmpf/frontend/ray.py Outdated
@vyasr

vyasr commented May 7, 2026

Copy link
Copy Markdown
Contributor

/ok to test

@copy-pr-bot

copy-pr-bot Bot commented May 7, 2026

Copy link
Copy Markdown

/ok to test

@vyasr, there was an error processing your request: E1

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/

@vyasr

vyasr commented May 7, 2026

Copy link
Copy Markdown
Contributor

/ok to test b513cf4

@Matt711

Matt711 commented May 7, 2026

Copy link
Copy Markdown
Member Author

This PR depends on #22381

@Matt711
Matt711 force-pushed the bug/polars/multi-rank-fixes branch from b513cf4 to 7663fc5 Compare May 12, 2026 10:55
@Matt711

Matt711 commented May 12, 2026

Copy link
Copy Markdown
Member Author

/ok to test 7663fc5

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Frontend execution layers (dask and ray) now always collect channel metadata and clear non-root rank outputs when marked duplicated. Downstream DAG nodes (union, drain, select, join) are simplified by removing rank-aware conditional forwarding and communicator wiring. Regression tests validate the new behavior.

Changes

Centralized duplicate suppression refactor

Layer / File(s) Summary
Duplicate suppression in frontend execution layers
python/cudf_polars/cudf_polars/experimental/rapidsmpf/frontend/dask.py, python/cudf_polars/cudf_polars/experimental/rapidsmpf/frontend/ray.py
Dask and Ray frontends now always collect metadata from evaluate_on_rank and clear output DataFrames on non-root ranks when the final metadata item is marked duplicated.
Union node refactoring: remove rank-aware suppression
python/cudf_polars/cudf_polars/experimental/rapidsmpf/union.py
Union node removes Communicator import/parameter and rank-based conditional forwarding; metadata aggregation now sums local_count and computes duplicated by conjunction; wiring stops passing comm.
Metadata drain node: remove conditional forwarding
python/cudf_polars/cudf_polars/experimental/rapidsmpf/nodes.py
metadata_drain_node appends received metadata to collector and unconditionally forwards all non-None data messages to output channel.
Select fast-count optimization: remove placeholder pattern
python/cudf_polars/cudf_polars/experimental/select.py
Fast-count Select lowering uses the actual child as df input instead of an Empty({}) placeholder and records PartitionInfo(count=1) only for the new Select node.
Join allgather path: remove intermediate variable
python/cudf_polars/cudf_polars/experimental/rapidsmpf/join.py
Directly pass awaited allgather.extract_concatenated(stream) into DataFrame.from_table(...), removing the intermediate gathered/table fallback.
Regression tests and xfail adjustment
python/cudf_polars/tests/experimental/test_spmd.py, python/cudf_polars/tests/experimental/test_union.py, python/cudf_polars/tests/test_groupby.py
Add tests for sort+head over union of duplicated streams on SPMD and GPU paths; narrow xfail for test_groupby_literal_agg to AssertionError only.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


Possibly related PRs

  • rapidsai/cudf#22410: Modifies the same RapidsMPF frontend entrypoints (dask._worker_evaluate and RankActor.evaluate_polars_ir), related to metadata collection and deduplication.

Suggested reviewers

  • madsbk
  • vyasr
  • mroeschke
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 53.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main change: moving deduplication logic for replicated outputs from intermediate operators to the Dask and Ray frontends.
Description check ✅ Passed The description clearly explains the purpose of the changes, references the reverted PR, specifies where deduplication now occurs, and clarifies the semantic meaning of duplicated metadata.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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

🤖 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 `@python/cudf_polars/tests/experimental/test_spmd.py`:
- Around line 312-313: The test currently only asserts the "name" column from
result = lf.collect(engine=spmd_engine); instead, produce a CPU baseline by
collecting the same LazyFrame with the CPU/Polars engine (e.g., baseline =
lf.collect(engine=<cpu_engine> or default)), normalize both frames (sort rows
deterministically, reset row order/index and column order if needed, and ensure
dtypes are comparable), then assert the full frames are equal (e.g., assert
normalized_spmd_frame.frame_equal(normalized_cpu_frame)). Update the test to use
lf.collect(engine=spmd_engine) and lf.collect(...) for the baseline and compare
the fully normalized frames to ensure full-parity checking.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 75c8bd16-29bc-49b6-b405-2ba08284c21f

📥 Commits

Reviewing files that changed from the base of the PR and between 87cf789 and 7663fc5.

📒 Files selected for processing (9)
  • python/cudf_polars/cudf_polars/experimental/rapidsmpf/frontend/dask.py
  • python/cudf_polars/cudf_polars/experimental/rapidsmpf/frontend/ray.py
  • python/cudf_polars/cudf_polars/experimental/rapidsmpf/join.py
  • python/cudf_polars/cudf_polars/experimental/rapidsmpf/nodes.py
  • python/cudf_polars/cudf_polars/experimental/rapidsmpf/union.py
  • python/cudf_polars/cudf_polars/experimental/select.py
  • python/cudf_polars/tests/experimental/test_spmd.py
  • python/cudf_polars/tests/experimental/test_union.py
  • python/cudf_polars/tests/test_groupby.py

Comment thread python/cudf_polars/tests/experimental/test_spmd.py Outdated
@Matt711

Matt711 commented May 12, 2026

Copy link
Copy Markdown
Member Author

/ok to test ca34558

@Matt711
Matt711 force-pushed the bug/polars/multi-rank-fixes branch from ca34558 to da95957 Compare May 12, 2026 11:32

@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)
python/cudf_polars/tests/experimental/test_spmd.py (1)

313-314: ⚡ Quick win

Make the slice actually truncating to strengthen this regression.

head(10) on a 2-row input is a no-op, so this doesn’t strongly exercise slice behavior. Consider reducing the limit (or increasing input rows) so slicing is truly validated.

Proposed minimal tweak
-    lf = pl.concat([lf1, lf2]).sort("score").head(10)
+    lf = pl.concat([lf1, lf2]).sort("score").head(1)
🤖 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 `@python/cudf_polars/tests/experimental/test_spmd.py` around lines 313 - 314,
The test uses lf = pl.concat([lf1, lf2]).sort("score").head(10) but because the
concatenated input is only 2 rows the head(10) is a no-op and doesn't exercise
slice behavior; update the test so slicing actually truncates — either reduce
the head limit (e.g., head(1) or head(0)) on the existing concatenated DataFrame
(lf) or increase the size of lf1/lf2 so pl.concat([...]).sort("score").head(10)
will actually drop rows; ensure the assertion still uses
assert_gpu_result_equal(lf, engine=spmd_engine, check_row_order=False).
🤖 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 `@python/cudf_polars/tests/experimental/test_spmd.py`:
- Around line 313-314: The test uses lf = pl.concat([lf1,
lf2]).sort("score").head(10) but because the concatenated input is only 2 rows
the head(10) is a no-op and doesn't exercise slice behavior; update the test so
slicing actually truncates — either reduce the head limit (e.g., head(1) or
head(0)) on the existing concatenated DataFrame (lf) or increase the size of
lf1/lf2 so pl.concat([...]).sort("score").head(10) will actually drop rows;
ensure the assertion still uses assert_gpu_result_equal(lf, engine=spmd_engine,
check_row_order=False).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e887bb01-7e0d-4a75-8682-a5c7d6338d0f

📥 Commits

Reviewing files that changed from the base of the PR and between c0191d4 and ca34558.

📒 Files selected for processing (1)
  • python/cudf_polars/tests/experimental/test_spmd.py

@Matt711

Matt711 commented May 12, 2026

Copy link
Copy Markdown
Member Author

/ok to test 6b190c1

@Matt711
Matt711 force-pushed the bug/polars/multi-rank-fixes branch from 6b190c1 to 814ca39 Compare May 12, 2026 13:07
@Matt711

Matt711 commented May 12, 2026

Copy link
Copy Markdown
Member Author

/ok to test a9b7480

@Matt711
Matt711 force-pushed the bug/polars/multi-rank-fixes branch from a9b7480 to 814f4d1 Compare May 12, 2026 18:01
@Matt711

Matt711 commented May 12, 2026

Copy link
Copy Markdown
Member Author

/ok to test 4a903a9

Comment thread python/cudf_polars/cudf_polars/experimental/rapidsmpf/frontend/dask.py Outdated
@Matt711

Matt711 commented May 13, 2026

Copy link
Copy Markdown
Member Author

/ok to test 8db9ba0

@Matt711

Matt711 commented May 13, 2026

Copy link
Copy Markdown
Member Author

/ok to test a842d16

@Matt711

Matt711 commented May 13, 2026

Copy link
Copy Markdown
Member Author

/merged

@Matt711

Matt711 commented May 13, 2026

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit 8d1afe1 into NVIDIA:main May 13, 2026
86 of 88 checks passed
@Matt711
Matt711 deleted the bug/polars/multi-rank-fixes branch May 13, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cudf-polars Issues specific to cudf-polars non-breaking Non-breaking change Python Affects Python cuDF API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants