Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data] Fix map operator fusion when concurrency is set #49573

Merged
merged 4 commits into from
Jan 7, 2025

Conversation

raulchen
Copy link
Contributor

@raulchen raulchen commented Jan 4, 2025

Why are these changes needed?

Current operator fusion rule doesn't consider concurrency.
This PR fixes this issue by only allow fusing 2 operators when they have the same concurrency.
For task->actor, we allow fusion when task's concurrency = actor's upper bound.
Also fixed some type hinting issues regarding compute strategy.

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
@raulchen raulchen requested a review from a team as a code owner January 4, 2025 00:51
@Jay-ju
Copy link
Contributor

Jay-ju commented Jan 6, 2025

Can the fuse operator be used as a switch to ignore the choice of GPU/CPU and concurrent settings? As long as the switch is turned on, fusion is performed. This is very useful for the situation of out-of-memory (OOM).

Task->Task and Task->Actor are allowed.
Actor->Actor and Actor->Task are not allowed.
"""
if isinstance(up_compute, ActorPoolStrategy):
Copy link
Contributor

@gvspraveen gvspraveen Jan 6, 2025

Choose a reason for hiding this comment

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

Any reason you are disallowing upstream op being Actor here?

Previous logic seems to permit Actor -> Task as long as compute are compatible/same.

is_task_compute(down_logical_op._compute) and get_compute(
                up_logical_op._compute
            ) != get_compute(down_logical_op._compute)
         return False

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actor -> Task is already disallowed by this condition above.

Copy link
Contributor

@gvspraveen gvspraveen Jan 6, 2025

Choose a reason for hiding this comment

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

for future. if resource requirements are same, should we allow Actor -> Task fuse?

@raulchen
Copy link
Contributor Author

raulchen commented Jan 6, 2025

Can the fuse operator be used as a switch to ignore the choice of GPU/CPU and concurrent settings? As long as the switch is turned on, fusion is performed. This is very useful for the situation of out-of-memory (OOM).

Can you just set the same args to allow fusion?

Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
@raulchen raulchen enabled auto-merge (squash) January 7, 2025 18:05
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Jan 7, 2025
@raulchen raulchen merged commit 25ca8aa into ray-project:master Jan 7, 2025
6 of 7 checks passed
@raulchen raulchen deleted the fix-fused-concurrency branch January 7, 2025 21:25
@Jay-ju
Copy link
Contributor

Jay-ju commented Jan 8, 2025

Can the fuse operator be used as a switch to ignore the choice of GPU/CPU and concurrent settings? As long as the switch is turned on, fusion is performed. This is very useful for the situation of out-of-memory (OOM).

Can you just set the same args to allow fusion?

Is it also possible if one is a CPU and the other is a GPU?

roshankathawate pushed a commit to roshankathawate/ray that referenced this pull request Jan 9, 2025
…9573)

Current operator fusion rule doesn't consider concurrency.
This PR fixes this issue by only allow fusing 2 operators when they have
the same concurrency.
For task->actor, we allow fusion when task's concurrency = actor's upper
bound.
Also fixed some type hinting issues regarding compute strategy.

---------

Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Roshan Kathawate <roshankathawate@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants