Extend inferenceService API for Accelerator Support#258
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @pallasathena92, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly extends the InferenceService API to provide robust support for accelerator selection. It empowers users to define precise requirements and preferences for the accelerators used by their model deployments, offering both explicit selection and constraint-based filtering. This enhancement aims to improve resource utilization and operational flexibility for AI/ML workloads, with all new parameters being optional to ensure backward compatibility.
Highlights
- Enhanced Accelerator Selection: Introduced a new "acceleratorSelector" field within "InferenceServiceSpec" allowing users to specify accelerator preferences, including explicit "AcceleratorClass" selection or constraint-based filtering.
- Detailed Accelerator Constraints: Added "AcceleratorConstraints" with fields for "MinMemory", "MaxMemory", "MinComputeCapability", "RequiredFeatures", "ExcludedClasses", and "ArchitectureFamilies" to enable fine-grained control over accelerator selection.
- Flexible Selection Policies: Implemented "AcceleratorSelectionPolicy" with options like "BestFit", "Cheapest", "MostCapable", and "FirstAvailable" to define how accelerators are chosen when multiple options meet the criteria.
- Component-Level Accelerator Overrides: Included "acceleratorOverride" fields in "EngineSpec" and "DecoderSpec" to allow specific components of an InferenceService to use different accelerator selections than the global service-level setting.
- Accelerator Status Reporting: Added "SelectedAccelerator" to "ComponentStatusSpec" to provide visibility into which accelerator was ultimately selected for a component, along with the reason, node selector, and resource requests.
- CRD Integration: Integrated the new "AcceleratorClass" CRD into the kustomization configurations, laying the groundwork for defining and managing accelerator resources within the cluster.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces a well-designed API for accelerator selection in InferenceService, which is a great feature. The use of AcceleratorSelector with constraints and policies provides good flexibility for users.
I have a few suggestions to improve the API's consistency with Kubernetes conventions. These involve using fixed-width integer types for resource constraints and adopting the standard v1.ResourceList for resource requests in the status. These changes will require regenerating the deepcopy and OpenAPI files.
| // ResourceRequests that were applied to pods | ||
| // +optional | ||
| ResourceRequests map[string]string `json:"resourceRequests,omitempty"` |
There was a problem hiding this comment.
The ResourceRequests field should use the standard Kubernetes type v1.ResourceList instead of map[string]string to represent resource requests. This provides a structured way to handle resource quantities and is consistent with the rest of the Kubernetes API.
| // ResourceRequests that were applied to pods | |
| // +optional | |
| ResourceRequests map[string]string `json:"resourceRequests,omitempty"` | |
| // ResourceRequests that were applied to pods | |
| // +optional | |
| ResourceRequests v1.ResourceList `json:"resourceRequests,omitempty"` |
| // MinMemory in GB | ||
| // +optional | ||
| MinMemory *int `json:"minMemory,omitempty"` |
There was a problem hiding this comment.
For consistency with other API fields and to avoid platform-dependent integer sizes, it's better to use *int64 instead of *int for MinMemory.
| // MinMemory in GB | |
| // +optional | |
| MinMemory *int `json:"minMemory,omitempty"` | |
| // MinMemory in GB | |
| // +optional | |
| MinMemory *int64 `json:"minMemory,omitempty"` |
| // MaxMemory in GB (useful for cost control) | ||
| // +optional | ||
| MaxMemory *int `json:"maxMemory,omitempty"` |
There was a problem hiding this comment.
For consistency with other API fields and to avoid platform-dependent integer sizes, it's better to use *int64 instead of *int for MaxMemory.
| // MaxMemory in GB (useful for cost control) | |
| // +optional | |
| MaxMemory *int `json:"maxMemory,omitempty"` | |
| // MaxMemory in GB (useful for cost control) | |
| // +optional | |
| MaxMemory *int64 `json:"maxMemory,omitempty"` |
| // MinComputeCapability in TFLOPS | ||
| // +optional | ||
| MinComputeCapability *int `json:"minComputeCapability,omitempty"` |
There was a problem hiding this comment.
For consistency with other API fields and to avoid platform-dependent integer sizes, it's better to use *int64 instead of *int for MinComputeCapability.
| // MinComputeCapability in TFLOPS | |
| // +optional | |
| MinComputeCapability *int `json:"minComputeCapability,omitempty"` | |
| // MinComputeCapability in TFLOPS | |
| // +optional | |
| MinComputeCapability *int64 `json:"minComputeCapability,omitempty"` |
add api inference extension with acceleratorClass
What type of PR is this?
/kind feature
/kind design
What this PR does / why we need it:
Users need a way to specify which accelerators their InferenceService should use. This can range from simple preferences (e.g., "use cheapest GPU") to specific requirements (e.g., "must use H100"). The API should support both explicit selection and constraint-based selection.
Add accelerator selection capabilities to the InferenceService API, allowing users to specify accelerator preferences and constraints for their model deployments.
Does this PR introduce a user-facing change?
It introduced some new parameters in inferenceService. All these parameters with optional marker, it won't impact current customer behavior.