Skip to content

Do not let one op builder's compatibility probe break importing deepspeed - #8216

Open
adityasingh2400 wants to merge 4 commits into
deepspeedai:masterfrom
adityasingh2400:fix-op-builder-compat-probe
Open

Do not let one op builder's compatibility probe break importing deepspeed#8216
adityasingh2400 wants to merge 4 commits into
deepspeedai:masterfrom
adityasingh2400:fix-op-builder-compat-probe

Conversation

@adityasingh2400

Copy link
Copy Markdown
Contributor

Fixes #7452

Importing deepspeed probes every op for build compatibility in git_version_info.py, whether or not the caller will ever build that op. Nothing catches a probe that fails, so on a machine with a visible GPU but no CUDA toolkit the CUDA op builders raise MissingCUDAException out of is_compatible() and import deepspeed fails outright, even for a sharding only workload that needs no custom ops. ds_report fails the same way. That is the nvcc assumption reported in the issue.

This adds probe_is_compatible, which reports an op whose probe fails as not compatible and prints why, and uses it in the two places that scan every op: the import time scan and the ds_report table.

It also makes installed_cuda_version raise MissingCUDAException when nvcc cannot be run. CUDA_HOME regularly points at a runtime only install with no nvcc under bin, and the raw FileNotFoundError from that case slipped past the two except MissingCUDAException handlers already in builder.py that fall back to a CPU only build.

Verification: added three tests to tests/unit/ops/test_op_builder.py covering a runtime only CUDA_HOME, a probe that raises, and a probe that answers. All 16 tests in that file pass, with the pre-existing CUDA fork test skipped for lack of a GPU. The new tests fail against the unmodified code, and I confirmed separately that installed_cuda_version raised FileNotFoundError rather than MissingCUDAException before the change. yapf and flake8 are clean on the changed files.

…peed

Importing deepspeed probes every op for build compatibility, whether or not the
caller will ever build that op. Nothing catches a probe that fails, so on a machine
with a visible GPU but no CUDA toolkit the CUDA op builders raise
MissingCUDAException out of is_compatible() and import deepspeed fails outright,
even for a sharding only workload that needs no custom ops. ds_report fails the same
way. This is the nvcc assumption reported in deepspeedai#7452.

Add probe_is_compatible, which reports an op whose probe fails as not compatible and
prints why, and use it for the two places that scan every op: the import time scan in
git_version_info and the ds_report table.

Also make installed_cuda_version raise MissingCUDAException when nvcc cannot be run.
CUDA_HOME regularly points at a runtime only install with no nvcc under bin, and the
raw FileNotFoundError from that case slipped past the two except MissingCUDAException
handlers in builder.py that already fall back to a CPU only build.

Fixes deepspeedai#7452

Signed-off-by: Aditya Singh <adisin650@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 866c2c96ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread op_builder/builder.py
@sfc-gh-truwase

Copy link
Copy Markdown
Collaborator

@adityasingh2400 thanks for the PR. How did this issue come up?

@sfc-gh-truwase

Copy link
Copy Markdown
Collaborator

@adityasingh2400 thanks for the PR. How did this issue come up?

Never mind, I just noticed the linked issue. Thanks!

@adityasingh2400

Copy link
Copy Markdown
Contributor Author

The DeepSpeedAI CI red on the merge commit looks like a runner resource problem rather than a test failure.

The run ends with RuntimeError: run pytest failed with exit code 137, which is SIGKILL, and it died about 20 percent of the way through the suite. There are no FAILED <test> lines and no assertion errors anywhere in the log, every test that reported before the kill passed. That reads as the runner being OOM killed mid-run.

Nothing in this change should move memory use either, it only wraps an op builder's is_compatible() probe in a try/except so one builder raising cannot abort the import.

Thanks for merging master in. A re-run is probably all it needs, but shout if you would rather I did something on my side.

@sfc-gh-truwase
sfc-gh-truwase added this pull request to the merge queue Aug 6, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 6, 2026
@sfc-gh-truwase
sfc-gh-truwase added this pull request to the merge queue Aug 6, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 6, 2026
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.

[REQUEST] Defer detection of op builder compatibility until build time

3 participants