summaryrefslogtreecommitdiffstats
path: root/mlir/tools/mlir-cpu-runner/mlir-cpu-runner.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Adjust License.txt file to use the LLVM licenseMehdi Amini2019-12-231-13/+4
| | | | PiperOrigin-RevId: 286906740
* Move shared cpu runner library to Support/JitRunner.Stephan Herhut2019-07-161-11/+4
| | | | PiperOrigin-RevId: 258347825
* Add an mlir-cuda-runner tool.Stephan Herhut2019-07-041-2/+12
| | | | | | | | This tool allows to execute MLIR IR snippets written in the GPU dialect on a CUDA capable GPU. For this to work, a working CUDA install is required and the build has to be configured with MLIR_CUDA_RUNNER_ENABLED set to 1. PiperOrigin-RevId: 256551415
* Pipe Linalg to a cblas call via mlir-cpu-runnerNicolas Vasilache2019-05-201-259/+5
| | | | | | | | | This CL extends the execution engine to allow the additional resolution of symbols names that have been registered explicitly. This allows linking static library symbols that have not been explicitly exported with the -rdynamic linking flag (which is deemed too intrusive). -- PiperOrigin-RevId: 247969504
* Pipe Linalg to LLVM via mlir-cpu-runnerNicolas Vasilache2019-05-101-4/+57
| | | | | | | | | | | This CL adds support for functions in the Linalg dialect to run with mlir-cpu-runner. For this purpose, this CL adds BufferAllocOp, BufferDeallocOp, LoadOp and StoreOp to the Linalg dialect as well as their lowering to LLVM. To avoid collisions with mlir::LoadOp/StoreOp (which should really become mlir::affine::LoadOp/StoreOp), the mlir::linalg namespace is added. The execution uses a dummy linalg_dot function that just returns for now. In the future a proper library call will be used. -- PiperOrigin-RevId: 247476061
* Remove global LLVM CLI variables from library codeDimitrios Vytiniotis2019-03-291-6/+49
| | | | | | Plus move parsing code into the MLIR CPU runner binary. PiperOrigin-RevId: 240786709
* Add missing numeric header for std::accumulate.Jacques Pienaar2019-03-291-0/+1
| | | | PiperOrigin-RevId: 240593135
* ExecutionEngine OptUtils: support -On flags in string-based initializationAlex Zinenko2019-03-291-33/+1
| | | | | | | | | | | | | | Original implementation of OutUtils provided two different LLVM IR module transformers to be used with the MLIR ExecutionEngine: OptimizingTransformer parameterized by the optimization levels (similar to -O3 flags) and LLVMPassesTransformer parameterized by the string formatted similarly to command line options of LLVM's "opt" tool without support for -O* flags. Introduce such support by declaring the flags inside the parser and by populating the pass managers similarly to what "opt" does. Remove the additional flags from mlir-cpu-runner as they can now be wrapped into `-llvm-opts` together with other LLVM-related flags. PiperOrigin-RevId: 236107292
* ExecutionEngine: provide utils for running CLI-configured LLVM passesAlex Zinenko2019-03-291-3/+45
| | | | | | | | | | | | | | | | | | | A recent change introduced a possibility to run LLVM IR transformation during JIT-compilation in the ExecutionEngine. Provide helper functions that construct IR transformers given either clang-style optimization levels or a list passes to run. The latter wraps the LLVM command line option parser to parse strings rather than actual command line arguments. As a result, we can run either of mlir-cpu-runner -O3 input.mlir mlir-cpu-runner -some-mlir-pass -llvm-opts="-llvm-pass -other-llvm-pass" to combine different transformations. The transformer builder functions are provided as a separate library that depends on LLVM pass libraries unlike the main execution engine library. The library can be used for integrating MLIR execution engine into external frameworks. PiperOrigin-RevId: 234173493
* Reimplement LLVM IR translation to use the MLIR LLVM IR dialectAlex Zinenko2019-03-291-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Original implementation of the translation from MLIR to LLVM IR operated on the Standard+BuiltIn dialect, with a later addition of the SuperVector dialect. This required the translation to be aware of a potetially large number of other dialects as the infrastructure extended. With the recent introduction of the LLVM IR dialect into MLIR, the translation can be switched to only translate the LLVM IR dialect, and the translation of the operations becomes largely mechanical. The reimplementation of the translator follows the lines of the original translator in function and basic block conversion. In particular, block arguments are converted to LLVM IR PHI nodes, which are connected to their sources after all blocks of a function had been converted. Thanks to LLVM IR types being wrapped in the MLIR LLVM dialect type, type conversion is simplified to only convert function types, all other types are simply unwrapped. Individual instructions are constructed using the LLVM IRBuilder, which has a great potential for being table-generated from the LLVM IR dialect operation definitions. The input of the test/Target/llvmir.mlir is updated to use the MLIR LLVM IR dialect. While it is now redundant with the dialect conversion test, the point of the exercise is to guarantee exactly the same LLVM IR is emitted. (Only the name of the allocation function is changed from `__mlir_alloc` to `alloc` in the CHECK lines.) It will be simplified in a follow-up commit. PiperOrigin-RevId: 233842306
* Simple CPU runnerAlex Zinenko2019-03-291-0/+162
This implements a simple CPU runner based on LLVM Orc JIT. The base functionality is provided by the ExecutionEngine class that compiles and links the module, and provides an interface for obtaining function pointers to the JIT-compiled MLIR functions and for invoking those functions directly. Since function pointers need to be casted to the correct pointer type, the ExecutionEngine wraps LLVM IR functions obtained from MLIR into a helper function with the common signature `void (void **)` where the single argument is interpreted as a list of pointers to the actual arguments passed to the function, eventually followed by a pointer to the result of the function. Additionally, the ExecutionEngine is set up to resolve library functions to those available in the current process, enabling support for, e.g., simple C library calls. For integration purposes, this also provides a simplistic runtime for memref descriptors as expected by the LLVM IR code produced by MLIR translation. In particular, memrefs are transformed into LLVM structs (can be mapped to C structs) with a pointer to the data, followed by dynamic sizes. This implementation only supports statically-shaped memrefs of type float, but can be extened if necessary. Provide a binary for the runner and a test that exercises it. PiperOrigin-RevId: 230876363
OpenPOWER on IntegriCloud