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] Enable optimizer by default #34937

Closed
wants to merge 51 commits into from

Conversation

scottjlee
Copy link
Contributor

@scottjlee scottjlee commented May 2, 2023

Why are these changes needed?

This PR enables the execution plan optimizer in Ray Data, and fixes some bugs discovered via unit tests. We will ensure that Data CI and release tests are healthy before merging.

Related issue number

Closes #32596

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 :(

Scott Lee and others added 24 commits May 1, 2023 21:21
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
wip
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Scott Lee <sjl@anyscale.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
@raulchen raulchen marked this pull request as ready for review May 15, 2023 21:46
@raulchen raulchen requested review from ericl and scv119 as code owners May 15, 2023 21:46
# Used for caching user-defined callable classes.
# Key the class, value is the object.
# see make_callable_class_concurrent in python/ray/data/_internal/execution/util.py.
# The reason why this is a dict is because we may fuse multiple map operators into one.
Copy link
Contributor

@ericl ericl May 16, 2023

Choose a reason for hiding this comment

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

Do we actually fuse multiple actors into one? I don't think we do that / should do that.

Using a dict is a bit concerning since we could leak closures over time, compared to a singleton that is overwritten.

input_files=[],
exec_stats=None,
),
read_task.get_metadata(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you make sure this calls cleaned_metadata(read_task) in legacy_compat.py to implement the same logic?

_assert_has_stages(ds._plan._last_optimized_stages, ["ReadRange->Map"])


def test_optimize_reorder(ray_start_regular_shared):
# The ReorderRandomizeBlocksRule optimizer rule collapses RandomizeBlocks operators,
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it still show up in the stage names?

@ericl ericl added the @author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer. label May 16, 2023
raulchen added 16 commits May 16, 2023 15:48
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
@raulchen
Copy link
Contributor

raulchen commented May 23, 2023

As this PR is getting huge, I'll split it into a few small PRs: the first two are #35621 and #35648.

Other known issues not fixed in these 2 PRs include:

  • Actors with the same class & args can be fused when not enabling optimizer, but not fused when enabling optimizer (need to identify necessity).
  • __repr__() and stats() are different.
  • Some config flags (i.e., context.optimize_fuse_read_stages) are not respected.

@raulchen raulchen closed this May 23, 2023
raulchen added a commit that referenced this pull request May 31, 2023
## Why are these changes needed?

This PR is the 1st part of enabling optimizer by default (split from #34937).

- Fix inconsistent behaviors for the Read op by reusing the `ReadTask`s from `read_api.py` in `plan_read_op.py`.
- Support cache in `materialize`.

Note, some changes in this PR may not be covered in this PR's CI, as the optimizer must be enabled to cover them. But they are already verified in #34937 CI).

## Related issue number

#32596
raulchen added a commit that referenced this pull request May 31, 2023
## Why are these changes needed?

This PR is the 2nd part of enabling optimizer by default (split from #34937). 
It fixes the following issues:
- `ray_remote_args` not correctly set for a fused operator.
- `init_fn` not correctly set for a fused operator.
- Allowed cases for fusion (see `operator_fusion.py`).
- `ray_remote_args` compatibility check for fusion.
- Limit operator not handled when converting logical operator to physical.
- Other small fixes.

Note, some changes in this PR may not be covered in this PR's CI, as the optimizer must be enabled to cover them. But they are already verified in #34937's CI).

## Related issue number

#32596
scv119 pushed a commit to scv119/ray that referenced this pull request Jun 16, 2023
…5648)

## Why are these changes needed?

This PR is the 1st part of enabling optimizer by default (split from ray-project#34937).

- Fix inconsistent behaviors for the Read op by reusing the `ReadTask`s from `read_api.py` in `plan_read_op.py`.
- Support cache in `materialize`.

Note, some changes in this PR may not be covered in this PR's CI, as the optimizer must be enabled to cover them. But they are already verified in ray-project#34937 CI).

## Related issue number

ray-project#32596
scv119 pushed a commit to scv119/ray that referenced this pull request Jun 16, 2023
## Why are these changes needed?

This PR is the 2nd part of enabling optimizer by default (split from ray-project#34937). 
It fixes the following issues:
- `ray_remote_args` not correctly set for a fused operator.
- `init_fn` not correctly set for a fused operator.
- Allowed cases for fusion (see `operator_fusion.py`).
- `ray_remote_args` compatibility check for fusion.
- Limit operator not handled when converting logical operator to physical.
- Other small fixes.

Note, some changes in this PR may not be covered in this PR's CI, as the optimizer must be enabled to cover them. But they are already verified in ray-project#34937's CI).

## Related issue number

ray-project#32596
arvind-chandra pushed a commit to lmco/ray that referenced this pull request Aug 31, 2023
…5648)

## Why are these changes needed?

This PR is the 1st part of enabling optimizer by default (split from ray-project#34937).

- Fix inconsistent behaviors for the Read op by reusing the `ReadTask`s from `read_api.py` in `plan_read_op.py`.
- Support cache in `materialize`.

Note, some changes in this PR may not be covered in this PR's CI, as the optimizer must be enabled to cover them. But they are already verified in ray-project#34937 CI).

## Related issue number

ray-project#32596

Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
arvind-chandra pushed a commit to lmco/ray that referenced this pull request Aug 31, 2023
## Why are these changes needed?

This PR is the 2nd part of enabling optimizer by default (split from ray-project#34937).
It fixes the following issues:
- `ray_remote_args` not correctly set for a fused operator.
- `init_fn` not correctly set for a fused operator.
- Allowed cases for fusion (see `operator_fusion.py`).
- `ray_remote_args` compatibility check for fusion.
- Limit operator not handled when converting logical operator to physical.
- Other small fixes.

Note, some changes in this PR may not be covered in this PR's CI, as the optimizer must be enabled to cover them. But they are already verified in ray-project#34937's CI).

## Related issue number

ray-project#32596

Signed-off-by: e428265 <arvind.chandramouli@lmco.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Datasets] Enabling execution optimizer after passing all CI and nightly tests
5 participants