Move cuda.core Windows AOTI stub-lib generation into build_ext in setup.py#2033
Open
rwgk wants to merge 1 commit intoNVIDIA:mainfrom
Open
Move cuda.core Windows AOTI stub-lib generation into build_ext in setup.py#2033rwgk wants to merge 1 commit intoNVIDIA:mainfrom
rwgk wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
Reuse setuptools' initialized MSVC compiler when linking _tensor_bridge so Windows source builds do not need separate toolchain discovery in build_hooks.py. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
Author
|
/ok to test |
|
Contributor
Author
|
Local testing with pytorch installed: |
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.
Background
cuda_coreneeds a Windows stub import library for_tensor_bridgeso MSVC can link against PyTorch's AOTI symbols fromtorch_cpu.dllwithout making PyTorch itself a build-time dependency.That stub library was previously generated in
cuda_core/build_hooks.py. This worked in CI because the Windows workflows explicitly prepare the MSVC environment first, but it made local/source builds depend on a separate toolchain discovery path beforesetuptoolshad initialized its compiler machinery.What This Changes
aoti_shim.libgeneration out ofcuda_core/build_hooks.pyand intocuda_core/setup.py.build_ext, aftersetuptoolshas created and initialized the compiler object it will actually use for the extension build.lib.exeand append the generated import library only tocuda.core._tensor_bridge.lib.exesubprocess path from the PEP 517 build backend sobuild_hooks.pygoes back to focusing on extension preparation and cythonization.aoti_shim.handaoti_shim.defto document that the stub library is now produced fromsetup.py/build_ext.Why
setuptoolsalready uses for the actual extension build instead of maintaining a second discovery/bootstrap path in the build backend.Scope
cuda.core._tensor_bridge.Testing
build_hooks.py.