Skip to content

Don't swallow KeyboardInterrupt/SystemExit in NPUOpBuilder#8096

Merged
delock merged 1 commit into
deepspeedai:masterfrom
ajinkyajawale14499:fix/npu-builder-no-swallow-interrupt
Jun 29, 2026
Merged

Don't swallow KeyboardInterrupt/SystemExit in NPUOpBuilder#8096
delock merged 1 commit into
deepspeedai:masterfrom
ajinkyajawale14499:fix/npu-builder-no-swallow-interrupt

Conversation

@ajinkyajawale14499

Copy link
Copy Markdown
Contributor

Addresses #8093.

NPUOpBuilder.__init__ wraps installed_cann_version() in except BaseException:, which also catches KeyboardInterrupt and SystemExit and 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-except clause in the codebase. The except Exception: clauses do not catch KeyboardInterrupt/SystemExit (those are BaseException, not Exception), 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.

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 delock enabled auto-merge June 29, 2026 06:33
@delock delock added this pull request to the merge queue Jun 29, 2026
Merged via the queue into deepspeedai:master with commit 10f76c2 Jun 29, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants