Skip to content

[mlir] Remove printCString() from RunnerUtils #70197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2023

Conversation

MacDue
Copy link
Member

@MacDue MacDue commented Oct 25, 2023

This is now unused and can be replaced with printString() from CRunnerUtils or vector.print str.

This is now unused and can be replaced with `printString()` from
CRunnerUtils  or `vector.print str`.
@llvmbot
Copy link
Member

llvmbot commented Oct 25, 2023

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-execution-engine

Author: Benjamin Maxwell (MacDue)

Changes

This is now unused and can be replaced with printString() from CRunnerUtils or vector.print str.


Full diff: https://github.com/llvm/llvm-project/pull/70197.diff

3 Files Affected:

  • (modified) mlir/include/mlir/ExecutionEngine/RunnerUtils.h (-1)
  • (modified) mlir/lib/ExecutionEngine/RunnerUtils.cpp (-3)
  • (removed) mlir/test/mlir-cpu-runner/print.mlir (-19)
diff --git a/mlir/include/mlir/ExecutionEngine/RunnerUtils.h b/mlir/include/mlir/ExecutionEngine/RunnerUtils.h
index 56c0983e5f15b5a..f998ed53b3403b4 100644
--- a/mlir/include/mlir/ExecutionEngine/RunnerUtils.h
+++ b/mlir/include/mlir/ExecutionEngine/RunnerUtils.h
@@ -392,7 +392,6 @@ extern "C" MLIR_RUNNERUTILS_EXPORT void printMemrefF64(int64_t rank, void *ptr);
 extern "C" MLIR_RUNNERUTILS_EXPORT void printMemrefInd(int64_t rank, void *ptr);
 extern "C" MLIR_RUNNERUTILS_EXPORT void printMemrefC32(int64_t rank, void *ptr);
 extern "C" MLIR_RUNNERUTILS_EXPORT void printMemrefC64(int64_t rank, void *ptr);
-extern "C" MLIR_RUNNERUTILS_EXPORT void printCString(char *str);
 
 extern "C" MLIR_RUNNERUTILS_EXPORT void
 _mlir_ciface_printMemref0dF32(StridedMemRefType<float, 0> *m);
diff --git a/mlir/lib/ExecutionEngine/RunnerUtils.cpp b/mlir/lib/ExecutionEngine/RunnerUtils.cpp
index 4618866f68a44b7..bbfd3a6b11c2a1b 100644
--- a/mlir/lib/ExecutionEngine/RunnerUtils.cpp
+++ b/mlir/lib/ExecutionEngine/RunnerUtils.cpp
@@ -158,9 +158,6 @@ extern "C" void printMemrefC64(int64_t rank, void *ptr) {
   _mlir_ciface_printMemrefC64(&descriptor);
 }
 
-/// Deprecated. This should be unified with printString from CRunnerUtils.
-extern "C" void printCString(char *str) { fputs(str, stdout); }
-
 extern "C" void _mlir_ciface_printMemref0dF32(StridedMemRefType<float, 0> *M) {
   impl::printMemRef(*M);
 }
diff --git a/mlir/test/mlir-cpu-runner/print.mlir b/mlir/test/mlir-cpu-runner/print.mlir
deleted file mode 100644
index e36c7154f03a7b6..000000000000000
--- a/mlir/test/mlir-cpu-runner/print.mlir
+++ /dev/null
@@ -1,19 +0,0 @@
-// RUN: mlir-opt %s -pass-pipeline="builtin.module(convert-func-to-llvm,reconcile-unrealized-casts)" \
-// RUN: | mlir-cpu-runner -e main -entry-point-result=void \
-// RUN:   -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils \
-// RUN: | FileCheck %s
-
-
-llvm.mlir.global internal constant @str_global("String to print\0A")
-llvm.func @printCString(!llvm.ptr<i8>)
-
-func.func @main() {
-  %0 = llvm.mlir.addressof @str_global : !llvm.ptr<array<16 x i8>>
-  %1 = llvm.mlir.constant(0 : index) : i64
-  %2 = llvm.getelementptr %0[%1, %1]
-    : (!llvm.ptr<array<16 x i8>>, i64, i64) -> !llvm.ptr<i8>
-  llvm.call @printCString(%2) : (!llvm.ptr<i8>) -> ()
-  return
-}
-
-// CHECK: String to print

Copy link
Contributor

@banach-space banach-space left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@MacDue MacDue merged commit 274ce88 into llvm:main Oct 26, 2023
@MacDue MacDue deleted the remove_printCString branch October 26, 2023 09:07
zahiraam pushed a commit to zahiraam/llvm-project that referenced this pull request Oct 26, 2023
This is now unused and can be replaced with `printString()` from
CRunnerUtils or `vector.print str`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants