Skip to content

[Mics]skip accelerator class getting if not name and policy specified#512

Merged
pallasathena92 merged 1 commit into
mainfrom
yifeliu/ac-policy-remove-default
Jan 24, 2026
Merged

[Mics]skip accelerator class getting if not name and policy specified#512
pallasathena92 merged 1 commit into
mainfrom
yifeliu/ac-policy-remove-default

Conversation

@pallasathena92
Copy link
Copy Markdown
Collaborator

@pallasathena92 pallasathena92 commented Jan 24, 2026

What this PR does

Update the logic to choose accelerator class.

Why we need it

Current behavior

AcceleratorClass (AC) selection follows this order:

Explicit AC name: If the user specifies an acceleratorClassName, the system uses that AC directly.

Policy-based selection: If no AC name is provided, the system selects an AC based on the configured policy.

Default policy: If no policy is configured, the system defaults to FirstAvailable, meaning it will still select an AC automatically.

Proposed behavior

To give customers the option to opt out of AcceleratorClass selection entirely, we change the default behavior:

Explicit AC name: If the user specifies an acceleratorClassName, the system uses that AC directly.

Policy-based selection: If no AC name is provided, the system selects an AC based on the configured policy.

No implicit default: If no policy is configured, the system does not select any AC (i.e., no AcceleratorClass is applied by default).
Fixes #

How to test

Checklist

  • Tests added/updated (if applicable)
  • Docs updated (if applicable)
  • make test passes locally

@github-actions github-actions Bot added inferenceservice InferenceService controller changes controller Controller changes accelerator Accelerator class changes labels Jan 24, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

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 refines the AcceleratorClass selection mechanism to provide users with more explicit control. It removes the previous implicit default behavior where an accelerator class would be automatically selected if no name or policy was provided. Now, if neither an explicit name nor a selection policy is configured, no AcceleratorClass will be applied, allowing users to opt out of accelerator class selection entirely.

Highlights

  • Accelerator Class Selection Logic Update: The logic for selecting an AcceleratorClass has been updated to prevent automatic selection when neither an explicit accelerator class name nor a policy is specified. Previously, a 'FirstAvailable' policy would be applied by default.
  • Removal of Default Policy Configuration: The DefaultPolicy field has been removed from the Config struct in the accelerator class selector, eliminating the implicit 'FirstAvailablePolicy' fallback.
  • Refactored Policy Retrieval: The getAcceleratorClassByPolicy function now directly accepts the acceleratorPolicy as an argument, and the main GetAcceleratorClass function explicitly checks for the presence of a policy before attempting policy-based selection.
  • Enhanced Logging: Informational log messages have been added to the InferenceService reconciler to indicate when no accelerator class is specified for the engine or decoder components.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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

  1. 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.

Copy link
Copy Markdown
Contributor

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

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 successfully updates the accelerator class selection logic to be an opt-in feature, which is a great improvement for users who want to manage this behavior explicitly. The changes are well-implemented by removing the default policy and refactoring the selection logic for better clarity. My review includes a few suggestions to enhance logging consistency and improve a code comment for better maintainability.


// getAcceleratorPolicy determines the effective AcceleratorSelectionPolicy for the given component and InferenceService
// defaulting to the selector's configured default policy if none is specified
// if none is specified, will skip getAcceleratorClassByPolicy
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.

medium

This comment describes the behavior of the calling function, not getAcceleratorPolicy itself. It would be clearer to describe what this function does when no policy is found.

A more accurate comment would be:

// If no policy is specified, an empty string is returned.
Suggested change
// if none is specified, will skip getAcceleratorClassByPolicy
// If no policy is specified, an empty string is returned.

return reconcile.Result{}, err
}
if engineAC == nil {
r.Log.Info("Accelerator class not specified for engine component", "Name", isvc.Name)
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.

medium

For consistency with other log statements in this file (e.g., line 299), it's better to use "inferenceService" as the key for the inference service name instead of "Name".

Suggested change
r.Log.Info("Accelerator class not specified for engine component", "Name", isvc.Name)
r.Log.Info("Accelerator class not specified for engine component", "inferenceService", isvc.Name)

return reconcile.Result{}, err
}
if decoderAC == nil {
r.Log.Info("Accelerator class not specified for decoder component", "Name", isvc.Name)
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.

medium

For consistency with other log statements in this file (e.g., line 330), it's better to use "inferenceService" as the key for the inference service name instead of "Name".

Suggested change
r.Log.Info("Accelerator class not specified for decoder component", "Name", isvc.Name)
r.Log.Info("Accelerator class not specified for decoder component", "inferenceService", isvc.Name)

@pallasathena92 pallasathena92 force-pushed the yifeliu/ac-policy-remove-default branch from 5039574 to d162a8e Compare January 24, 2026 01:55
@pallasathena92 pallasathena92 merged commit 8bee60b into main Jan 24, 2026
29 checks passed
@pallasathena92 pallasathena92 deleted the yifeliu/ac-policy-remove-default branch January 24, 2026 05:53
XinyueZhang369 pushed a commit that referenced this pull request Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accelerator Accelerator class changes controller Controller changes inferenceservice InferenceService controller changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants