summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Support/JitRunner.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Adjust License.txt file to use the LLVM licenseMehdi Amini2019-12-231-13/+4
| | | | PiperOrigin-RevId: 286906740
* NFC: Remove unnecessary 'llvm::' prefix from uses of llvm symbols declared ↵River Riddle2019-12-181-8/+8
| | | | | | | | in `mlir` namespace. Aside from being cleaner, this also makes the codebase more consistent. PiperOrigin-RevId: 286206974
* Drop MemRefUtils from the ExecutionEngineAlex Zinenko2019-10-231-1/+0
| | | | | | | | | | The ExecutionEngine was updated recently to only take the LLVM dialect as input. Memrefs are no longer expected in the signature of the entry point function by the executor so there is no need to allocate and free them. The code in MemRefUtils is therefore dead and furthermore out of sync with the recent evolution of memref type to support strides. Drop it. PiperOrigin-RevId: 276272302
* Use llvm.func to define functions with wrapped LLVM IR function typeAlex Zinenko2019-10-101-13/+5
| | | | | | | | | | | | | | This function-like operation allows one to define functions that have wrapped LLVM IR function type, in particular variadic functions. The operation was added in parallel to the existing lowering flow, this commit only switches the flow to use it. Using a custom function type makes the LLVM IR dialect type system more consistent and avoids complex conversion rules for functions that previously had to use the built-in function type instead of a wrapped LLVM IR dialect type and perform conversions during the analysis. PiperOrigin-RevId: 273910855
* Fix JitRunner.cpp Error creation pattern and reactivate tests.Nicolas Vasilache2019-09-271-7/+13
| | | | | | | | | | linalg_integration_test.mlir and simple.mlir were temporarily disabled due to an OSS-only failure. The issue is that, once created, an llvm::Error must be explicitly checked before it can be discarded or overwritten. This CL fixes the issue and reenable the test. PiperOrigin-RevId: 271589651
* Drop support for memrefs from JitRunnerAlex Zinenko2019-09-261-104/+9
| | | | | | | | | | | | | The support for functions taking and returning memrefs of floats was introduced in the first version of the runner, created before MLIR had reliable lowering of allocation/deallocation to library calls. It forcibly runs MLIR transformation convering affine, loop and standard dialects into the LLVM dialect, unlike the other runner flows that accept the LLVM dialect directly. Memref support leads to more complex layering and is generally fragile. Drop it in favor of functions returning a scalar, or library-based function calls to print memrefs and other data structures. PiperOrigin-RevId: 271330839
* Set mlir-cpu-runner JIT codegen opt level correctlyUday Bondhugula2019-09-071-16/+38
| | | | | | | | | | | | - the JIT codegen was being run at the default -O0 level; instead, propagate the opt level from the cmd line. Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#123 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/123 from bondhugula:jit-runner 3b055e47f94c9a48bf487f6400787478738cda02 PiperOrigin-RevId: 267778586
* Refactor the pass manager to support operations other than FuncOp/ModuleOp.River Riddle2019-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change generalizes the structure of the pass manager to allow arbitrary nesting pass managers for other operations, at any level. The only user visible change to existing code is the fact that a PassManager must now provide an MLIRContext on construction. A new class `OpPassManager` has been added that represents a pass manager on a specific operation type. `PassManager` will remain the top-level entry point into the pipeline, with OpPassManagers being nested underneath. OpPassManagers will still be implicitly nested if the operation type on the pass differs from the pass manager. To explicitly build a pipeline, the 'nest' methods on OpPassManager may be used: // Pass manager for the top-level module. PassManager pm(ctx); // Nest a pipeline operating on FuncOp. OpPassManager &fpm = pm.nest<FuncOp>(); fpm.addPass(...); // Nest a pipeline under the FuncOp pipeline that operates on spirv::ModuleOp OpPassManager &spvModulePM = pm.nest<spirv::ModuleOp>(); // Nest a pipeline on FuncOps inside of the spirv::ModuleOp. OpPassManager &spvFuncPM = spvModulePM.nest<FuncOp>(); To help accomplish this a new general OperationPass is added that operates on opaque Operations. This pass can be inserted in a pass manager of any type to operate on any operation opaquely. An example of this opaque OperationPass is a VerifierPass, that simply runs the verifier opaquely on the current operation. /// Pass to verify an operation and signal failure if necessary. class VerifierPass : public OperationPass<VerifierPass> { void runOnOperation() override { Operation *op = getOperation(); if (failed(verify(op))) signalPassFailure(); markAllAnalysesPreserved(); } }; PiperOrigin-RevId: 266840344
* Add missing lowering to CFG in mlir-cpu-runner + related cleanupMehdi Amini2019-09-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - the list of passes run by mlir-cpu-runner included -lower-affine and -lower-to-llvm but was missing -lower-to-cfg (because -lower-affine at some point used to lower straight to CFG); add -lower-to-cfg in between. IR with affine ops can now be run by mlir-cpu-runner. - update -lower-to-cfg to be consistent with other passes (create*Pass methods were changed to return unique ptrs, but -lower-to-cfg appears to have been missed). - mlir-cpu-runner was unable to parse custom form of affine op's - fix link options - drop unnecessary run options from test/mlir-cpu-runner/simple.mlir (none of the test cases had loops) - -convert-to-llvmir was changed to -lower-to-llvm at some point, but the create pass method name wasn't updated (this pass converts/lowers to LLVM dialect as opposed to LLVM IR). Fix this. (If we prefer "convert", the cmd-line options could be changed to "-convert-to-llvm/cfg" then.) Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#115 PiperOrigin-RevId: 266666909
* Add mechanism to dump JIT-compiled objects to filesJacques Pienaar2019-08-301-0/+15
| | | | | | | | | | | This commit introduces the bits to be able to dump JIT-compile objects to external files by passing an object cache to OrcJit. The new functionality is tested in mlir-cpu-runner under the flag `dump-object-file`. Closes tensorflow/mlir#95 PiperOrigin-RevId: 266439265
* Avoid assigning to an unchecked Error.River Riddle2019-08-211-10/+14
| | | | | | Fixes tensorflow/mlir#97 PiperOrigin-RevId: 264743395
* JitRunner: support entry functions returning voidAlex Zinenko2019-08-201-31/+50
| | | | | | | | | | | | | JitRunner can use as entry points functions that produce either a single '!llvm.f32' value or a list of memrefs. Memref support is legacy and was introduced before MLIR could lower memref allocation and deallocation to malloc/free calls so as to allocate the memory externally, and is likely to be dropped in the future since it unconditionally runs affine+standard-to-llvm lowering on the module instead of accepting the LLVM dialect. CUDA runner relies on memref-based flow in the runner without actually returning anything. Introduce a runner flow to use functions that return void as entry points. PiperOrigin-RevId: 264381686
* NFC: Move LLVMIR, SDBM, and StandardOps to the Dialect/ directory.River Riddle2019-08-191-1/+1
| | | | PiperOrigin-RevId: 264193915
* InitLLVM already initializes PrettyStackTraceProgramJacques Pienaar2019-08-181-2/+0
| | | | | | Remove extra PrettyStackTraceProgram and use InitLLVM consistently. PiperOrigin-RevId: 264041205
* Enable TTI for host TargetMachine in JitRunnerDiego Caballero2019-08-081-1/+13
| | | | | | | | | | | | | | This commit improves JitRunner so that it creates a target machine for the current CPU host which is used to properly initialize LLVM's TargetTransformInfo for such a target. This will enable optimizations such as vectorization in LLVM when using JitRunner. Please, note that, as part of this work, JITTargetMachineBuilder::detectHost() has been extended to include the host CPU name and sub-target features as part of the host CPU detection (https://reviews.llvm.org/D65760). Closes tensorflow/mlir#71 PiperOrigin-RevId: 262452525
* Add TTI pass initialization to pass managers.Diego Caballero2019-08-051-2/+2
| | | | | | | | | Many LLVM transformations benefits from knowing the targets. This enables optimizations, especially in a JIT context when the target is (generally) well-known. Closes tensorflow/mlir#49 PiperOrigin-RevId: 261840617
* Move shared cpu runner library to Support/JitRunner.Stephan Herhut2019-07-161-0/+328
PiperOrigin-RevId: 258347825
OpenPOWER on IntegriCloud