fix: protect dependency headers during extension builds - #96
Open
WindDaoist wants to merge 3 commits into
Open
Conversation
WindDaoist
force-pushed
the
fix/protect-dependency-porting
branch
from
July 29, 2026 06:48
8f79b0a to
9346f0b
Compare
yeahdongcn
reviewed
Jul 29, 2026
WindDaoist
force-pushed
the
fix/protect-dependency-porting
branch
from
July 29, 2026 08:30
2f5c290 to
4834445
Compare
yeahdongcn
reviewed
Jul 29, 2026
WindDaoist
force-pushed
the
fix/protect-dependency-porting
branch
from
July 29, 2026 08:41
4834445 to
085a2b5
Compare
WindDaoist
force-pushed
the
fix/protect-dependency-porting
branch
from
August 3, 2026 07:04
822ed01 to
85f6c67
Compare
Collaborator
|
@Joey-gvwal Please take a look. Thanks! |
Joey-gvwal
reviewed
Aug 3, 2026
| package root is protected as well. The value adds to the existing system | ||
| directory rules and is read at build time. | ||
| """ | ||
| value = os.environ.get("TORCHADA_EXCLUDE_DIRS", "") |
Contributor
There was a problem hiding this comment.
Should dependency protection be enabled by default when TORCHADA_EXCLUDE_DIRS is not configured?
Contributor
Author
There was a problem hiding this comment.
System dependency paths remain protected by default. TORCHADA_EXCLUDE_DIRS is additive and only needed for environment-specific paths such as editable torch_musa checkouts.
The current plan is to set TORCHADA_EXCLUDE_DIRS in the build environment of downstream projects that integrate torchada, such as torchvision, because those projects know which editable dependency
directories must be protected. This also avoids requiring frequent torchada version updates whenever downstream dependency layouts change.
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.
Summary
torchortorch_musainclude roots as project source roots.SimplePortingcandidate roots.CUDAExtension(..., torchada_stable_abi=True)opt-in while retaining detection for existing vLLM/SGLang stable extension names and source layouts.Motivation
With
torch_musainstalled in editable mode from a checkout such as/home/torch_musa, downstream torchvision builds receive that checkout as an include root. The previous path heuristic classified it as a project root and rewrote CUDA/C++ files in place. This patch separates compiler include paths from porting roots and protects dependency package roots based on their resolved module paths.The stable header backport was originally added for libtorch-stable kernels on older torch_musa releases. It was previously invoked for every MUSA extension build, which could mutate torch/torch_musa headers during ordinary torchvision builds. It is now triggered only for explicit or recognized stable-ABI extensions.
Tests
Executed in a clean worktree with: