[llvm] [NVPTX] Add family-specific architectures support (PR #141899)
Durgadoss R via llvm-commits
llvm-commits at lists.llvm.org
Thu May 29 04:01:34 PDT 2025
================
@@ -132,10 +132,29 @@ class NVPTXSubtarget : public NVPTXGenSubtargetInfo {
// are supported on the specified architecture only, hence such targets do not
// follow the onion layer model. hasArchAccelFeatures() allows
// distinguishing such GPU variants from the base GPU architecture.
- // - 0 represents base GPU model,
- // - non-zero value identifies particular architecture-accelerated variant.
- bool hasArchAccelFeatures() const { return getFullSmVersion() % 10; }
-
+ // - false represents non-accelerated architecture.
+ // - true represents architecture-accelerated variant.
+ bool hasArchAccelFeatures() const {
+ auto FullSMVersionMod = getFullSmVersion() % 10;
+ assert(FullSMVersionMod < 3 && "Invalid architecture!");
+ return FullSMVersionMod == 1;
+ }
+ // GPUs with 'f' suffix have architecture-accelerated features which are
+ // portable across all future architectures under same SM major. For example,
+ // sm_100f features will work for sm_10X future architectures.
+ // - false represents non-family-specific architecture.
+ // - true represents family-specific variant.
+ bool hasFamilySpecificFeatures() const {
+ auto FullSMVersionMod = getFullSmVersion() % 10;
+ assert(FullSMVersionMod < 3 && "Invalid architecture!");
+ return FullSMVersionMod == 2 && PTXVersion >= 88;
+ }
+ // Checks if architecture is accelerated or family-specific.
+ // - false represents neither arch-accelerated nor family-specific arch.
+ // - true represents either arch-accelerated or family-specific arch.
+ bool hasArchAccelOrFamilySpecificFeatures() const {
+ return hasArchAccelFeatures() || hasFamilySpecificFeatures();
+ }
----------------
durga4github wrote:
Could you also update the `llvm/test/CodeGen/NVPTX/sm-version.ll` file with a few tests?
https://github.com/llvm/llvm-project/pull/141899
More information about the llvm-commits
mailing list