Don't swallow KeyboardInterrupt/SystemExit in NPUOpBuilder#8096
Merged
delock merged 1 commit intoJun 29, 2026
Merged
Conversation
installed_cann_version() was wrapped in `except BaseException`, which also swallows KeyboardInterrupt/SystemExit and prints a misleading 'ascend_cann is missing' message. Use `except Exception` so normal failures are still handled but interrupts propagate. Addresses deepspeedai#8093. Signed-off-by: ajinkyajawale14499 <26092430+ajinkyajawale14499@users.noreply.github.com>
delock
approved these changes
Jun 29, 2026
Merged
via the queue into
deepspeedai:master
with commit Jun 29, 2026
10f76c2
14 of 16 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #8093.
NPUOpBuilder.__init__wrapsinstalled_cann_version()inexcept BaseException:, which also catchesKeyboardInterruptandSystemExitand then prints"... ascend_cann is missing, npu ops cannot be compiled!". So hitting Ctrl+C during that call is silently swallowed and turned into a misleading message.This changes it to
except Exception:, which still catches every normal failure mode (missing CANN path, env var, or version lookup error) but lets interrupts propagate.Scope note: this is the only
BaseException/bare-exceptclause in the codebase. Theexcept Exception:clauses do not catchKeyboardInterrupt/SystemExit(those areBaseException, notException), so they are out of scope for this specific impact. Narrowing those to more specific types would be a separate, larger change.pre-commit (yapf / flake8 / codespell / license) passes.