Fix MLIR Toy tutorial JIT example and add a test to cover it
authorMehdi Amini <joker.eph@gmail.com>
Fri, 19 Feb 2021 01:53:14 +0000 (01:53 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Fri, 19 Feb 2021 01:53:36 +0000 (01:53 +0000)
mlir/examples/toy/Ch6/toyc.cpp
mlir/examples/toy/Ch7/toyc.cpp
mlir/test/Examples/Toy/Ch6/jit.toy [new file with mode: 0644]
mlir/test/Examples/Toy/Ch7/jit.toy [new file with mode: 0644]

index 5298c0b..0645bd4 100644 (file)
@@ -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;
index 8bace4a..0f6d387 100644 (file)
@@ -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 (file)
index 0000000..250eb4e
--- /dev/null
@@ -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 (file)
index 0000000..aaa898f
--- /dev/null
@@ -0,0 +1,5 @@
+# RUN: toyc-ch7 -emit=jit %s
+
+def main() {
+ print([[1, 2], [3, 4]]);
+}