[Mlir-commits] [mlir] [MLIR][NVVM] Add prefetch Ops (PR #141737)

Durgadoss R llvmlistbot at llvm.org
Mon Jun 2 06:08:56 PDT 2025


================
@@ -1712,6 +1726,46 @@ NVVM::IDArgPair DotAccumulate4WayOp::getIntrinsicIDAndArgs(
   return {ids[type], args};
 }
 
+llvm::Intrinsic::ID PrefetchL1Op::getIntrinsicID(Operation &op) {
+  auto curOp = llvm::cast<NVVM::PrefetchL1Op>(op);
+  switch (llvm::cast<LLVM::LLVMPointerType>(curOp.getAddr().getType())
+              .getAddressSpace()) {
+  case NVVM::NVVMMemorySpace::kGenericMemorySpace:
+    return llvm::Intrinsic::nvvm_prefetch_L1;
+  case NVVM::NVVMMemorySpace::kGlobalMemorySpace:
+    return llvm::Intrinsic::nvvm_prefetch_global_L1;
+  case NVVM::NVVMMemorySpace::kLocalMemorySpace:
+    return llvm::Intrinsic::nvvm_prefetch_local_L1;
+  default:
+    llvm_unreachable("Invalid pointer address space");
+  }
+}
+
+llvm::Intrinsic::ID PrefetchL2Op::getIntrinsicID(Operation &op) {
+  auto curOp = llvm::cast<NVVM::PrefetchL2Op>(op);
+  auto evictPriority = curOp.getEvictPriority();
----------------
durga4github wrote:

nit: use explicit type for evictPriority?

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


More information about the Mlir-commits mailing list