Add FLOAT16 input/output format support for pure FP16 models#3
Merged
ChinChangYang merged 1 commit intomasterfrom Jan 18, 2026
Merged
Add FLOAT16 input/output format support for pure FP16 models#3ChinChangYang merged 1 commit intomasterfrom
ChinChangYang merged 1 commit intomasterfrom
Conversation
Implements pure FP16 mode where model inputs and outputs use FLOAT16 data types instead of FLOAT32, enabling maximum performance on Apple Silicon while maintaining ~50% weight size reduction. Key changes: - Add use_fp16_io option to ConversionOptions (requires FP16 compute) - Conditionally set input/output tensor types to FLOAT16 in MIL builder - Remove cast operations at boundaries when using pure FP16 mode - Update model description to use FLOAT16 for inputs/outputs - Auto-upgrade specification version to 7 (iOS 16+) for FP16 I/O - Add --float16-io CLI flag with validation Three precision modes now supported: 1. FLOAT32 (default): FP32 everywhere, iOS 15+ 2. Mixed precision (--float16): FP32 I/O, FP16 compute, iOS 15+ 3. Pure FP16 (--float16 --float16-io): FP16 everywhere, iOS 16+ Testing: - All 13 C++ unit tests pass - Added 10 new Python integration tests for FP16 I/O functionality - Tests verify model compilation, data types, inference, and dynamic batch Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.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.
Implements pure FP16 mode where model inputs and outputs use FLOAT16 data types instead of FLOAT32, enabling maximum performance on Apple Silicon while maintaining ~50% weight size reduction.
Key changes:
Three precision modes now supported:
Testing: