Rust PyO3 renderer port and native performance paths#73
Draft
ThomAub wants to merge 35 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the Rust/PyO3 native renderer port with native parity paths.
Current benchmark perf
Latest local qwen3 benchmark on this branch:
Command used:
Note
Add Rust/PyO3 native renderer implementations for multiple model families
crates/) with three members:renderers-core(pure Rust rendering/parsing logic),renderers-py(PyO3 Python bindings compiled asrenderers_native), andrenderers-cli(a CLI for diffing/benchmarking).Renderertrait withrender,parse_response,stop_token_ids, andbridge_to_next_turn.Qwen3Renderer,KimiK25Renderer, etc.) now override__new__to return native Rust instances whenRENDERERS_NATIVEenv var selects the family and the compiled extension is importable; otherwise they fall back to pure-Python construction.tests/and a Rust CI workflow covering fmt, clippy, cargo test, and Miri.__new__overrides mean instantiating any patched renderer class may return an opaque Rust object; code that introspects instance type or calls Python-only attributes on the returned object will break silently when the native path is active.Macroscope summarized fa47618.