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] Slice output blocks to respect target block size #40248

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

stephanie-wang
Copy link
Contributor

Why are these changes needed?

This slices a task's output blocks to ensure that we respect the target max block size. This can cause a performance penalty for cases where the batch size is misaligned with the output block size, but this is necessary for stability and can be optimized later (by auto-choosing a better batch size).

Related issue number

#40026.

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: Stephanie Wang <swang@cs.berkeley.edu>
Signed-off-by: Stephanie Wang <swang@cs.berkeley.edu>
Copy link
Contributor

@raulchen raulchen left a comment

Choose a reason for hiding this comment

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

Nice fix. Have you run the benchmarks? Would like to learn the perf impact.

@stephanie-wang
Copy link
Contributor Author

Nice fix. Have you run the benchmarks? Would like to learn the perf impact.

Good idea, will do this.

@stephanie-wang
Copy link
Contributor Author

Did some spot checks on the single-node performance benchmarks, and seems like there's on obvious difference.

@stephanie-wang stephanie-wang merged commit d5f1eed into ray-project:master Oct 12, 2023
89 of 121 checks passed
stephanie-wang added a commit to stephanie-wang/ray that referenced this pull request Oct 20, 2023
stephanie-wang added a commit that referenced this pull request Oct 23, 2023
#40248 changed output block creation so that when a task produces its output blocks, it will try to slice them before yielding to respect the target block size. Unfortunately, all-to-all ops currently don't support dynamic block splitting. This means that if we try to fuse an upstream map iterator with an all-to-all op, the all-to-all task will still have to fuse all of the sliced blocks back together again. This seems to increase memory usage significantly.

This PR avoids this issue by overriding the upstream map iterator's target block size to infinity when it is fused with an all-to-all op. This also adds a logger warning for how to workaround.
Related issue number

Closes #40518.

---------

Signed-off-by: Stephanie Wang <swang@cs.berkeley.edu>
stephanie-wang added a commit to stephanie-wang/ray that referenced this pull request Oct 23, 2023
ray-project#40248 changed output block creation so that when a task produces its output blocks, it will try to slice them before yielding to respect the target block size. Unfortunately, all-to-all ops currently don't support dynamic block splitting. This means that if we try to fuse an upstream map iterator with an all-to-all op, the all-to-all task will still have to fuse all of the sliced blocks back together again. This seems to increase memory usage significantly.

This PR avoids this issue by overriding the upstream map iterator's target block size to infinity when it is fused with an all-to-all op. This also adds a logger warning for how to workaround.
Related issue number

Closes ray-project#40518.

---------

Signed-off-by: Stephanie Wang <swang@cs.berkeley.edu>
vitsai pushed a commit that referenced this pull request Oct 24, 2023
#40248 changed output block creation so that when a task produces its output blocks, it will try to slice them before yielding to respect the target block size. Unfortunately, all-to-all ops currently don't support dynamic block splitting. This means that if we try to fuse an upstream map iterator with an all-to-all op, the all-to-all task will still have to fuse all of the sliced blocks back together again. This seems to increase memory usage significantly.

This PR avoids this issue by overriding the upstream map iterator's target block size to infinity when it is fused with an all-to-all op. This also adds a logger warning for how to workaround.
Related issue number

Closes #40518.

---------

Signed-off-by: Stephanie Wang <swang@cs.berkeley.edu>
can-anyscale pushed a commit that referenced this pull request Oct 30, 2023
This addresses #40759 and #38400 for the 2.8 release branch. This change OR reverting #40248 seems to fix #40759, but the root cause has not been identified yet. For #38400, we will merge a longer-term fix to master for 2.9.

This PR should be safe since it reverts Data block size back to the 2.7 default.

Signed-off-by: Stephanie Wang <swang@cs.berkeley.edu>
stephanie-wang added a commit that referenced this pull request Nov 1, 2023
With #40248, block sizes are now respected. This increases the default shuffle block size to 1GiB, which restores the previous behavior in the release test dataset_shuffle_sort_1tb. There is a possibility that this increases worker heap memory pressure during shuffle operations, but it can be resolved by overriding DataContext.

Related issue number

Closes #38400.

---------

Signed-off-by: Stephanie Wang <swang@cs.berkeley.edu>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Nov 29, 2023
With ray-project#40248, block sizes are now respected. This increases the default shuffle block size to 1GiB, which restores the previous behavior in the release test dataset_shuffle_sort_1tb. There is a possibility that this increases worker heap memory pressure during shuffle operations, but it can be resolved by overriding DataContext.

Related issue number

Closes ray-project#38400.

---------

Signed-off-by: Stephanie Wang <swang@cs.berkeley.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants