[mlir] NFC - Move runner utils from mlir-cpu-runner to ExecutionEngine

Runner utils are useful beyond just CPU and hiding them within the test directory
makes it unnecessarily harder to reuse in other projects.
This commit is contained in:
Nicolas Vasilache 2020-02-27 09:51:15 -05:00
parent 4569b3a86f
commit fcfd3a281c
7 changed files with 19 additions and 12 deletions

View File

@ -1,12 +1,13 @@
//===- mlir_runner_utils.h - Utils for debugging MLIR CPU execution -------===//
//===- RunnerUtils.h - Utils for debugging MLIR execution -----------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_CPU_RUNNER_MLIRUTILS_H_
#define MLIR_CPU_RUNNER_MLIRUTILS_H_
#ifndef EXECUTIONENGINE_RUNNERUTILS_H_
#define EXECUTIONENGINE_RUNNERUTILS_H_
#include <assert.h>
#include <cstdint>
@ -291,4 +292,4 @@ extern "C" MLIR_RUNNER_UTILS_EXPORT void print_close();
extern "C" MLIR_RUNNER_UTILS_EXPORT void print_comma();
extern "C" MLIR_RUNNER_UTILS_EXPORT void print_newline();
#endif // MLIR_CPU_RUNNER_MLIRUTILS_H_
#endif // EXECUTIONENGINE_RUNNERUTILS_H_

View File

@ -1,3 +1,9 @@
set(LLVM_OPTIONAL_SOURCES
ExecutionEngine.cpp
RunnerUtils.cpp
OptUtils.cpp
)
llvm_map_components_to_libnames(outlibs "nativecodegen" "IPO")
add_llvm_library(MLIRExecutionEngine
ExecutionEngine.cpp
@ -27,3 +33,6 @@ target_link_libraries(MLIRExecutionEngine
LLVMTransformUtils
${outlibs})
add_llvm_library(MLIRRunnerUtils SHARED RunnerUtils.cpp)
target_compile_definitions(MLIRRunnerUtils PRIVATE mlir_runner_utils_EXPORTS)

View File

@ -1,4 +1,4 @@
//===- mlir_runner_utils.cpp - Utils for MLIR CPU execution ---------------===//
//===- RunnerUtils.cpp - Utils for MLIR CPU execution ---------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@ -11,7 +11,7 @@
//
//===----------------------------------------------------------------------===//
#include "include/mlir_runner_utils.h"
#include "mlir/ExecutionEngine/RunnerUtils.h"
#include <cinttypes>
#include <cstdio>

View File

@ -40,7 +40,7 @@ set(MLIR_TEST_DEPENDS
mlir-translate
cblas
cblas_interface
mlir_runner_utils
MLIRRunnerUtils
)
if(LLVM_BUILD_EXAMPLES)

View File

@ -1,7 +1,6 @@
set(LLVM_OPTIONAL_SOURCES
cblas.cpp
cblas_interface.cpp
mlir_runner_utils.cpp
)
add_llvm_library(cblas SHARED cblas.cpp)
@ -11,5 +10,3 @@ add_llvm_library(cblas_interface SHARED cblas_interface.cpp)
target_link_libraries(cblas_interface PRIVATE cblas)
target_compile_definitions(cblas_interface PRIVATE cblas_interface_EXPORTS)
add_llvm_library(mlir_runner_utils SHARED mlir_runner_utils.cpp)
target_compile_definitions(mlir_runner_utils PRIVATE mlir_runner_utils_EXPORTS)

View File

@ -8,7 +8,7 @@
#ifndef MLIR_CPU_RUNNER_CBLAS_H_
#define MLIR_CPU_RUNNER_CBLAS_H_
#include "mlir_runner_utils.h"
#include "mlir/ExecutionEngine/RunnerUtils.h"
#ifdef _WIN32
#ifndef MLIR_CBLAS_EXPORT

View File

@ -8,7 +8,7 @@
#ifndef MLIR_CPU_RUNNER_CBLAS_INTERFACE_H_
#define MLIR_CPU_RUNNER_CBLAS_INTERFACE_H_
#include "mlir_runner_utils.h"
#include "mlir/ExecutionEngine/RunnerUtils.h"
#ifdef _WIN32
#ifndef MLIR_CBLAS_INTERFACE_EXPORT