[llvm] [NVPTX] Add family-specific architectures support (PR #141899)
Artem Belevich via llvm-commits
llvm-commits at lists.llvm.org
Fri May 30 11:35:00 PDT 2025
================
@@ -36,17 +36,27 @@ class FeaturePTX<int version>:
foreach sm = [20, 21, 30, 32, 35, 37, 50, 52, 53,
60, 61, 62, 70, 72, 75, 80, 86, 87,
- 89, 90, 100, 101, 103, 120, 121] in
- def SM#sm: FeatureSM<""#sm, !mul(sm, 10)>;
-
-// Arch-specific targets. PTX for these is not compatible with any other
-// architectures.
-def SM90a : FeatureSM<"90a", 901>;
-def SM100a: FeatureSM<"100a", 1001>;
-def SM101a: FeatureSM<"101a", 1011>;
-def SM103a: FeatureSM<"103a", 1031>;
-def SM120a: FeatureSM<"120a", 1201>;
-def SM121a: FeatureSM<"121a", 1211>;
+ 89, 90, 100, 101, 103, 120, 121] in {
+ // Base SM version (e.g. FullSMVersion for sm_100 is 10000)
+ def SM#sm : FeatureSM<""#sm, !mul(sm, 100)>;
+
+ // Note: Subset of the architecture-specific features, normally
+ // available in "a" variants that will be compatible with subsequent targets
+ // in the same family. I.e they are only ordered within the major architecture,
+ // but are not comparable with other major architectures
+
+ // Family-specific targets which are compatible within same family
+ // (e.g. FullSMVersion for sm_100f is 10010)
----------------
Artem-B wrote:
I'd consolidate the encoding description in one place, at the beginning, and describe the hierarchy levels and implied ordering.
Family. `5/6/7/8/9/10/12`. Strict ordering across all Family variants.
Arch: `5*/6*/7*/8*/9*/10*/12*`: strict ordering across all Arch variants
ArchSpecific: `F*a`: `F*a > F*f > F*`
Family-specific: `F*f`: Strict ordering between `F*` and `F*f` within the same Family only.
Encoding:
`Arch * 1000 + 'f' *10 + a *1`. Given that `a` implies `f`, `a` ends up being encoded as `+11`.
The scheme allows relatively simple implementation of the partial ordering scheme above:
- To compare Family and arch, divide the ID by 1000 and 100 before comparison.
- To detect 'a' variants, do `%10`.
- To compare within the Family, do comparison on the complete ID predicated on both having the same family.
https://github.com/llvm/llvm-project/pull/141899
More information about the llvm-commits
mailing list