Adding multiple_modules sample (and fixing bugs). (#15653)
This demonstrates multiple VM modules calling each other in both
synchronous and asynchronous modes. This is useful for both designing
reusable components as well as during testing/development/benchmarking
as it shows how easily pipelines can be constructed for running models
that may have state or non-trivial call sequences. Users can make as
many calls as they want or have their own state or control flow in the
pipelines to build arbitrarily complex sequences of work without needing
to author python/C/yaml for iree-run-trace.
diff --git a/samples/multiple_modules/module_b.mlir b/samples/multiple_modules/module_b.mlir
new file mode 100644
index 0000000..a23365c
--- /dev/null
+++ b/samples/multiple_modules/module_b.mlir
@@ -0,0 +1,9 @@
+builtin.module @module_b {
+ // Note the iree.abi.output indicating that the %output argument is storage
+ // for function result 0.
+ func.func @mul(%lhs: tensor<4096xf32>, %rhs: tensor<4096xf32>,
+ %output: tensor<4096xf32> {iree.abi.output = 0 : index}) -> tensor<4096xf32> {
+ %result = arith.mulf %lhs, %rhs : tensor<4096xf32>
+ return %result : tensor<4096xf32>
+ }
+}