Skip to content

[core][gpu-objects] Fix the performance regression by clearing object_ref for small and non-GPU objects#53692

Merged
stephanie-wang merged 7 commits intoray-project:masterfrom
kevin85421:20250605-devbox-2-tmux10-ray
Jun 10, 2025
Merged

[core][gpu-objects] Fix the performance regression by clearing object_ref for small and non-GPU objects#53692
stephanie-wang merged 7 commits intoray-project:masterfrom
kevin85421:20250605-devbox-2-tmux10-ray

Conversation

@kevin85421
Copy link
Copy Markdown
Member

@kevin85421 kevin85421 commented Jun 10, 2025

Why are these changes needed?

This PR is based on #53630.

See #53623 for the issue. In this PR, we clear the object ref when the arg's tensor transport is not OBJECT_STORE.

Related issue number

Closes #53623

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

stephanie-wang and others added 3 commits June 9, 2025 20:31
Signed-off-by: Stephanie wang <smwang@cs.washington.edu>
Signed-off-by: Kai-Hsun Chen <kaihsun@anyscale.com>
Signed-off-by: Kai-Hsun Chen <kaihsun@anyscale.com>
@kevin85421 kevin85421 added the go add ONLY when ready to merge, run all tests label Jun 10, 2025
@kevin85421
Copy link
Copy Markdown
Member Author

The regression was fixed.

https://buildkite.com/ray-project/release/builds/45142#019758ea-6d72-4590-a80c-d43a2ecaf2f2

success = 1
--
  | stage_0_time = 7.095437526702881
  | stage_1_time = 125.6585624217987
  | stage_1_avg_iteration_time = 12.565850567817687
  | stage_1_max_iteration_time = 12.910065412521362
  | stage_1_min_iteration_time = 11.427676439285278
  | stage_2_time = 168.93659591674805
  | stage_2_avg_iteration_time = 33.787201929092404
  | stage_2_max_iteration_time = 34.26388764381409
  | stage_2_min_iteration_time = 33.193145990371704
  | stage_3_creation_time = 1.903125524520874
  | stage_3_time = 1813.0130867958069
  | stage_4_spread = 0.7813597517227632

Signed-off-by: Kai-Hsun Chen <kaihsun@anyscale.com>
Signed-off-by: Kai-Hsun Chen <kaihsun@anyscale.com>
@kevin85421 kevin85421 marked this pull request as ready for review June 10, 2025 17:53
Copilot AI review requested due to automatic review settings June 10, 2025 17:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a performance regression in handling small and non-GPU objects by conditionally clearing the object_ref based on the tensor transport. The changes introduce a new TensorTransportGetter parameter across task submitters, dependency resolvers, and reference counting components while updating tests and mocks accordingly.

  • Introduced TensorTransportGetter to determine whether to clear the object reference.
  • Updated constructors and function signatures in production and test files.
  • Added tests to validate behavior for mixed tensor transports.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/ray/core_worker/transport/normal_task_submitter.h Added TensorTransportGetter to the constructor and passed it to the resolver.
src/ray/core_worker/transport/dependency_resolver.h Introduced TensorTransportGetter type and stored it for dependency resolution.
src/ray/core_worker/transport/dependency_resolver.cc Updated InlineDependencies to use the new tensor transport check before clearing object_ref.
src/ray/core_worker/transport/actor_task_submitter.h Injected TensorTransportGetter into the actor task submitter.
src/ray/core_worker/test/normal_task_submitter_test.cc Updated tests to provide a lambda returning OBJECT_STORE for tensor transport.
src/ray/core_worker/test/direct_actor_transport_mock_test.cc Updated ActorTaskSubmitter instantiation in tests with the new parameter.
src/ray/core_worker/test/dependency_resolver_test.cc Modified LocalDependencyResolver instantiation and added tests for mixed tensor transports.
src/ray/core_worker/test/actor_task_submitter_test.cc Added TensorTransportGetter in test instantiation.
src/ray/core_worker/task_manager.cc Propagated the tensor transport value when adding pending tasks.
src/ray/core_worker/reference_count.h and reference_count.cc Updated object ownership functions with the new tensor_transport parameter and added accessor for tensor transport.
src/ray/core_worker/core_worker.cc Modified ActorTaskSubmitter construction and lease submitter instantiation with the new tensor transport logic.
src/mock/ray/core_worker/reference_count.h Updated mock method signature for AddOwnedObject to match the new parameters.

ASSERT_EQ(resolver.NumPendingTasks(), 0);
}

TEST(LocalDependencyResolverTest, TestMixedTensorTransport) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

unit test for this PR

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.

Nice, thanks for adding this.

kevin85421 and others added 2 commits June 10, 2025 14:06
Co-authored-by: Stephanie Wang <swang@cs.berkeley.edu>
Signed-off-by: Kai-Hsun Chen <kaihsun@apache.org>
Signed-off-by: Kai-Hsun Chen <kaihsun@anyscale.com>
@stephanie-wang stephanie-wang enabled auto-merge (squash) June 10, 2025 21:09
@stephanie-wang stephanie-wang merged commit 0001908 into ray-project:master Jun 10, 2025
6 checks passed
elliot-barn pushed a commit that referenced this pull request Jun 18, 2025
…t_ref` for small and non-GPU objects (#53692)

This PR is based on #53630.

See #53623 for the issue. In this PR, we clear the object ref when the
arg's tensor transport is not OBJECT_STORE.

Closes #53623
---------

Signed-off-by: Stephanie wang <smwang@cs.washington.edu>
Signed-off-by: Kai-Hsun Chen <kaihsun@anyscale.com>
Signed-off-by: Kai-Hsun Chen <kaihsun@apache.org>
Co-authored-by: Stephanie wang <smwang@cs.washington.edu>
Co-authored-by: Stephanie Wang <swang@cs.berkeley.edu>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Jul 2, 2025
…t_ref` for small and non-GPU objects (#53692)

This PR is based on #53630.

See #53623 for the issue. In this PR, we clear the object ref when the
arg's tensor transport is not OBJECT_STORE.

Closes #53623
---------

Signed-off-by: Stephanie wang <smwang@cs.washington.edu>
Signed-off-by: Kai-Hsun Chen <kaihsun@anyscale.com>
Signed-off-by: Kai-Hsun Chen <kaihsun@apache.org>
Co-authored-by: Stephanie wang <smwang@cs.washington.edu>
Co-authored-by: Stephanie Wang <swang@cs.berkeley.edu>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.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.

[core][gpu-objects] Performance regression caused by transferring object references for small objects

3 participants