Skip to content

Optimize shared-method serialization with method references - #717

Merged
zhenrongliew merged 1 commit into
mainfrom
dl/serializer-codec-version
Sep 25, 2026
Merged

zhenrongliew merged 1 commit into
mainfrom
dl/serializer-codec-version

Conversation

@zhenrongliew

@zhenrongliew zhenrongliew commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This is a breaking payload-representation change. Methods are now defined using identity-based IDs, repeated call sites use method_ref, and the previous symbol_table/mangled-method representation is removed.
Payloads containing the old mangled method records are not supported by this decoder.
Explicit codec versioning and the policy for rejecting unversioned payloads are separated into the stacked follow-up PR #720

Motivation

Previously, every call site serialized and reconstructed the complete method wrapper, body already de-duplicated with region_ref.
On the representative shared-callee benchmark, relative to #713:

  • JSON: 61,470 → 42,459 bytes (−31%)
  • CBSON: 5,021 → 4,566 bytes (−9%)
  • JSON round trip: 4.36 → 2.31 ms (−47%)
  • CBSON round trip: 6.22 → 4.24 ms (−32%)

@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

☂️ Code Coverage

current status: ✅

Overall Coverage

Statements Covered Coverage Threshold Status
11842 10682 90% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/kirin/ir/attrs/py.py 90% 🟢
src/kirin/serialization/base/context.py 96% 🟢
src/kirin/serialization/base/deserializer.py 82% 🟢
src/kirin/serialization/base/serializer.py 83% 🟢
src/kirin/serialization/core/serializationmodule.py 100% 🟢
src/kirin/serialization/jsonserializer.py 99% 🟢
TOTAL 92% 🟢

updated for commit: 16490f1 by action🐍

@github-actions

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-25 15:09 UTC

@codecov

codecov Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.59184% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/kirin/serialization/base/deserializer.py 71.87% 9 Missing ⚠️
src/kirin/serialization/base/serializer.py 90.90% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@kaihsin kaihsin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this, its more clean than previously. Notice that the change of how schema version is assigned will be super breaking. @david-pl @kylequera.

@kaihsin kaihsin added the category: breaking change Category: breaking changes or proposed changes to APIs. label Sep 1, 2026
@kaihsin

kaihsin commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

consider this is breaking change, Dennis, can you decouple the versioning change into another PR?

@zhenrongliew
zhenrongliew force-pushed the dl/serializer-codec-version branch from 83b6a8a to 5c0817d Compare September 1, 2026 22:27
@zhenrongliew zhenrongliew changed the title Optimize shared-method serialization and add codec versioning Optimize shared-method serialization with method references Sep 1, 2026
@zhenrongliew

Copy link
Copy Markdown
Collaborator Author

consider this is breaking change, Dennis, can you decouple the versioning change into another PR?

Split into: #717 now contains only the method-reference payload change. Explicit codec versioning has moved to the stacked PR #720.

Both PRs are breaking changes.
#717 is payload-format breaking because it removes the previous symbol_table/mangled-method representation.
#720 formalizes the new representation as codec v2 and rejects unsupported unversioned payloads before decoding.

@kaihsin

kaihsin commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Thanks I will remove the breaking from this PR then

@kaihsin kaihsin added backport 0.22 and removed category: breaking change Category: breaking changes or proposed changes to APIs. labels Sep 1, 2026
@zhenrongliew zhenrongliew added category: breaking change Category: breaking changes or proposed changes to APIs. and removed backport 0.22 labels Sep 1, 2026
@zhenrongliew
zhenrongliew force-pushed the dl/serializer-codec-version branch from 5c0817d to 16490f1 Compare September 25, 2026 15:07
@zhenrongliew
zhenrongliew merged commit dbec232 into main Sep 25, 2026
9 checks passed
@zhenrongliew
zhenrongliew deleted the dl/serializer-codec-version branch September 25, 2026 15:08
zhenrongliew added a commit that referenced this pull request Sep 25, 2026
### Summary
- Add a Kirin-controlled integer `codec_version` to the serialization
module.
- Define the post #717  wire format as codec v2.
- Treat missing `codec_version` as legacy unversioned v1.
- Keep the existing `SerializationModule.version` caller-controlled and
independent from the wire codec.

split from original #717 into stacked PR.
This follows the direction discussed in #618.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: breaking change Category: breaking changes or proposed changes to APIs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants