Skip to content

[Serve][1/N] Add Serve accelerator config schemas - #63581

Closed
ryanaoleary wants to merge 10 commits into
ray-project:masterfrom
ryanaoleary:e-serve-accelerator-config-frontend
Closed

[Serve][1/N] Add Serve accelerator config schemas#63581
ryanaoleary wants to merge 10 commits into
ray-project:masterfrom
ryanaoleary:e-serve-accelerator-config-frontend

Conversation

@ryanaoleary

Copy link
Copy Markdown
Contributor

Description

PR split from #63179 based on this comment: #63179 (review). This PR contains just the new AcceleratorConfig schemas and the plumbing through @serve.deployment, Deployment.options, DeploymentSchema and the serve proto. This PR should be merged first, since the other PR contains these same changes.

Related issues

#57137

Additional information

Optional: Add implementation details, API changes, usage examples, screenshots, etc.

Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
…unit tests

Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
@ryanaoleary
ryanaoleary force-pushed the e-serve-accelerator-config-frontend branch from 50c9d2d to 6d6540c Compare May 21, 2026 19:58

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request introduces AcceleratorConfig and TPUAcceleratorConfig to Ray Serve, enabling structured hardware accelerator specifications for deployments, with an initial focus on TPU support. The changes span configuration models, protobuf definitions, and the deployment API, including validation logic to enforce mutual exclusivity between accelerator_config and gang_scheduling_config. Review feedback highlights an opportunity to improve security and cross-version compatibility by using JSON serialization instead of cloudpickle for the new configuration fields. Additionally, it is recommended to standardize the error messages for mutual exclusivity checks across the API, deployment, and schema modules for better consistency.

Comment thread python/ray/serve/_private/config.py Outdated
Comment thread python/ray/serve/_private/config.py Outdated
Comment thread python/ray/serve/deployment.py
Comment thread python/ray/serve/schema.py
ryanaoleary and others added 3 commits May 21, 2026 13:02
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Ryan O'Leary <113500783+ryanaoleary@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Ryan O'Leary <113500783+ryanaoleary@users.noreply.github.com>
Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
Comment thread src/ray/protobuf/serve.proto Outdated

@jeffreywang88 jeffreywang88 left a comment

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.

can we add some tests for the followings?

  • YAML/CLI integration tests : example
  • serve deployment decorator unit tests: example
  • .options unit tests: example

Comment thread python/ray/serve/_private/config.py
Comment thread python/ray/serve/tests/unit/test_config.py
Comment thread python/ray/serve/config.py
Comment thread python/ray/serve/config.py
Comment thread python/ray/serve/config.py
Comment thread src/ray/protobuf/serve.proto Outdated
optional double rolling_update_percentage = 23;

// Serialized representation of AcceleratorConfig.
bytes accelerator_config = 24;

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.

Let's prefer a typed AcceleratorConfig message with a oneof for subtypes rather than bytes.

Suggested change
bytes accelerator_config = 24;
AcceleratorConfig accelerator_config = 24;
  message AcceleratorConfig {
    oneof config {
      TPUAcceleratorConfig tpu = 1;
    }
  }

  message TPUAcceleratorConfig {
    string topology            = 1;
    string accelerator_version = 2;
    int32  num_slices          = 3;
    optional int32 chips_per_vm = 4;
    map<string, double> resources_per_bundle = 5;
  }

@jeffreywang88 jeffreywang88 May 21, 2026

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.

we may need to adjust how to encode/decode the proto field in config.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done in 14c0807, they're now proto messages and we encode it like serve_pb2.TPUAcceleratorConfig

…alidation and expanded unit tests

Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
@ryanaoleary

ryanaoleary commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

can we add some tests for the followings?
YAML/CLI integration tests : example
serve deployment decorator unit tests: example
.options unit tests: example

added coverage for each in 14c0807

Signed-off-by: Ryan O'Leary <113500783+ryanaoleary@users.noreply.github.com>
@ryanaoleary
ryanaoleary requested a review from jeffreywang88 May 21, 2026 22:32
Comment thread python/ray/serve/_private/config.py
Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 70bdeae. Configure here.

Comment thread python/ray/serve/api.py Outdated
@jeffreywang88 jeffreywang88 added the go add ONLY when ready to merge, run all tests label May 21, 2026
Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
@ray-gardener ray-gardener Bot added serve Ray Serve Related Issue community-contribution Contributed by the community labels May 22, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Jun 5, 2026
@ryanaoleary

Copy link
Copy Markdown
Contributor Author

From offline discussion we're favoring implementing ray-project/enhancements#66 so that serve.deployment can consume standard PG APIs rather than abstracting away custom PG reservation logic through the implementation in these PRs.

The AcceleratorConfig logic from these PRs can instead be implemented as a utility that return the bundles, bundle_label-selector, topology_strategy, etc. for a given topology and accelerator_type. Users can then passed the returned values to the serve.deployment1 options.

Going to close these PRs and follow-up on the above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community go add ONLY when ready to merge, run all tests serve Ray Serve Related Issue stale The issue is stale. It will be closed within 7 days unless there are further conversation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants