[mlir-cpu-runner] Add support for `-mattr` and `-march` flags
authorAndrzej Warzynski <andrzej.warzynski@gmail.com>
Sat, 25 Mar 2023 20:01:34 +0000 (20:01 +0000)
committerAndrzej Warzynski <andrzej.warzynski@arm.com>
Fri, 31 Mar 2023 07:34:24 +0000 (07:34 +0000)
commitfb0b035e35ba1203912c7a756697d30c271fedb3
tree5a21a04c2b02994d1ae00b841d54a7f17688436e
parent302a6ebc899ae7cf1629378d8511cf4220656857
[mlir-cpu-runner] Add support for `-mattr` and `-march` flags

This patch adds support for `-mattr` and `-march` in mlir-cpu-runner.
With this change, one should be able to consistently use mlir-cpu-runner
for MLIR's integration tests (instead of e.g. resorting to lli when some
additional flags are needed). This is demonstrated in
concatenate_dim_1.mlir.

In order to support the new flags, this patch makes sure that
MLIR's ExecutionEngine/JITRunner (that mlir-cpu-runner is built on top of):
  * takes into account the new command line flags when creating
    TargetMachine,
  * avoids recreating TargetMachine if one is already available,
  * creates LLVM's DataLayout based on the previously configured
    TargetMachine.
This is necessary in order to make sure that the command line
configuration is propagated correctly to the backend code generator.

A few additional updates are made in order to facilitate this change,
including support for debug dumps from JITRunner.

Differential Revision: https://reviews.llvm.org/D146917
mlir/examples/toy/Ch6/toyc.cpp
mlir/examples/toy/Ch7/toyc.cpp
mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
mlir/lib/ExecutionEngine/ExecutionEngine.cpp
mlir/lib/ExecutionEngine/JitRunner.cpp
mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_1.mlir
mlir/test/mlir-cpu-runner/verify-flags.mlir [new file with mode: 0644]