[mlir] NFC - Move runner utils from mlir-cpu-runner to ExecutionEngine
authorNicolas Vasilache <ntv@google.com>
Thu, 27 Feb 2020 14:51:15 +0000 (09:51 -0500)
committerNicolas Vasilache <ntv@google.com>
Thu, 27 Feb 2020 15:02:24 +0000 (10:02 -0500)
Runner utils are useful beyond just CPU and hiding them within the test directory
makes it unnecessarily harder to reuse in other projects.

mlir/include/mlir/ExecutionEngine/RunnerUtils.h [moved from mlir/test/mlir-cpu-runner/include/mlir_runner_utils.h with 98% similarity]
mlir/lib/ExecutionEngine/CMakeLists.txt
mlir/lib/ExecutionEngine/RunnerUtils.cpp [moved from mlir/test/mlir-cpu-runner/mlir_runner_utils.cpp with 96% similarity]
mlir/test/CMakeLists.txt
mlir/test/mlir-cpu-runner/CMakeLists.txt
mlir/test/mlir-cpu-runner/include/cblas.h
mlir/test/mlir-cpu-runner/include/cblas_interface.h

@@ -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_
index 9e145ec..d826062 100644 (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)
similarity index 96%
rename from mlir/test/mlir-cpu-runner/mlir_runner_utils.cpp
rename to mlir/lib/ExecutionEngine/RunnerUtils.cpp
index 984d29d..9ba29ff 100644 (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>
index e008bd6..b78b095 100644 (file)
@@ -40,7 +40,7 @@ set(MLIR_TEST_DEPENDS
   mlir-translate
   cblas
   cblas_interface
-  mlir_runner_utils
+  MLIRRunnerUtils
   )
 
 if(LLVM_BUILD_EXAMPLES)
index 13aaa89..a9d45f0 100644 (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)
index 3699e99..2b57091 100644 (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
index 8329220..50edbe7 100644 (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