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

Nicolas Vasilache llvmlistbot at llvm.org
Thu Feb 27 07:07:12 PST 2020


Author: Nicolas Vasilache
Date: 2020-02-27T10:02:24-05:00
New Revision: fcfd3a281c1d6ffd40e4acc430eba448fa6c8423

URL: https://github.com/llvm/llvm-project/commit/fcfd3a281c1d6ffd40e4acc430eba448fa6c8423
DIFF: https://github.com/llvm/llvm-project/commit/fcfd3a281c1d6ffd40e4acc430eba448fa6c8423.diff

LOG: [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.

Added: 
    mlir/include/mlir/ExecutionEngine/RunnerUtils.h
    mlir/lib/ExecutionEngine/RunnerUtils.cpp

Modified: 
    mlir/lib/ExecutionEngine/CMakeLists.txt
    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

Removed: 
    mlir/test/mlir-cpu-runner/include/mlir_runner_utils.h
    mlir/test/mlir-cpu-runner/mlir_runner_utils.cpp


################################################################################
diff  --git a/mlir/test/mlir-cpu-runner/include/mlir_runner_utils.h b/mlir/include/mlir/ExecutionEngine/RunnerUtils.h
similarity index 98%
rename from mlir/test/mlir-cpu-runner/include/mlir_runner_utils.h
rename to mlir/include/mlir/ExecutionEngine/RunnerUtils.h
index a10317a49399..13d44d9c78d2 100644
--- a/mlir/test/mlir-cpu-runner/include/mlir_runner_utils.h
+++ b/mlir/include/mlir/ExecutionEngine/RunnerUtils.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_

diff  --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index 9e145ecd4620..d8260628f8cd 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -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)

diff  --git a/mlir/test/mlir-cpu-runner/mlir_runner_utils.cpp b/mlir/lib/ExecutionEngine/RunnerUtils.cpp
similarity index 96%
rename from mlir/test/mlir-cpu-runner/mlir_runner_utils.cpp
rename to mlir/lib/ExecutionEngine/RunnerUtils.cpp
index 984d29dfd2ca..9ba29ff6b0fe 100644
--- a/mlir/test/mlir-cpu-runner/mlir_runner_utils.cpp
+++ b/mlir/lib/ExecutionEngine/RunnerUtils.cpp
@@ -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>

diff  --git a/mlir/test/CMakeLists.txt b/mlir/test/CMakeLists.txt
index e008bd62f892..b78b095922af 100644
--- a/mlir/test/CMakeLists.txt
+++ b/mlir/test/CMakeLists.txt
@@ -40,7 +40,7 @@ set(MLIR_TEST_DEPENDS
   mlir-translate
   cblas
   cblas_interface
-  mlir_runner_utils
+  MLIRRunnerUtils
   )
 
 if(LLVM_BUILD_EXAMPLES)

diff  --git a/mlir/test/mlir-cpu-runner/CMakeLists.txt b/mlir/test/mlir-cpu-runner/CMakeLists.txt
index 13aaa895697f..a9d45f0f7f8b 100644
--- a/mlir/test/mlir-cpu-runner/CMakeLists.txt
+++ b/mlir/test/mlir-cpu-runner/CMakeLists.txt
@@ -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)

diff  --git a/mlir/test/mlir-cpu-runner/include/cblas.h b/mlir/test/mlir-cpu-runner/include/cblas.h
index 3699e99aa92e..2b57091f2fe9 100644
--- a/mlir/test/mlir-cpu-runner/include/cblas.h
+++ b/mlir/test/mlir-cpu-runner/include/cblas.h
@@ -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

diff  --git a/mlir/test/mlir-cpu-runner/include/cblas_interface.h b/mlir/test/mlir-cpu-runner/include/cblas_interface.h
index 83292208aa61..50edbe730d56 100644
--- a/mlir/test/mlir-cpu-runner/include/cblas_interface.h
+++ b/mlir/test/mlir-cpu-runner/include/cblas_interface.h
@@ -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


        


More information about the Mlir-commits mailing list