@@ -39,6 +39,12 @@ def AS_match {
39
39
code global = [{
40
40
return ChkMemSDNodeAddressSpace(N, llvm::ADDRESS_SPACE_GLOBAL);
41
41
}];
42
+ code const = [{
43
+ return ChkMemSDNodeAddressSpace(N, llvm::ADDRESS_SPACE_CONST);
44
+ }];
45
+ code param = [{
46
+ return ChkMemSDNodeAddressSpace(N, llvm::ADDRESS_SPACE_PARAM);
47
+ }];
42
48
}
43
49
44
50
@@ -950,33 +956,47 @@ foreach dim = 3...5 in {
950
956
defm TMA_TENSOR_PF_TILE_GATHER4_2D : TMA_TENSOR_PREFETCH_INTR<5, "tile_gather4",
951
957
[hasTMACTAGroupSupport]>;
952
958
953
- //Prefetch and Prefetchu
954
-
955
- let Predicates = [hasPTX<80>, hasSM<90>] in {
956
- class PREFETCH_INTRS<string InstName> :
957
- BasicNVPTXInst<(outs), (ins ADDR:$addr),
958
- InstName,
959
- [(!cast<Intrinsic>(!strconcat("int_nvvm_",
960
- !subst(".", "_", InstName))) addr:$addr)]>;
959
+ //Prefetchu and Prefetch
961
960
962
- def PREFETCH_L1 : PREFETCH_INTRS<"prefetch.L1">;
963
- def PREFETCH_L2 : PREFETCH_INTRS<"prefetch.L2">;
964
- def PREFETCH_GLOBAL_L1 : PREFETCH_INTRS<"prefetch.global.L1">;
965
- def PREFETCH_LOCAL_L1 : PREFETCH_INTRS<"prefetch.local.L1">;
966
- def PREFETCH_GLOBAL_L2 : PREFETCH_INTRS<"prefetch.global.L2">;
967
- def PREFETCH_LOCAL_L2 : PREFETCH_INTRS<"prefetch.local.L2">;
961
+ defvar frag_pat = (int_nvvm_prefetch_tensormap node:$addr);
968
962
969
- def PREFETCH_GLOBAL_L2_EVICT_NORMAL : BasicNVPTXInst<(outs), (ins ADDR:$addr),
970
- "prefetch.global.L2::evict_normal",
971
- [(int_nvvm_prefetch_global_L2_evict_normal addr:$addr)]>;
963
+ multiclass PREFETCH_TENSORMAP_PATFRAG<string suffix, code predicate> {
964
+ def !tolower(suffix) : PatFrag<!setdagop(frag_pat, ops), frag_pat, predicate>;
965
+ }
972
966
973
- def PREFETCH_GLOBAL_L2_EVICT_LAST : BasicNVPTXInst<(outs), (ins ADDR:$addr),
974
- "prefetch.global.L2::evict_last",
975
- [(int_nvvm_prefetch_global_L2_evict_last addr:$addr)] >;
967
+ defm prefetch_tensormap_ : PREFETCH_TENSORMAP_PATFRAG<"CONST", AS_match.const>;
968
+ defm prefetch_tensormap_ : PREFETCH_TENSORMAP_PATFRAG<"GENERIC", AS_match.generic>;
969
+ defm prefetch_tensormap_ : PREFETCH_TENSORMAP_PATFRAG<"PARAM", AS_match.param >;
976
970
977
- def PREFETCHU_L1 : PREFETCH_INTRS<"prefetchu.L1">;
971
+ multiclass PREFETCH_TENSORMAP_INST<string addrspace_name, PatFrag pattern_frag> {
972
+ def "" : BasicNVPTXInst<(outs), (ins ADDR:$addr),
973
+ "prefetch" # addrspace_name # ".tensormap",
974
+ [(pattern_frag addr:$addr)]>,
975
+ Requires<[hasPTX<80>, hasSM<90>]>;
978
976
}
979
977
978
+ defm PREFETCH_CONST_TENSORMAP : PREFETCH_TENSORMAP_INST<".const", prefetch_tensormap_const>;
979
+ defm PREFETCH_GENERIC_TENSORMAP : PREFETCH_TENSORMAP_INST<"", prefetch_tensormap_generic>;
980
+ defm PREFETCH_PARAM_TENSORMAP : PREFETCH_TENSORMAP_INST<".param", prefetch_tensormap_param>;
981
+
982
+ class PREFETCH_INTRS<string InstName, Intrinsic Intr> :
983
+ BasicNVPTXInst<(outs), (ins ADDR:$addr),
984
+ InstName,
985
+ [(Intr addr:$addr)]>,
986
+ Requires<[hasPTX<80>, hasSM<90>]>;
987
+
988
+ def PREFETCHU_L1 : PREFETCH_INTRS<"prefetchu.L1", int_nvvm_prefetchu_L1>;
989
+ def PREFETCH_L1 : PREFETCH_INTRS<"prefetch.L1", int_nvvm_prefetch_L1>;
990
+ def PREFETCH_L2 : PREFETCH_INTRS<"prefetch.L2", int_nvvm_prefetch_L2>;
991
+ def PREFETCH_GLOBAL_L1 : PREFETCH_INTRS<"prefetch.global.L1", int_nvvm_prefetch_global_L1>;
992
+ def PREFETCH_LOCAL_L1 : PREFETCH_INTRS<"prefetch.local.L1", int_nvvm_prefetch_local_L1>;
993
+ def PREFETCH_GLOBAL_L2 : PREFETCH_INTRS<"prefetch.global.L2", int_nvvm_prefetch_global_L2>;
994
+ def PREFETCH_LOCAL_L2 : PREFETCH_INTRS<"prefetch.local.L2", int_nvvm_prefetch_local_L2>;
995
+ def PREFETCH_GLOBAL_L2_EVICT_NORMAL : PREFETCH_INTRS<"prefetch.global.L2::evict_normal",
996
+ int_nvvm_prefetch_global_L2_evict_normal>;
997
+ def PREFETCH_GLOBAL_L2_EVICT_LAST : PREFETCH_INTRS<"prefetch.global.L2::evict_last",
998
+ int_nvvm_prefetch_global_L2_evict_last>;
999
+
980
1000
//Applypriority intrinsics
981
1001
class APPLYPRIORITY_L2_INTRS<string addrspace> :
982
1002
BasicNVPTXInst<(outs), (ins ADDR:$addr, B64:$size),
0 commit comments