[PATCH] D79457: [MLIR] Add static offset support for ViewOp's source memref.

Nicolas Vasilache via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 19:53:52 PDT 2020


nicolasvasilache added a subscriber: andydavis1.
nicolasvasilache added a comment.

I started reading the revision but I believe that this is only solving a part of the problem, which happens to be your particular blocker.
I believe the required changes are much deeper and after experimenting a bit I find that a good chunk of the ViewOp semantics is unnecessary.
See: https://reviews.llvm.org/D79541 and in particular the update to Ops.td.

Also @andydavis1 for visibility since this also spawns discussions we had a while back.



================
Comment at: mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp:2625
+
+    if (baseOffset > 0)
+      alignedPtr = rewriter.create<LLVM::GEPOp>(
----------------
`if(!ShapedType::isDynamicOffsetOrStride(baseOffset))`


================
Comment at: mlir/lib/Dialect/StandardOps/IR/Ops.cpp:2712
+    if (failed(getStridesAndOffset(baseType, strides, offset)))
+      return op.emitError("base type ") << viewType << " is not strided";
+
----------------
`<< baseType` or you'll get wrong error messages.


================
Comment at: mlir/lib/Dialect/StandardOps/IR/Ops.cpp:2715
+    if (offset == MemRefType::getDynamicStrideOrOffset())
+      return op.emitError("base type ") << viewType << " has dynamic offset";
+
----------------
`<< baseType` or you'll get wrong error messages.


================
Comment at: mlir/test/IR/invalid-ops.mlir:960
   %0 = alloc() : memref<2048xi8, affine_map<(d0) -> (d0 floordiv 8, d0 mod 8)>>
-  // expected-error at +1 {{unsupported map for base memref}}
+  // expected-error at +1 {{base type 'memref<?x?xf32, affine_map<(d0, d1)[s0] -> (d0 * 4 + d1 + s0)>>' is not strided}}
   %1 = view %0[][%arg0, %arg1]
----------------
wrong error message


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79457/new/

https://reviews.llvm.org/D79457





More information about the llvm-commits mailing list