[PATCH] D77109: Fix linalg.generic access of hoisted constants
Ahmed S. Taei via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 30 21:18:33 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG221fa96cd43c: Fix linalg.generic access of hoisted constants (authored by asaadaldien).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77109/new/
https://reviews.llvm.org/D77109
Files:
mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
mlir/test/Dialect/Linalg/loops.mlir
Index: mlir/test/Dialect/Linalg/loops.mlir
===================================================================
--- mlir/test/Dialect/Linalg/loops.mlir
+++ mlir/test/Dialect/Linalg/loops.mlir
@@ -522,3 +522,24 @@
// CHECK: %[[d:.*]] = select %{{.*}}, %[[b]], %[[c]]
// CHECK: %[[e:.*]] = addf %[[a]], %[[d]]
// CHECK: store %[[e]], %[[ARG2]][]
+
+#trait_const_fill = {
+ args_in = 0,
+ args_out = 1,
+ indexing_maps = [affine_map<(i) -> (i)>],
+ iterator_types = ["parallel"],
+ library_call = "some_external_fn"
+}
+func @generic_const_init(%arg0: memref<?xf32>) {
+ %cst = constant 1.0 : f32
+ linalg.generic #trait_const_fill %arg0 {
+ ^bb0(%arg1: f32): // no predecessors
+ linalg.yield %cst : f32
+ }: memref<?xf32>
+ return
+}
+// CHECK-LABEL: @generic_const_init
+// CHECK-SAME: %[[ARG0:.*]]: memref<?xf32>
+// CHECK: %[[CONST:.*]] = constant 1.000000e+00 : f32
+// CHECK: loop.for %[[i:.*]] = {{.*}}
+// CHECK: store %[[CONST]], %[[ARG0]]
Index: mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
===================================================================
--- mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
+++ mlir/lib/Dialect/Linalg/Transforms/LinalgToLoops.cpp
@@ -101,7 +101,7 @@
assert(isa<YieldOp>(terminator) &&
"expected an yield op in the end of the region");
for (unsigned i = 0, e = terminator.getNumOperands(); i < e; ++i) {
- std_store(map.lookup(terminator.getOperand(i)), outputBuffers[i],
+ std_store(map.lookupOrDefault(terminator.getOperand(i)), outputBuffers[i],
indexing[i]);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77109.253778.patch
Type: text/x-patch
Size: 1598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200331/4162516c/attachment-0001.bin>
More information about the llvm-commits
mailing list