[all-commits] [llvm/llvm-project] efcf09: [mlir] [EDSC] Add interface for yield-for loops.
poechsel via All-commits
all-commits at lists.llvm.org
Wed Apr 15 09:39:54 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: efcf0985eef69127af0e5576f5977b0bb3f1a4a8
https://github.com/llvm/llvm-project/commit/efcf0985eef69127af0e5576f5977b0bb3f1a4a8
Author: Pierre Oechsel <pierre.oechsel at gmail.com>
Date: 2020-04-15 (Wed, 15 Apr 2020)
Changed paths:
M mlir/include/mlir/Dialect/LoopOps/EDSC/Builders.h
A mlir/include/mlir/Dialect/LoopOps/EDSC/Intrinsics.h
M mlir/include/mlir/EDSC/Builders.h
M mlir/lib/Dialect/LoopOps/EDSC/Builders.cpp
M mlir/test/EDSC/builder-api-test.cpp
Log Message:
-----------
[mlir] [EDSC] Add interface for yield-for loops.
Summary:
ModelBuilder was missing an api to easily generate yield-for-loops.
This diffs implements an interface allowing to write:
```
%2:2 = loop.for %i = %start to %end step %step iter_args(%arg0 = %init0, %arg1 = %init1) -> (f32, f32) {
%sum = addf %arg0, %arg1 : f32
loop.yield %arg1, %sum : f32, f32
}
%3 = addf %2#0, %2#1 : f32
```
as
```
auto results =
LoopNestBuilder(&i, start, end, step, {&arg0, &arg1}, {init0, init1})([&] {
auto sum = arg0 + arg1;
loop_yield(ArrayRef<ValueHandle>{arg1, sum});
});
// Add the two values accumulated by the yield-for-loop:
ValueHandle(results[0]) + ValueHandle(results[1]);
```
Differential Revision: https://reviews.llvm.org/D78093
More information about the All-commits
mailing list