[Mlir-commits] [mlir] ae15b1e - Fix MLIR Toy tutorial JIT example and add a test to cover it

Mehdi Amini llvmlistbot at llvm.org
Thu Feb 18 17:53:46 PST 2021


Author: Mehdi Amini
Date: 2021-02-19T01:53:36Z
New Revision: ae15b1e7ad71e4bfde1b031dd5e6b0bbb3b88a42

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

LOG: Fix MLIR Toy tutorial JIT example and add a test to cover it

Added: 
    mlir/test/Examples/Toy/Ch6/jit.toy
    mlir/test/Examples/Toy/Ch7/jit.toy

Modified: 
    mlir/examples/toy/Ch6/toyc.cpp
    mlir/examples/toy/Ch7/toyc.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/examples/toy/Ch6/toyc.cpp b/mlir/examples/toy/Ch6/toyc.cpp
index 5298c0bb5205..0645bd40c1ba 100644
--- a/mlir/examples/toy/Ch6/toyc.cpp
+++ b/mlir/examples/toy/Ch6/toyc.cpp
@@ -240,7 +240,7 @@ int runJit(mlir::ModuleOp module) {
   auto &engine = maybeEngine.get();
 
   // Invoke the JIT-compiled function.
-  auto invocationResult = engine->invoke("main");
+  auto invocationResult = engine->invokePacked("main");
   if (invocationResult) {
     llvm::errs() << "JIT invocation failed\n";
     return -1;

diff  --git a/mlir/examples/toy/Ch7/toyc.cpp b/mlir/examples/toy/Ch7/toyc.cpp
index 8bace4a73977..0f6d3876a5ad 100644
--- a/mlir/examples/toy/Ch7/toyc.cpp
+++ b/mlir/examples/toy/Ch7/toyc.cpp
@@ -241,7 +241,7 @@ int runJit(mlir::ModuleOp module) {
   auto &engine = maybeEngine.get();
 
   // Invoke the JIT-compiled function.
-  auto invocationResult = engine->invoke("main");
+  auto invocationResult = engine->invokePacked("main");
   if (invocationResult) {
     llvm::errs() << "JIT invocation failed\n";
     return -1;

diff  --git a/mlir/test/Examples/Toy/Ch6/jit.toy b/mlir/test/Examples/Toy/Ch6/jit.toy
new file mode 100644
index 000000000000..250eb4e3307d
--- /dev/null
+++ b/mlir/test/Examples/Toy/Ch6/jit.toy
@@ -0,0 +1,5 @@
+# RUN: toyc-ch6 -emit=jit %s
+
+def main() {
+ print([[1, 2], [3, 4]]);
+}

diff  --git a/mlir/test/Examples/Toy/Ch7/jit.toy b/mlir/test/Examples/Toy/Ch7/jit.toy
new file mode 100644
index 000000000000..aaa898f77b3d
--- /dev/null
+++ b/mlir/test/Examples/Toy/Ch7/jit.toy
@@ -0,0 +1,5 @@
+# RUN: toyc-ch7 -emit=jit %s
+
+def main() {
+ print([[1, 2], [3, 4]]);
+}


        


More information about the Mlir-commits mailing list