[PATCH] D79541: [mlir] Simplify and better document std.view semantics

Tim Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 7 13:03:56 PDT 2020


timshen added inline comments.


================
Comment at: mlir/include/mlir/Dialect/StandardOps/IR/Ops.td:2910
   let description = [{
-    The "view" operation converts a 1-D memref with i8 element type,
-    to an N-D memref with arbitrary element type. In addition, the ViewOp
-    supports the following arguments:
-    *) A single dynamic offset operand can be specified which represents a
-       a dynamic offset within the base 1-D memref at which to create the
-       resulting memref view.
-    *) A dynamic size operand must be specified for each dynamic dimension
+    The "view" operation extracts an N-D contiguous memref (i.e. with empty or
+    identity layout map) with arbitrary element type from a 1-D contiguous
----------------
"contiguous memref" -> "slice"? To me "contiguous" means "no gaps between the accessed bytes", but it doesn't imply identity layout. Coming from Python/C++ background, "slice" implies identity layout.


================
Comment at: mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp:2623
+    targetMemRef.setOffset(rewriter, loc,
+                           createIndexConstant(rewriter, loc, offset));
 
----------------
If the offset is 0, would it work by not calling `setOffset()` at all?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79541





More information about the llvm-commits mailing list