fix: surface deep_gemm load failures instead of silently disabling FP8#2803
Draft
S1ro1 wants to merge 1 commit into
Draft
fix: surface deep_gemm load failures instead of silently disabling FP8#2803S1ro1 wants to merge 1 commit into
S1ro1 wants to merge 1 commit into
Conversation
`import deep_gemm` was wrapped in a bare `except ImportError: deep_gemm = None`. That correctly handles CPU-only environments (module not installed), but it also swallows a genuine load failure — deep_gemm present but its CUDA libs unresolved (e.g. a wheel linking libcudart.so.13 on a CUDA 12 host). The import silently sets None and the failure resurfaces much later, in the first FP8 forward, as a misleading `AttributeError: 'NoneType' object has no attribute 'fp8_gemm_nt'`. Narrow the except to `ModuleNotFoundError` so "not installed" still falls back to None, while a broken native load propagates with its real cause (the missing .so), making the misconfiguration obvious at import time. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
fp8_linear.pywraps the deep_gemm import in a bareexcept ImportError:This is meant to support CPU-only environments where deep_gemm isn't installed. But
ImportErroralso fires when deep_gemm is installed and its native extension fails to load — e.g. a wheel that linkslibcudart.so.13running on a host with only CUDA 12. In that case the symbol is silently set toNone, and the real failure doesn't surface until the first FP8 forward pass, as a misleading:We hit this on a multi-node GLM-5.1 run: the deep_gemm release wheel linked CUDA 13 libs while the nodes shipped CUDA 12.9, so every FP8 matmul died with the
NoneTypeerror deep in the trainer — hours of misdirection before tracing it back to a swallowedlibcudart.so.13: cannot open shared object fileat import.Fix
Narrow the except to
ModuleNotFoundError:ModuleNotFoundError, falls back toNone. Unchanged behavior.ImportError, which now propagates with its real cause, making the misconfiguration obvious at import time.Aligns with the "errors should never pass silently" principle — the CPU fallback stays, but a broken native install no longer masquerades as a missing-attribute bug.