2019-05-18 06:03:39 +08:00
|
|
|
add_subdirectory(EDSC)
|
2019-05-21 22:22:35 +08:00
|
|
|
add_subdirectory(mlir-cpu-runner)
|
|
|
|
add_subdirectory(SDBM)
|
2019-06-25 05:35:21 +08:00
|
|
|
add_subdirectory(lib)
|
2019-05-14 01:59:04 +08:00
|
|
|
|
2019-04-03 01:02:07 +08:00
|
|
|
llvm_canonicalize_cmake_booleans(
|
|
|
|
LLVM_BUILD_EXAMPLES
|
|
|
|
)
|
|
|
|
|
2019-05-16 00:26:27 +08:00
|
|
|
# Passed to lit.site.cfg.py.in to set up the path where to find the libraries
|
|
|
|
# for linalg integration tests.
|
2019-11-27 00:47:14 +08:00
|
|
|
set(MLIR_DIALECT_LINALG_INTEGRATION_TEST_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
2019-05-16 00:26:27 +08:00
|
|
|
|
2019-07-04 22:49:52 +08:00
|
|
|
# Passed to lit.site.cfg.py.in to set up the path where to find the libraries
|
|
|
|
# for the mlir cuda runner tests.
|
2019-11-27 00:47:14 +08:00
|
|
|
set(MLIR_CUDA_WRAPPER_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
2019-07-04 22:49:52 +08:00
|
|
|
|
2019-03-30 13:10:12 +08:00
|
|
|
configure_lit_site_cfg(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
|
|
|
|
MAIN_CONFIG
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
|
|
|
|
)
|
|
|
|
configure_lit_site_cfg(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
|
|
|
|
MAIN_CONFIG
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
|
|
|
|
)
|
|
|
|
|
|
|
|
set(MLIR_TEST_DEPENDS
|
|
|
|
FileCheck count not
|
|
|
|
MLIRUnitTests
|
|
|
|
mlir-cpu-runner
|
2019-05-23 03:13:54 +08:00
|
|
|
mlir-edsc-builder-api-test
|
2019-03-30 13:10:12 +08:00
|
|
|
mlir-opt
|
2019-05-21 22:22:35 +08:00
|
|
|
mlir-sdbm-api-test
|
2019-03-30 13:10:12 +08:00
|
|
|
mlir-tblgen
|
|
|
|
mlir-translate
|
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
2019-06-12 03:09:50 +08:00
|
|
|
cblas
|
|
|
|
cblas_interface
|
2019-10-08 00:06:08 +08:00
|
|
|
mlir_runner_utils
|
2019-03-30 13:10:12 +08:00
|
|
|
)
|
|
|
|
|
2019-04-03 01:02:07 +08:00
|
|
|
if(LLVM_BUILD_EXAMPLES)
|
|
|
|
list(APPEND MLIR_TEST_DEPENDS
|
|
|
|
toyc-ch1
|
2019-04-03 04:11:20 +08:00
|
|
|
toyc-ch2
|
2019-04-04 10:16:32 +08:00
|
|
|
toyc-ch3
|
2019-04-05 09:31:31 +08:00
|
|
|
toyc-ch4
|
2019-04-09 14:00:49 +08:00
|
|
|
toyc-ch5
|
2019-10-18 05:21:44 +08:00
|
|
|
toyc-ch6
|
2019-11-08 01:53:27 +08:00
|
|
|
toyc-ch7
|
2019-04-03 01:02:07 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2019-07-04 22:49:52 +08:00
|
|
|
if(MLIR_CUDA_RUNNER_ENABLED)
|
|
|
|
list(APPEND MLIR_TEST_DEPENDS
|
|
|
|
mlir-cuda-runner
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2019-03-30 13:10:12 +08:00
|
|
|
add_lit_testsuite(check-mlir "Running the MLIR regression tests"
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
DEPENDS ${MLIR_TEST_DEPENDS}
|
|
|
|
)
|
|
|
|
set_target_properties(check-mlir PROPERTIES FOLDER "Tests")
|
|
|
|
|
|
|
|
add_lit_testsuites(MLIR ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
DEPENDS ${MLIR_TEST_DEPS}
|
|
|
|
)
|