[llvm] [NVPTX] Add intrinsics for prefetch.* (PR #125887)

Abhilash Majumder via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 6 02:52:38 PST 2025


================
@@ -4999,6 +5000,30 @@ foreach dim = [1, 2, 3, 4, 5] in {
   }
 }
 
+// Intrinsics for Prefetch and Prefetchu
+foreach addr = ["global", "local", ""] in {
+  foreach evict = !if(!eq(addr, "global"),
+                  ["evictlast", "evictnormal"],
+                  ["evictnormal"]) in {
+    foreach level = ["L1", "L2"] in {
+      def int_nvvm_prefetch_ # !if(!eq(addr, ""), "", addr # "_") 
+          # level # "_" # evict : Intrinsic<[], 
+                                            !cond(
+                                            !eq(addr, "global") : [llvm_global_ptr_ty],
+                                            !eq(addr, "local"): [llvm_local_ptr_ty],
+                                            !eq(addr, ""): [llvm_ptr_ty]),
+                                            [IntrArgMemOnly,ReadOnly<ArgIndex<0>>,
+                                             NoCapture<ArgIndex<0>>],
+                                            "llvm.nvvm.prefetch." # !if(!eq(addr, ""), "", addr                                                                                                     # ".")# level # "." # evict>;   
+    }
----------------
abhilash1910 wrote:

Addressed.

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


More information about the llvm-commits mailing list