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

Durgadoss R llvmlistbot at llvm.org
Wed Jun 4 03:17:43 PDT 2025


================
@@ -1205,6 +1205,40 @@ LogicalResult NVVM::VoteSyncOp::verify() {
   return success();
 }
 
+LogicalResult NVVM::PrefetchOp::verify() {
+  unsigned addressSpace =
+      llvm::cast<LLVM::LLVMPointerType>(getAddr().getType()).getAddressSpace();
+  auto evictPriority = getEvictPriority();
+
+  if (getUniform()) {
+    if (!(getCacheLevel() == NVVM::PrefetchCacheLevel::L1)) {
+      return emitOpError("unsupported cache level, the only supported uniform "
+                         "cache level is L1");
+    }
+    if (addressSpace != NVVM::NVVMMemorySpace::kGenericMemorySpace) {
+      return emitOpError(
+          "prefetch to uniform cache requires a generic pointer");
+    }
+  }
+
+  if (evictPriority && getCacheLevel() != NVVM::PrefetchCacheLevel::L2)
+    return emitOpError(
+        "cache eviction priority supported only for cache level L2");
+
+  if (evictPriority &&
+      (addressSpace != NVVM::NVVMMemorySpace::kGlobalMemorySpace))
+    return emitOpError("cache eviction priority requires a global pointer");
+
+  if (evictPriority &&
----------------
durga4github wrote:

can we common out the evictPrio check once?

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


More information about the Mlir-commits mailing list