Skip to content

[MLIR] Document the stability and versioning aspect of the Bytecode #81969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

joker-eph
Copy link
Collaborator

@joker-eph joker-eph commented Feb 16, 2024

@llvmbot llvmbot added the mlir label Feb 16, 2024
@llvmbot
Copy link
Member

llvmbot commented Feb 16, 2024

@llvm/pr-subscribers-mlir

Author: Mehdi Amini (joker-eph)

Changes

See the two RFCs:

https://discourse.llvm.org/t/rfc-mlir-bytecode-a-stable-serialization-format/71062
https://discourse.llvm.org/t/rfc-ir-versioning/5893


Full diff: https://github.com/llvm/llvm-project/pull/81969.diff

1 Files Affected:

  • (modified) mlir/docs/BytecodeFormat.md (+19)
diff --git a/mlir/docs/BytecodeFormat.md b/mlir/docs/BytecodeFormat.md
index 589671ee6df3ea..869b2d8f0a00b6 100644
--- a/mlir/docs/BytecodeFormat.md
+++ b/mlir/docs/BytecodeFormat.md
@@ -1,6 +1,25 @@
 # MLIR Bytecode Format
 
 This documents describes the MLIR bytecode format and its encoding.
+This format is versioned and stable: we don't plan to ever break
+compatibility, that is a dialect should be able to deserialize and
+older bytecode. Similarly, we support back-deployment we an older
+version of the format can be targetted.
+
+That said, it is important to realize that the promises of the
+bytecode format are made assuming immutable dialects: the format
+allows backward and forward compatibility, but only when nothing
+in a dialect changes (operations, types, attributes definitions).
+
+A dialect can opt-in to handle its own versioning through the
+`BytecodeDialectInterface`. Some hooks are exposed to the dialect
+to allow managing a version encoded into the bytecode file. The
+version is loaded lazily and allows to retrieve the version
+information while decoding the input IR, and gives an opportunity
+to each dialect for which a version is present to perform IR
+upgrades post-parsing through the `upgradeFromVersion` method.
+There is no restriction on what kind of information a dialect
+is allowed to encode to model its versioning
 
 [TOC]
 

@joker-eph joker-eph merged commit 450462c into llvm:main Feb 16, 2024
@joker-eph joker-eph deleted the doc_bytecode branch February 16, 2024 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants