How is the binary payload in MLIR proposal going?
I have the following use-case that I think really needs that feature to not resort to horrible workarounds.
I want to compare the output of my MLIR compiler with a hand-coded C++ implementation of the same kernels, using libxsmm and known to be the optimal solution to each of those problems.
So I take MLIR as
linalg-on-tensors, run my passes, and execute on the CPU using a modified version of
mlir-cpu-runner that wraps the kernel into a benchmark loop. Our passes should basically repeat the same blocking, tiling and fusing as the ninja-code does, and so the timings must be the same, or very close.
But we also need to validate the outputs, and to catch corner cases on the blocking/tiling algorithms, we need random inputs, and a way to extract the outputs with enough precision. Right now, the inputs are hard-coded and the outputs are printed as text, which is not meaningful in any way.
We’re looking into using the same random seeds for the inputs (and same generator), but still no solution for the outputs.
An easy way out would be to create the tensors as binary files by a script, then run the C++ benchmark
mmaping them. On the MLIR side, however, we don’t have that option. If we had a way to dump binary files into and out of MLIR files, we could use the same mechanism, and compare binary files directly (as floating-point values ± epsilon, etc).
However, this also means two things: first, the MLIR file has to be writable, and the JIT engine has to have access to the original file. I imagine this has to be true for training on MLIR files, but I’m not sure that’s part of the proposal.
Is this a reasonable use-case for the feature you guys are planning with the binary payloads in MLIR?
Any advice for extracting binary output from MLIR execution (without having to write my own runtime library)?