Many moons ago we built out a way to simulate pipelines of stateful invocations for testing via the iree-run-trace/iree-benchmark-trace tools. These take a YAML file with the expected inputs, optionally outputs (though we don't do anything with them today), and has some basic support for blackboard-style state.
Since it was originally written we've gotten multiple modules working much better and it's now possible to do nearly everything the YAML could do natively just using modules:
https://github.com/openxla/iree/tree/main/samples/multiple_modulesBy using modules state, loops, integration with other tooling (check tests), and all features are fully supported (parameters, multiple devices, async, collectives, etc). Anything that can run IREE programs can run the pipelines meaning that iree-run-module/iree-benchmark-module/iree-check-module, the python API, etc can consume them without changes.
As an example, the following YAML trace:
https://github.com/openxla/iree/blob/main/tools/test/iree-run-trace.ymlcan be written as:
```
func.func private @module.mul(%arg0: tensor<4xf32>, %arg1: tensor<4xf32>) -> tensor<4xf32>
func.func @run(%arg0: tensor<4xf32>) -> tensor<4xf32> {
%cst0 = arith.constant dense<[0,1,2,3]> : tensor<4xf32>
%0 = call @module.mul(%arg0, %cst0) : (tensor<4xf32>, tensor<4xf32>) -> tensor<4xf32>
%cst1 = arith.constant dense<3> : tensor<4xf32>
%1 = call @module.mul(%0, %cst1) : (tensor<4xf32>, tensor<4xf32>) -> tensor<4xf32>
return %1 : tensor<4xf32>
}
```
the pipeline is then compiled and run by passing both the module under test and the pipeline module:
```
iree-compile pipeline.mlir -o=pipeline.vmfb
iree-run-module --module=module.vmfb --module=pipeline.vmfb --function=run
```
We never really got much tooling support around the YAML traces but the idea was that bindings could write out the traces as a recording of the call sequence by the user with just stdout/printf. The idea now is that just as a binding layer could write out textual YAML lines it could also write out textual MLIR statements - it's just a different syntax for the same thing but with verification and the full fidelity of the system. In other words, there's no need to pull in MLIR IR builders and such and instead just emit them textually.
The loose plan is to deprecate the YAML trace replay tooling by removing the top level tools (iree-run-trace/iree-benchmark-trace) from deployments and the repo. The end-to-end matmul tests currently use the same infrastructure and we'll have to move them over to being modules but to start the code will be moved to a test-only path for eventual reworking. Once reworked we can entirely remove the libyaml dep from the repo.
Since it's pretty tricky to use and doesn't have optimized workflows we don't believe anyone is using this functionality (outside of the in-tree matmul tests) but wanted to give a heads up in case someone is to ensure we carry forward any features people are relying on.