hotg-ai / rune

Rune provides containers to encapsulate and deploy edgeML pipelines and applications
Apache License 2.0
133 stars 15 forks source link

Check a Rune is compatible with the current runtime when it is loaded #336

Open Michael-F-Bryan opened 2 years ago

Michael-F-Bryan commented 2 years ago

At the moment, it's hard to make changes to the Rune-runtime interface because the Rune will fail to load due to obscure errors (e.g. an import function's signature is different or it wasn't provided).

The rune build command already embeds the rune CLI's version number in each Rune under the .rune_version custom section.

$ wasm-objdump --full-contents --section=.rune_version examples/sine/sine.rune

sine.rune:  file format wasm 0x1

Contents of section Custom:
00113bf: 0d2e 7275 6e65 5f76 6572 7369 6f6e 7b22  ..rune_version{"
00113cf: 7665 7273 696f 6e22 3a22 302e 372e 312d  version":"0.7.1-
00113df: 6465 7622 7d                             dev"}

Now we just need to emit checks and emit a warning if the Rune's version isn't semver compatible with the runtime:

To make evolving things easier, I'd also like to not provide any backwards/forwards compatibility guarantee (cc @kthakore). At the moment, the C++ runtime forces us to be de facto backwards compatible, and it sucks.