[llvm] [NVPTX] Add prefetch tensormap variant (PR #146203)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 08:09:57 PDT 2025


================
@@ -2087,15 +2088,18 @@ foreach dim = 1...5 in {
 // Intrinsics for Prefetch and Prefetchu
 let IntrProperties = [IntrArgMemOnly, ReadOnly<ArgIndex<0>>, NoCapture<ArgIndex<0>>] in {
   foreach level = ["L1", "L2"] in {
-    def int_nvvm_prefetch_ # level : Intrinsic<[], [llvm_ptr_ty]>;
-    def int_nvvm_prefetch_global_ # level : Intrinsic<[], [llvm_global_ptr_ty]>;
-    def int_nvvm_prefetch_local_ # level : Intrinsic<[], [llvm_local_ptr_ty]>;
+    def int_nvvm_prefetch_ # level : DefaultAttrsIntrinsic<[], [llvm_ptr_ty]>;
+    def int_nvvm_prefetch_global_ # level : DefaultAttrsIntrinsic<[], [llvm_global_ptr_ty]>;
+    def int_nvvm_prefetch_local_ # level : DefaultAttrsIntrinsic<[], [llvm_local_ptr_ty]>;
   }
 
+  def int_nvvm_prefetch_generic_tensormap : DefaultAttrsIntrinsic<[], [llvm_ptr_ty]>;
+  def int_nvvm_prefetch_const_tensormap   : DefaultAttrsIntrinsic<[], [llvm_constant_ptr_ty]>;
----------------
AlexMaclean wrote:

I personally would lean towards implementing an intrinsic such as this as an overloaded intrinsic, instead of creating several different intrinsics each with the addrspace encoded in the name. In addition to the spaces you've specified it looks like the PTX instruction supports param space as well, it's unwieldy to have a separate intrinsic for each of these (especially if we were to add more supported AS in the future). A single overloaded intrinsic would be simpler to work with, such as when propagating the AS into it in infer-addrspace, and extend in the future. While it's true that an overloaded intrinsic would allow more invalid IR to be specified, this is true for all overloaded intrinsics (ie. memset to constant AS) and generally not a problem. 

https://github.com/llvm/llvm-project/pull/146203


More information about the llvm-commits mailing list