Skip to content

Commit fcfd3a2

Browse files
[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.
1 parent 4569b3a commit fcfd3a2

File tree

7 files changed

+19
-12
lines changed

7 files changed

+19
-12
lines changed

mlir/test/mlir-cpu-runner/include/mlir_runner_utils.h renamed to mlir/include/mlir/ExecutionEngine/RunnerUtils.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
//===- mlir_runner_utils.h - Utils for debugging MLIR CPU execution -------===//
1+
//===- RunnerUtils.h - Utils for debugging MLIR execution -----------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8-
#ifndef MLIR_CPU_RUNNER_MLIRUTILS_H_
9-
#define MLIR_CPU_RUNNER_MLIRUTILS_H_
8+
9+
#ifndef EXECUTIONENGINE_RUNNERUTILS_H_
10+
#define EXECUTIONENGINE_RUNNERUTILS_H_
1011

1112
#include <assert.h>
1213
#include <cstdint>
@@ -291,4 +292,4 @@ extern "C" MLIR_RUNNER_UTILS_EXPORT void print_close();
291292
extern "C" MLIR_RUNNER_UTILS_EXPORT void print_comma();
292293
extern "C" MLIR_RUNNER_UTILS_EXPORT void print_newline();
293294

294-
#endif // MLIR_CPU_RUNNER_MLIRUTILS_H_
295+
#endif // EXECUTIONENGINE_RUNNERUTILS_H_

mlir/lib/ExecutionEngine/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
set(LLVM_OPTIONAL_SOURCES
2+
ExecutionEngine.cpp
3+
RunnerUtils.cpp
4+
OptUtils.cpp
5+
)
6+
17
llvm_map_components_to_libnames(outlibs "nativecodegen" "IPO")
28
add_llvm_library(MLIRExecutionEngine
39
ExecutionEngine.cpp
@@ -27,3 +33,6 @@ target_link_libraries(MLIRExecutionEngine
2733
LLVMTransformUtils
2834

2935
${outlibs})
36+
37+
add_llvm_library(MLIRRunnerUtils SHARED RunnerUtils.cpp)
38+
target_compile_definitions(MLIRRunnerUtils PRIVATE mlir_runner_utils_EXPORTS)

mlir/test/mlir-cpu-runner/mlir_runner_utils.cpp renamed to mlir/lib/ExecutionEngine/RunnerUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- mlir_runner_utils.cpp - Utils for MLIR CPU execution ---------------===//
1+
//===- RunnerUtils.cpp - Utils for MLIR CPU execution ---------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -11,7 +11,7 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
#include "include/mlir_runner_utils.h"
14+
#include "mlir/ExecutionEngine/RunnerUtils.h"
1515

1616
#include <cinttypes>
1717
#include <cstdio>

mlir/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ set(MLIR_TEST_DEPENDS
4040
mlir-translate
4141
cblas
4242
cblas_interface
43-
mlir_runner_utils
43+
MLIRRunnerUtils
4444
)
4545

4646
if(LLVM_BUILD_EXAMPLES)
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
set(LLVM_OPTIONAL_SOURCES
22
cblas.cpp
33
cblas_interface.cpp
4-
mlir_runner_utils.cpp
54
)
65

76
add_llvm_library(cblas SHARED cblas.cpp)
@@ -11,5 +10,3 @@ add_llvm_library(cblas_interface SHARED cblas_interface.cpp)
1110
target_link_libraries(cblas_interface PRIVATE cblas)
1211
target_compile_definitions(cblas_interface PRIVATE cblas_interface_EXPORTS)
1312

14-
add_llvm_library(mlir_runner_utils SHARED mlir_runner_utils.cpp)
15-
target_compile_definitions(mlir_runner_utils PRIVATE mlir_runner_utils_EXPORTS)

mlir/test/mlir-cpu-runner/include/cblas.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#ifndef MLIR_CPU_RUNNER_CBLAS_H_
99
#define MLIR_CPU_RUNNER_CBLAS_H_
1010

11-
#include "mlir_runner_utils.h"
11+
#include "mlir/ExecutionEngine/RunnerUtils.h"
1212

1313
#ifdef _WIN32
1414
#ifndef MLIR_CBLAS_EXPORT

mlir/test/mlir-cpu-runner/include/cblas_interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#ifndef MLIR_CPU_RUNNER_CBLAS_INTERFACE_H_
99
#define MLIR_CPU_RUNNER_CBLAS_INTERFACE_H_
1010

11-
#include "mlir_runner_utils.h"
11+
#include "mlir/ExecutionEngine/RunnerUtils.h"
1212

1313
#ifdef _WIN32
1414
#ifndef MLIR_CBLAS_INTERFACE_EXPORT

0 commit comments

Comments
 (0)