Repository navigation
feat(onnx): single EP-aware session builder for embedding and segmentation - #32
Merged
Merged
Conversation
…ation EP wiring was duplicated and hardcoded at three independent ort session sites: CoreML inlined in the legacy embedder and the powerset segmenter, and the fbank embedder had no EP at all — so the ExecutionProvider in PipelineConfig was dead code and selecting Nnapi/Cuda/XnnPack silently ran on CPU with no signal. - onnx::build_session_with_ep(path, ep, intra_threads) is now the ONE place these sessions are constructed: header validation always runs before ort parses the file, the EP is registered in one audited spot, and unwired providers (NNAPI/CUDA/XNNPACK, or CoreML without the `coreml` feature) log a tracing warning and run on CPU. - The canonical ExecutionProvider enum (with target-aware auto()) moves to polyvoice::onnx — the module that owns session creation — and stays re-exported from pipeline_v2::config, so existing imports compile. - OnnxEmbeddingExtractor::new, FbankOnnxExtractor::new, and PowersetSegmenter::with_config gain an `ep` parameter (breaking; covered by the in-flight 0.10.0 bump). PowersetSegmenter::new keeps its signature and picks the target default. Default behavior is byte-identical: CoreML on Apple Silicon for segmentation/legacy embedding, plain CPU for the fbank embedder (threading the configured EP through the pipelines is the follow-up). - Module contract + README document the new surface; TDD unit tests cover validate-before-build on garbage and the no-panic CPU fallback for unwired providers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
The runner pool serves images whose latest-stable Xcode differs (26.3 vs 26.6). Build-script outputs cached by rust-cache embed absolute toolchain paths, so a cache built under one Xcode poisons the link line on a runner with another (dead -L search paths -> ld: library 'clang_rt.osx' not found). Keying the cache with the setup-xcode output isolates caches per Xcode version; non-macOS jobs get a constant empty suffix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ekhodzitsky
added a commit
that referenced
this pull request
Jul 31, 2026
…ation (#32) * feat(onnx): single EP-aware session builder for embedding and segmentation EP wiring was duplicated and hardcoded at three independent ort session sites: CoreML inlined in the legacy embedder and the powerset segmenter, and the fbank embedder had no EP at all — so the ExecutionProvider in PipelineConfig was dead code and selecting Nnapi/Cuda/XnnPack silently ran on CPU with no signal. - onnx::build_session_with_ep(path, ep, intra_threads) is now the ONE place these sessions are constructed: header validation always runs before ort parses the file, the EP is registered in one audited spot, and unwired providers (NNAPI/CUDA/XNNPACK, or CoreML without the `coreml` feature) log a tracing warning and run on CPU. - The canonical ExecutionProvider enum (with target-aware auto()) moves to polyvoice::onnx — the module that owns session creation — and stays re-exported from pipeline_v2::config, so existing imports compile. - OnnxEmbeddingExtractor::new, FbankOnnxExtractor::new, and PowersetSegmenter::with_config gain an `ep` parameter (breaking; covered by the in-flight 0.10.0 bump). PowersetSegmenter::new keeps its signature and picks the target default. Default behavior is byte-identical: CoreML on Apple Silicon for segmentation/legacy embedding, plain CPU for the fbank embedder (threading the configured EP through the pipelines is the follow-up). - Module contract + README document the new surface; TDD unit tests cover validate-before-build on garbage and the no-panic CPU fallback for unwired providers. * ci: key macOS rust-cache to the selected Xcode version The runner pool serves images whose latest-stable Xcode differs (26.3 vs 26.6). Build-script outputs cached by rust-cache embed absolute toolchain paths, so a cache built under one Xcode poisons the link line on a runner with another (dead -L search paths -> ld: library 'clang_rt.osx' not found). Keying the cache with the setup-xcode output isolates caches per Xcode version; non-macOS jobs get a constant empty suffix. --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ekhodzitsky
added a commit
that referenced
this pull request
Jul 31, 2026
…ation (#32) * feat(onnx): single EP-aware session builder for embedding and segmentation EP wiring was duplicated and hardcoded at three independent ort session sites: CoreML inlined in the legacy embedder and the powerset segmenter, and the fbank embedder had no EP at all — so the ExecutionProvider in PipelineConfig was dead code and selecting Nnapi/Cuda/XnnPack silently ran on CPU with no signal. - onnx::build_session_with_ep(path, ep, intra_threads) is now the ONE place these sessions are constructed: header validation always runs before ort parses the file, the EP is registered in one audited spot, and unwired providers (NNAPI/CUDA/XNNPACK, or CoreML without the `coreml` feature) log a tracing warning and run on CPU. - The canonical ExecutionProvider enum (with target-aware auto()) moves to polyvoice::onnx — the module that owns session creation — and stays re-exported from pipeline_v2::config, so existing imports compile. - OnnxEmbeddingExtractor::new, FbankOnnxExtractor::new, and PowersetSegmenter::with_config gain an `ep` parameter (breaking; covered by the in-flight 0.10.0 bump). PowersetSegmenter::new keeps its signature and picks the target default. Default behavior is byte-identical: CoreML on Apple Silicon for segmentation/legacy embedding, plain CPU for the fbank embedder (threading the configured EP through the pipelines is the follow-up). - Module contract + README document the new surface; TDD unit tests cover validate-before-build on garbage and the no-panic CPU fallback for unwired providers. * ci: key macOS rust-cache to the selected Xcode version The runner pool serves images whose latest-stable Xcode differs (26.3 vs 26.6). Build-script outputs cached by rust-cache embed absolute toolchain paths, so a cache built under one Xcode poisons the link line on a runner with another (dead -L search paths -> ld: library 'clang_rt.osx' not found). Keying the cache with the setup-xcode output isolates caches per Xcode version; non-macOS jobs get a constant empty suffix. ---------
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.
Foundation for the execution-provider track: EP wiring was duplicated and hardcoded to CoreML at two ort session sites and absent at the third (the fbank embedder), so
PipelineConfig.execution_providerwas inert dead code — selecting NNAPI/CUDA/XNNPACK silently ran on CPU with no signal.What changed
onnx::build_session_with_ep(path, ep, intra_threads)is now the single place embedding/segmentationortsessions are constructed: ONNX header validation always runs before ort parses the file (the validate-before-build invariant), the EP is registered in one audited spot, and unwired providers log atracingwarning and run on CPU (ort's built-in CPU fallback keeps inference correct — registration failure is deliberately not fatal, per the task design).ExecutionProviderenum (with target-awareauto()) moves topolyvoice::onnx— the module that owns session creation — eliminating the would-be cyclic dep;pipeline_v2::configre-exports it so existing imports keep compiling.OnnxEmbeddingExtractor::new,FbankOnnxExtractor::new,PowersetSegmenter::with_configgain anepparameter;PowersetSegmenter::newkeeps its signature (target default). All callers across bins/tests/examples updated.Versioning
Breaking (constructor signatures + enum move, mitigated by re-export) — covered by the 0.10.0 bump already in flight on this release cycle (PR #31). CHANGELOG updated under Unreleased.
Verification
auto()) build OK on a real model without panicking; intra-threads path covered.cargo test --lib onnx --features onnx: 8/8. Fullcargo nextest run --all-features: 424 passed.cargo hack check --feature-powerset --depth 2 --lib --bins: clean (no broken feature combos).-D warnings+ fmt clean.🤖 Generated with Claude Code