[Common] Move arch specific helpers in ptx.cuh to a new header - #3392
Open
kainzhong wants to merge 3 commits into
Open
[Common] Move arch specific helpers in ptx.cuh to a new header#3392kainzhong wants to merge 3 commits into
kainzhong wants to merge 3 commits into
Conversation
…to a new header Signed-off-by: Kaining Zhong <kainingz@nvidia.com>
Contributor
Greptile SummaryThe PR separates architecture-specific PTX helpers from the generic PTX header so generic CUDA targets can include architecture-agnostic utilities safely.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (3): Last reviewed commit: "whoops" | Re-trigger Greptile |
for more information, see https://pre-commit.ci
13 tasks
timmoon10
approved these changes
Aug 18, 2026
Comment on lines
8
to
+12
| * \brief BW PTX | ||
| * | ||
| * This header is safe to include from translation units compiled for a generic | ||
| * `sm_XXX` target. Helpers whose instruction selection depends on an | ||
| * arch/family-specific target live in ptx_arch_spec.cuh. |
Member
There was a problem hiding this comment.
This PR makes ptx.cuh behave more like a normal header file, which means we should have less documentation instead of more. AI has a bad habit of verbosely documenting what the code does not do.
Suggested change
| * \brief BW PTX | |
| * | |
| * This header is safe to include from translation units compiled for a generic | |
| * `sm_XXX` target. Helpers whose instruction selection depends on an | |
| * arch/family-specific target live in ptx_arch_spec.cuh. | |
| * \brief Helper functions with explicit PTX instructions |
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.
Description
ptx.cuhcurrent includes some helper that can only be compiled with arch-specific flags.For example
try_cancel_ctawhere there isconstexpr bool is_blackwell = ARCH_BLACKWELL_FAMILY;which will instantiateArchSpecific/FamilySpecifictemplate and trigger the static assertion which will fail if you compile with generic arch flags like "sm100".This will take effect as you include the header, even if you just use some other functions that are totally arch agnostic (static assertion happens when the template is instantiated regardless of whether you actually use it or not).
This PR moves the arch specific helpers to a new header so now if you need arch agnostic helpers, you should include
ptx.cuh, and if you need arch specific helpers, you includeptx_arch_spec.cuhAlso,
ptx.cuhis not a public header so this won't be a breaking changeType of change
Changes
ptx.cuhis an arch agnostic header now that can be included by files intransformer_engine_cuda_sources, which are compiled with generic flags (NVTE_GENERIC_ARCHS)ptx_arch_spec.cuhis an arch agnostic header now and it can only be included by files intransformer_engine_cuda_arch_specific_sources, which are compiled with specific flags (NVTE_SPECIFIC_ARCHS)Checklist: