diff options
author | Nicolas Vasilache <ntv@google.com> | 2019-06-11 12:09:50 -0700 |
---|---|---|
committer | Mehdi Amini <joker.eph@gmail.com> | 2019-06-19 22:58:46 -0700 |
commit | a8a4d35d3ff6906d2ec5f94b0d7e918dce1da229 (patch) | |
tree | af9c183d639a8e4773b5cb7f981bef8ec42888ea /mlir/test/CMakeLists.txt | |
parent | f3ececd6b31fe18847aa91f0067f8549a931dce4 (diff) | |
download | llvm-a8a4d35d3ff6906d2ec5f94b0d7e918dce1da229.zip llvm-a8a4d35d3ff6906d2ec5f94b0d7e918dce1da229.tar.gz llvm-a8a4d35d3ff6906d2ec5f94b0d7e918dce1da229.tar.bz2 |
Add a lowering for Linalg matmul to LLVM
This CL adds a lowering to LLVM for MamulOp and a corresponding integration test.
View descriptor manipulation is moved from MLIR's LLVM dialect to C++ code compiled on the side. To this end a separation is introduced between `cblas.cpp` and `cblas_interface.cpp`, the latter operating on view types whose ABI correspond to the LLVM signature generated by MLIR.
An intermediary step is introduced that allocates a new descriptor on the MLIR side for the purpose of passing it to LLVM. The reason for this extra step is that the ABI for by-value ViewType objects wants aligned descriptors, e.g.:
```
extern "C" void linalg_dot_impl(ViewType<float, 1> X, ViewType<float, 1> Y,
BaseViewType<float> Z) {
...
}
```
produces LLVM IR with the signature:
```
%struct.ViewType = type { %struct.BaseViewType, [1 x i64], [1 x i64] }
%struct.BaseViewType = type { float*, i64 }
define void @linalg_dot_impl(%struct.ViewType* byval align 8, %struct.ViewType* byval align 8, float*, i64) tensorflow/mlir#0 {
...
}
```
We don't seem to be able to make such aligned allocations in the MLIR -> LLVM converter atm.
Going through a level of indirection allows the test to pass.
The temporary tradeoff is that the MLIR shims have to be written by hand.
They will disappear in the future.
PiperOrigin-RevId: 252670672
Diffstat (limited to 'mlir/test/CMakeLists.txt')
-rw-r--r-- | mlir/test/CMakeLists.txt | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mlir/test/CMakeLists.txt b/mlir/test/CMakeLists.txt index b03c7df..f377ce4 100644 --- a/mlir/test/CMakeLists.txt +++ b/mlir/test/CMakeLists.txt @@ -34,7 +34,8 @@ set(MLIR_TEST_DEPENDS mlir-tblgen mlir-test-opt mlir-translate - sdot + cblas + cblas_interface ) if(LLVM_BUILD_EXAMPLES) |