Skip to content

Optimize shared-method serialization with method references - #717

Open
zhenrongliew wants to merge 1 commit into
mainfrom
dl/serializer-codec-version
Open

Optimize shared-method serialization with method references#717
zhenrongliew wants to merge 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
11816 10655 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: 5c0817d by action🐍

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://QuEraComputing.github.io/kirin/pr-preview/pr-717/

Built to branch gh-pages at 2026-09-01 22:28 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 11 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 ⚠️
src/kirin/serialization/jsonserializer.py 94.73% 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
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.

2 participants