iree-org / iree

A retargetable MLIR-based machine learning compiler and runtime toolkit.
http://iree.dev/
Apache License 2.0
2.84k stars 612 forks source link

Find the version / git SHA of iree-compiler from a vmfb #10856

Open powderluv opened 2 years ago

powderluv commented 2 years ago

Request description

We would like to find the IREE compiler version and the flags used from a .vmfb.

When working on various optimizations sometimes we have to go back to a .vmfb but currently there is no way to find the required metadata to recreate it.

What component(s) does this issue relate to?

No response

Additional context

No response

ScottTodd commented 2 years ago

+1 to adding more provenance/versioning metadata.

For the .vmfb files that IREE produces, we could add more (optional) metadata to the schema in https://github.com/iree-org/iree/blob/main/runtime/src/iree/schemas/bytecode_module_def.fbs

Similarly, I'd like to know the framework and import tool versions for .mlir files. There was an RFC several months ago that would add a generic "config" section to MLIR files where such metadata could be stashed, but I'm not sure where that landed: https://discourse.llvm.org/t/rfc-adding-a-generalized-config-section-to-mlir-files/62867. We could also forward framework/import tool metadata through to the iree-compile-produced runtime .vmfb.

We could also consider storing metadata in separate sidecar files, but self-describing files are nice (where size constraints aren't limiting).

powderluv commented 1 year ago

Now that at ship nightly SHARK builds to windows users the need for this came up again. End users have vmfbs that are created and cached for their local runs. Once we update the SHARK binary we don't know which version of iree-compile was used to create the vmfb. We can build a layer on to create side channel meta data but would be nice to deduce from a vmfb.

Something like iree-run-module --print-vmfb-metadata foo.vmfb

jpienaar commented 1 year ago

We have https://github.com/iree-org/iree/commit/27779b25c1e3f96430a6bfcc85b262fb1ac089a9 which adds a query method. Adding the embedding enable flag to nightly release would enable that there (the revision CMake option was already there and being set). Adding the optional metadata field can happen in parallel. And so too extending that so that one get git rev if unset revision & dirty (so for nightlies the set rev will be used but one would have the option to embedded git rev too).

allieculp commented 1 year ago

@jpienaar @ScottTodd Setting this status as 'needs scheduling' - please edit if this work has been done or is already in progress.