Skip to content

fix(build): restore macOS x86_64 compile by removing unguarded Float16 (#875) - #876

Merged
Alex-Wengg merged 1 commit into
mainfrom
fix/875-x86-float16
Aug 23, 2026
Merged

fix(build): restore macOS x86_64 compile by removing unguarded Float16 (#875)#876
Alex-Wengg merged 1 commit into
mainfrom
fix/875-x86-float16

Conversation

@Alex-Wengg

Copy link
Copy Markdown
Member

Fixes #875.

Root cause

v0.15.6 added three files that address fp16 MLMultiArray storage via Swift.Float16, which is unavailable on macOS x86_64:

  • ASR/Shared/LogitsArgmax.swift (shared by SenseVoice CTC + Paraformer)
  • ASR/Paraformer/ParaformerManager.swift (rows(of:))
  • TTS/NeuTts/NeuTtsSynthesizer.swift (seedState, floatBuffer)

This broke Intel swift build and downstream universal (arm64 x86_64) archives even for apps not using those features, since the sources are part of the monolithic FluidAudio target. Everything else in the tree was already portable via the established pattern (UInt16-backed pointers + vImage Planar16F conversions, as in KokoroAneArrays and ANEMemoryUtils); these files skipped it.

Changes

  • New shared Float16Conversion enum (Shared/Float16Conversion.swift) wrapping vImageConvert_Planar16FtoPlanarF / vImageConvert_PlanarFtoPlanar16F; the three files now address half-precision storage as UInt16 bit patterns. No arch guards needed, bit-identical results, and the NeuTTS scalar per-element loops become vectorized passes as a side effect.
  • Unit tests for the helper using hard-coded binary16 bit patterns, so the test file itself compiles on x86_64.
  • Per the issue's suggestion, a new CI job in tests.yml: swift build --arch x86_64 cross-compile on the arm64 runner, so this regression class fails PR CI instead of surfacing on Intel machines after release.

Verification

  • swift build --arch x86_64 on unpatched main reproduces every error from the issue verbatim (Paraformer 477/481, LogitsArgmax 35/44, NeuTTS 170/172/230/231).
  • With this change, both swift build --arch x86_64 and native arm64 swift build complete cleanly.
  • swift format lint clean on changed files.

#875)

v0.15.6 added Paraformer, LogitsArgmax, and NeuTTS code that addresses
fp16 MLMultiArray storage via Swift.Float16, which is unavailable on
macOS x86_64. This broke Intel swift build and downstream universal
(arm64 + x86_64) archives even for apps not using those features, since
the sources are part of the monolithic FluidAudio target.

Replace the Float16-typed accesses with the established portable
pattern already used by KokoroAneArrays and ANEMemoryUtils: address the
half-precision storage as UInt16 bit patterns and convert with vImage's
Planar16F routines, now factored into a shared Float16Conversion enum.
The NeuTTS seedState and floatBuffer scalar loops become vectorized
vImage passes as a side effect; results are bit-identical.

Also add an x86_64 cross-compile job to tests.yml so unguarded Float16
usage fails PR CI instead of surfacing on Intel machines after release.

Verified: swift build --arch x86_64 reproduces all errors from the
issue on unpatched main and passes with this change; native arm64
build unchanged.
@github-actions

Copy link
Copy Markdown

PocketTTS Smoke Test ✅

Check Result
Build
Model download
Model load
Synthesis pipeline
Output WAV ✅ (161.3 KB)

Runtime: 0m29s

Note: PocketTTS uses CoreML MLState (macOS 15) KV cache + Mimi streaming state. CI VM lacks physical GPU — audio quality and performance may differ from Apple Silicon.

@github-actions

Copy link
Copy Markdown

Parakeet EOU Benchmark Results ✅

Status: Benchmark passed
Chunk Size: 320ms
Files Tested: 100/100

Performance Metrics

Metric Value Description
WER (Avg) 7.03% Average Word Error Rate
WER (Med) 4.17% Median Word Error Rate
RTFx 9.50x Real-time factor (higher = faster)
Total Audio 470.6s Total audio duration processed
Total Time 55.9s Total processing time

Streaming Metrics

Metric Value Description
Avg Chunk Time 0.056s Average chunk processing time
Max Chunk Time 0.112s Maximum chunk processing time
EOU Detections 0 Total End-of-Utterance detections

Test runtime: 1m39s • 08/22/2026, 07:57 PM EST

RTFx = Real-Time Factor (higher is better) • Processing includes: Model inference, audio preprocessing, state management, and file I/O

@github-actions

Copy link
Copy Markdown

Speaker Diarization Benchmark Results

Speaker Diarization Performance

Evaluating "who spoke when" detection accuracy

Metric Value Target Status Description
DER 15.1% <30% Diarization Error Rate (lower is better)
JER 24.9% <25% Jaccard Error Rate
RTFx 26.23x >1.0x Real-Time Factor (higher is faster)

Diarization Pipeline Timing Breakdown

Time spent in each stage of speaker diarization

Stage Time (s) % Description
Model Download 10.552 26.4 Fetching diarization models
Model Compile 4.522 11.3 CoreML compilation
Audio Load 0.043 0.1 Loading audio file
Segmentation 11.999 30.0 Detecting speech regions
Embedding 19.998 50.0 Extracting speaker voices
Clustering 7.999 20.0 Grouping same speakers
Total 40.005 100 Full pipeline

Speaker Diarization Research Comparison

Research baselines typically achieve 18-30% DER on standard datasets

Method DER Notes
FluidAudio 15.1% On-device CoreML
Research baseline 18-30% Standard dataset performance

Note: RTFx shown above is from GitHub Actions runner. On Apple Silicon with ANE:

  • M2 MacBook Air (2022): Runs at 150 RTFx real-time
  • Performance scales with Apple Neural Engine capabilities

🎯 Speaker Diarization Test • AMI Corpus ES2004a • 1049.0s meeting audio • 40.0s diarization time • Test runtime: 2m 50s • 08/22/2026, 07:58 PM EST

@github-actions

Copy link
Copy Markdown

Offline VBx Pipeline Results

Speaker Diarization Performance (VBx Batch Mode)

Optimal clustering with Hungarian algorithm for maximum accuracy

Metric Value Target Status Description
DER 10.4% <20% Diarization Error Rate (lower is better)
RTFx 12.66x >1.0x Real-Time Factor (higher is faster)

Offline VBx Pipeline Timing Breakdown

Time spent in each stage of batch diarization

Stage Time (s) % Description
Model Download 19.318 23.3 Fetching diarization models
Model Compile 8.279 10.0 CoreML compilation
Audio Load 0.042 0.1 Loading audio file
Segmentation 23.425 28.3 VAD + speech detection
Embedding 82.706 99.7 Speaker embedding extraction
Clustering (VBx) 0.103 0.1 Hungarian algorithm + VBx clustering
Total 82.918 100 Full VBx pipeline

Speaker Diarization Research Comparison

Offline VBx achieves competitive accuracy with batch processing

Method DER Mode Description
FluidAudio (Offline) 10.4% VBx Batch On-device CoreML with optimal clustering
FluidAudio (Streaming) 17.7% Chunk-based First-occurrence speaker mapping
Research baseline 18-30% Various Standard dataset performance

Pipeline Details:

  • Mode: Offline VBx with Hungarian algorithm for optimal speaker-to-cluster assignment
  • Segmentation: VAD-based voice activity detection
  • Embeddings: WeSpeaker-compatible speaker embeddings
  • Clustering: PowerSet with VBx refinement
  • Accuracy: Higher than streaming due to optimal post-hoc mapping

🎯 Offline VBx Test • AMI Corpus ES2004a • 1049.0s meeting audio • 106.2s processing • Test runtime: 1m 56s • 08/22/2026, 07:58 PM EST

@github-actions

Copy link
Copy Markdown

VAD Benchmark Results

Performance Comparison

Dataset Accuracy Precision Recall F1-Score RTFx Files
MUSAN 94.0% 89.3% 100.0% 94.3% 622.8x faster 50
VOiCES 94.0% 89.3% 100.0% 94.3% 584.5x faster 50

Dataset Details

  • MUSAN: Music, Speech, and Noise dataset - standard VAD evaluation
  • VOiCES: Voices Obscured in Complex Environmental Settings - tests robustness in real-world conditions

✅: Average F1-Score above 70%

@github-actions

Copy link
Copy Markdown

ASR Benchmark Results ✅

Status: All benchmarks passed

Parakeet v3 (multilingual)

Dataset WER Avg WER Med RTFx Status
test-clean 0.57% 0.00% 5.70x
test-other 1.80% 0.00% 3.74x

Parakeet v2 (English-optimized)

Dataset WER Avg WER Med RTFx Status
test-clean 0.80% 0.00% 6.33x
test-other 1.00% 0.00% 3.83x

Streaming (v3)

Metric Value Description
WER 0.00% Word Error Rate in streaming mode
RTFx 0.68x Streaming real-time factor
Avg Chunk Time 1.340s Average time to process each chunk
Max Chunk Time 1.466s Maximum chunk processing time
First Token 1.582s Latency to first transcription token
Total Chunks 31 Number of chunks processed

Streaming (v2)

Metric Value Description
WER 0.00% Word Error Rate in streaming mode
RTFx 0.67x Streaming real-time factor
Avg Chunk Time 1.345s Average time to process each chunk
Max Chunk Time 1.481s Maximum chunk processing time
First Token 1.334s Latency to first transcription token
Total Chunks 31 Number of chunks processed

Streaming tests use 5 files with 0.5s chunks to simulate real-time audio streaming

25 files per dataset • Test runtime: 9m6s • 08/22/2026, 08:04 PM EST

RTFx = Real-Time Factor (higher is better) • Calculated as: Total audio duration ÷ Total processing time
Processing time includes: Model inference on Apple Neural Engine, audio preprocessing, state resets between files, token-to-text conversion, and file I/O
Example: RTFx of 2.0x means 10 seconds of audio processed in 5 seconds (2x faster than real-time)

Expected RTFx Performance on Physical M1 Hardware:

• M1 Mac: ~28x (clean), ~25x (other)
• CI shows ~0.5-3x due to virtualization limitations

Testing methodology follows HuggingFace Open ASR Leaderboard

@Alex-Wengg
Alex-Wengg merged commit 6428e29 into main Aug 23, 2026
12 checks passed
@Alex-Wengg
Alex-Wengg deleted the fix/875-x86-float16 branch August 23, 2026 00:04
@github-actions

Copy link
Copy Markdown

Supertonic3 Smoke Test ✅

Check Result
Build
Model download (incl. VectorEstimatorVariants/ int4 buckets)
Model load
Synthesis pipeline (--ve-variant int4)
Output WAV ✅ (364.7 KB)

Runtime: 0m58s

Note: CI VMs lack a physical Neural Engine; the ANE-bucketed VectorEstimator falls back to CPU here. This validates download + variant resolution + synthesis, not ANE residency/perf.

@github-actions

Copy link
Copy Markdown

Sortformer High-Latency Benchmark Results

ES2004a Performance (30.4s latency config)

Metric Value Target Status
DER 30.3% <35%
Miss Rate 28.2% - -
False Alarm 0.9% - -
Speaker Error 1.2% - -
RTFx 20.0x >1.0x
Speakers 4/4 - -

Sortformer High-Latency • ES2004a • Runtime: 2m 45s • 2026-08-23T00:06:20.853Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v0.15.6 fails to compile on macOS x86_64 due to unguarded Float16 usage

1 participant