Skip to content

Add 'NPU' to the runtime exception message in get_device#14225

Merged
ping1jing2 merged 2 commits intosgl-project:mainfrom
rauletorresc:rauletorresc-patch-1
Dec 4, 2025
Merged

Add 'NPU' to the runtime exception message in get_device#14225
ping1jing2 merged 2 commits intosgl-project:mainfrom
rauletorresc:rauletorresc-patch-1

Conversation

@rauletorresc
Copy link
Contributor

@rauletorresc rauletorresc commented Dec 1, 2025

Motivation

Although get_device also checks for support for NPU devices, if no NPU is available the runtime exception messages only reports CUDA, XPU and HPU devices.

Modifications

Add NPU to the list of unavailable devices in the runtime exception message.

Accuracy Tests

Not applicable.

Benchmarking and Profiling

Not applicable.

Checklist

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @rauletorresc, 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 enhances the user experience by improving the specificity of error messages within the get_device function. By explicitly mentioning NPUs alongside CUDA, XPU, and HPU in the 'No accelerator available' runtime error, the change provides more comprehensive and accurate feedback to users when their system lacks the required hardware, aligning the error message with the function's underlying device detection logic.

Highlights

  • Error Message Enhancement: The runtime exception message in the get_device function has been updated to include 'NPU' (Neural Processing Unit) in the list of unavailable accelerators. This ensures that if an NPU device is not found, the error message accurately reflects all checked device types.
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
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

The pull request successfully adds 'NPU' to the runtime exception message in the get_device function, improving clarity when an NPU accelerator is not available. The change is straightforward and directly addresses the motivation outlined in the pull request description.

@ping1jing2 ping1jing2 self-assigned this Dec 2, 2025
@ping1jing2
Copy link
Collaborator

/tag-and-rerun-ci

@ping1jing2 ping1jing2 merged commit 29a2d4b into sgl-project:main Dec 4, 2025
183 of 187 checks passed
yingluosanqian pushed a commit to yingluosanqian/sglang that referenced this pull request Dec 4, 2025
…ct#14225)

Co-authored-by: ronnie_zheng <zl19940307@163.com>
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 5, 2025
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 5, 2025
yuchengz816-bot pushed a commit to yuchengz816-bot/sglang that referenced this pull request Dec 8, 2025
Kevin-XiongC pushed a commit to novitalabs/sglang that referenced this pull request Dec 9, 2025
GuoYechang pushed a commit to GuoYechang/sglang that referenced this pull request Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments