[Mlir-commits] [mlir] [MLIR][NVVM] Add prefetch Ops (PR #141737)
Guray Ozen
llvmlistbot at llvm.org
Thu Jun 5 00:51:42 PDT 2025
================
@@ -2333,6 +2353,60 @@ def NVVM_CpAsyncBulkTensorSharedCTAToGlobalOp :
let hasVerifier = 1;
}
+//===----------------------------------------------------------------------===//
+// NVVM Prefetch Ops
+//===----------------------------------------------------------------------===//
+
+def PrefetchCacheLevelL1 : I32EnumCase<"L1", 0, "L1">;
+def PrefetchCacheLevelL2 : I32EnumCase<"L2", 1, "L2">;
+
+def PrefetchCacheLevel : I32Enum<"PrefetchCacheLevel",
+ "NVVM Prefetch Cache Level",
+ [PrefetchCacheLevelL1, PrefetchCacheLevelL2]> {
+ let cppNamespace = "::mlir::NVVM";
+}
+
+def PrefetchCacheLevelAttr : EnumAttr<NVVM_Dialect, PrefetchCacheLevel, "prefetch_cache_level"> {
+ let assemblyFormat = "$value";
+}
+
+def NVVM_PrefetchOp : NVVM_Op<"prefetch"> {
+ let summary = "Brings the cache line containing an address into the specified cache level";
+ let description = [{
+ Operand `addr` can be a global, local or generic address pointer. No
+ operation is performed if `addr` maps to a `shared` memory location.
+
+ The `cacheLevel` attribute specifies the cache level to which the cache line
+ containing the specified address is brought.
+
+ `uniform` can be specified after the `cacheLevel` to indicate that the
+ prefetch is performed to the specified uniform cache level. If `uniform` is
+ specified, `addr` must be a generic address pointer and no operation is
+ performed if `addr` maps to a `const`, `local`, or `shared` memory location.
+
+ The `evictPriority` attribute is optional and specifies the cache eviction
+ priority when `cacheLevel` is L2.
+
+ [For more information, see PTX ISA](https://docs.nvidia.com/cuda/parallel-thread-execution/#data-movement-and-conversion-instructions-prefetch-prefetchu)
+ }];
+ let arguments = (ins PrefetchCacheLevelAttr:$cacheLevel,
+ UnitAttr:$uniform,
+ AnyTypeOf<[LLVM_PointerGlobal,
+ LLVM_PointerLocal,
+ LLVM_PointerGeneric]>:$addr,
+ OptionalAttr<CacheEvictionPriorityAttr>:$evictPriority);
+ let assemblyFormat = "`level` `=` $cacheLevel (`uniform` $uniform^)? `,` $addr (`,` `evict_priority` `=` $evictPriority^)? attr-dict `:` type($addr)";
----------------
grypp wrote:
sound good
https://github.com/llvm/llvm-project/pull/141737
More information about the Mlir-commits
mailing list