Fix empty CUDA_ARCHITECTURES when SM120 is the only arch#2804
Open
sudhakarsingh27 wants to merge 1 commit intoNVIDIA:mainfrom
Open
Fix empty CUDA_ARCHITECTURES when SM120 is the only arch#2804sudhakarsingh27 wants to merge 1 commit intoNVIDIA:mainfrom
sudhakarsingh27 wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
db87355 to
7e8e188
Compare
Contributor
Greptile SummaryThis PR fixes a CMake build failure that occurs when Key points:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User sets CMAKE_CUDA_ARCHITECTURES\ne.g. 120] --> B{Is CMAKE_CUDA_ARCHITECTURES defined?}
B -- No --> C[Auto-set based on CUDA toolkit version\ne.g. 70 80 89 90 100 120]
B -- Yes --> D[Use user-supplied value]
C --> E[Arch processing loop]
D --> E
E --> F{120 in list?}
F -- Yes --> G[Remove 120 from CMAKE_CUDA_ARCHITECTURES\nAdd to NVTE_GENERIC_ARCHS and NVTE_SPECIFIC_ARCHS]
F -- No --> H{100/101/110 in list?}
G --> H
H -- Yes --> I[Remove from CMAKE_CUDA_ARCHITECTURES\nAdd to NVTE_GENERIC/SPECIFIC_ARCHS]
H -- No --> J{CMAKE_CUDA_ARCHITECTURES empty?}
I --> J
J -- Yes --> K["set(CMAKE_CUDA_ARCHITECTURES OFF)\n✅ PR Fix — avoids CMake error"]
J -- No --> L[Keep remaining archs in CMAKE_CUDA_ARCHITECTURES]
K --> M[add_library transformer_engine]
L --> M
M --> N[Per-source COMPILE_OPTIONS applied\nfor NVTE_GENERIC_ARCHS and NVTE_SPECIFIC_ARCHS]
N --> O[Build succeeds with correct arch flags]
Reviews (2): Last reviewed commit: "Fix empty CUDA_ARCHITECTURES when SM120 ..." | Re-trigger Greptile |
Signed-off-by: Sudhakar Singh <sudhakars@nvidia.com>
7e8e188 to
b7e54b3
Compare
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.
When SM120 (Blackwell) is the only architecture in the build and gets moved to per-source COMPILE_OPTIONS, CMAKE_CUDA_ARCHITECTURES becomes empty, causing CMake to error with "CUDA_ARCHITECTURES is empty".
Set CMAKE_CUDA_ARCHITECTURES to OFF as a placeholder when it's empty. The actual arch flags are still added per-source via COMPILE_OPTIONS.
Description
Please include a brief summary of the changes, relevant motivation and context.
Fixes # (issue)
Type of change
Changes
Please list the changes introduced in this PR:
Checklist: