Make paged MQA metadata independent of PyTorch C++ ABI - #70
Draft
nvpohanh wants to merge 1 commit into
Draft
Conversation
Author
|
@Fridge003 Could you check if this is a reasonable fix? Context: we are upgrading the PyTorch version in our NGC SGLang container to prepare for Rubin support, but we ran into a PyTorch ABI issue caused by sgl-deep-geem. This is the agent's suggested fix. I will take a closer look tomorrow. |
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.
[by Codex]
Why this is needed
sgl-deep-gemmdistributes a prebuilt_C.so, but the paged-MQA metadata API currently converts TVM-FFI tensors totorch::Tensorwithtorch::from_blob. This unnecessarily couples that path to the PyTorch C++ ABI used when the wheel was built. PyTorch does not guarantee that extension binaries using ATen object internals remain compatible across releases.The metadata launcher only needs tensor metadata, raw device pointers, and an output allocation. Keeping this path on the TVM-FFI boundary avoids constructing ATen objects and makes the boundary match the data actually consumed by the CUDA launcher.
What this PR does
This PR removes PyTorch C++ tensor objects from the exported
get_paged_mqa_logits_metadatapath:tvm::ffi::TensorView;Tensor::FromEnvAlloc(TVMFFIEnvTensorAlloc, ...);This is intentionally an incremental patch. Other exported DeepGEMM paths still use ATen and the wheel still links libtorch. Those paths should be migrated to the same TVM-FFI/raw-pointer pattern before claiming that the entire wheel is independent of the PyTorch C++ ABI.
Validation
context_lensshapes;git diff --check.The complete DeepGEMM test suite has not been run across all supported GPU architectures yet, so this is opened as a draft.