[Mlir-commits] [mlir] [mlir][amdgpu] Add tensor load store operations (PR #170918)

Jakub Kuderski llvmlistbot at llvm.org
Tue Dec 9 06:24:03 PST 2025


================
@@ -2710,6 +2705,37 @@ struct AMDGPUMakeDmaDescriptorLowering
   }
 };
 
+template <typename SourceOp, typename TargetOp>
+struct AMDGPUTensorLoadStoreOpLowering
+    : public ConvertOpToLLVMPattern<SourceOp> {
+  using ConvertOpToLLVMPattern<SourceOp>::ConvertOpToLLVMPattern;
+  using Adaptor = typename ConvertOpToLLVMPattern<SourceOp>::OneToNOpAdaptor;
+  AMDGPUTensorLoadStoreOpLowering(const LLVMTypeConverter &converter,
+                                  Chipset chipset)
+      : ConvertOpToLLVMPattern<SourceOp>(converter), chipset(chipset) {}
+  Chipset chipset;
+
+  LogicalResult
+  matchAndRewrite(SourceOp op, Adaptor adaptor,
+                  ConversionPatternRewriter &rewriter) const override {
+    if (chipset < kGfx1250)
+      return op->emitOpError("is only supported on gfx1250");
+
+    ValueRange desc = adaptor.getDesc();
+    uint32_t temporalHint = static_cast<uint32_t>(op.getTemporalHint());
+    bool nonVolatile = !static_cast<bool>(op.getIsVolatile());
+    uint32_t cacheScope = static_cast<uint32_t>(op.getCacheScope());
----------------
kuhar wrote:

Why do we need these static casts BTW? What is the return type of these methods?

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


More information about the Mlir-commits mailing list