Add pwrite-based single-file ONNX export + fix GPT-OSS dynamo export - #1232
Draft
smedhe wants to merge 3 commits into
Draft
Add pwrite-based single-file ONNX export + fix GPT-OSS dynamo export#1232smedhe wants to merge 3 commits into
smedhe wants to merge 3 commits into
Conversation
Signed-off-by: smedhe <smedhe@qti.qualcomm.com>
Signed-off-by: smedhe <smedhe@qti.qualcomm.com>
ochougul
marked this pull request as draft
August 4, 2026 16:39
Signed-off-by: smedhe <smedhe@qti.qualcomm.com>
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
proto referencing them via ExternalTensor offsets. This avoids the ~17M small write() syscalls and per-file inode overhead of the default save path, which is especially costly on large models on HDD-backed storage. Includes disk-space precheck, atomic
rename via .data.tmp, per-tensor byte-count verification, RAM-headroom warning (advisory, psutil optional), and an opt-in sync flag for fdatasync durability.
max_cache_len/sliding_window_len).
Why
The default onnx_program.save() serializes weights through a BufferedWriter with an 8KB buffer, resulting in millions of small writes — this becomes a major bottleneck for large models (e.g. 70B+) on spinning-disk-backed storage. The single-file pwrite
approach lets the OS page cache coalesce writes into large sequential flushes, cutting save time from ~45 min to ~2 min for a 131GB model in local testing. The GPT-OSS fixes address failures encountered when exporting that model through the dynamo path.