Skip to content

CoreML: Add support for Pad with 'reflect' for ML Program#28073

Merged
skottmckay merged 16 commits intomainfrom
skottmckay/GH28022
Apr 20, 2026
Merged

CoreML: Add support for Pad with 'reflect' for ML Program#28073
skottmckay merged 16 commits intomainfrom
skottmckay/GH28022

Conversation

@skottmckay
Copy link
Copy Markdown
Contributor

Description

Add support for 'reflect' if ML Program is enabled. Uses the CoreML implementation directly.

Motivation and Context

#28022

@skottmckay skottmckay requested a review from Copilot April 15, 2026 04:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds CoreML EP (ML Program) support for Pad with mode="reflect" and introduces regression coverage around CoreML model loading/padding behavior.

Changes:

  • Enable Pad op builder support for ML Program and implement MIL pad op wiring for constant/reflect.
  • Tighten/adjust Pad support checks (mode gating, reflect constraints).
  • Add a new CoreML EP test covering Pad(mode=reflect) with ML Program.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
onnxruntime/test/providers/coreml/coreml_basic_test.cc Adds a new ML Program Pad(mode=reflect) regression test alongside existing CoreML tests.
onnxruntime/core/providers/coreml/builders/impl/pad_op_builder.cc Implements ML Program path for Pad (including reflect) and updates support checks/initializer skipping.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread onnxruntime/test/providers/coreml/coreml_basic_test.cc Outdated
Comment thread onnxruntime/core/providers/coreml/builders/impl/pad_op_builder.cc
Comment thread onnxruntime/core/providers/coreml/builders/impl/pad_op_builder.cc
Comment thread onnxruntime/core/providers/coreml/builders/impl/pad_op_builder.cc Outdated
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can commit the suggested changes from lintrunner.

Comment thread onnxruntime/core/providers/coreml/builders/impl/pad_op_builder.cc Outdated
Comment thread onnxruntime/core/providers/coreml/builders/impl/pad_op_builder.cc Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
skottmckay and others added 5 commits April 15, 2026 15:00
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ssion test

Agent-Logs-Url: https://github.com/microsoft/onnxruntime/sessions/93f6c70a-6288-4790-a265-f95f6f793843

Co-authored-by: skottmckay <979079+skottmckay@users.noreply.github.com>
@skottmckay
Copy link
Copy Markdown
Contributor Author

/azp run Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Linux QNN CI Pipeline

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 4 pipeline(s).

@skottmckay
Copy link
Copy Markdown
Contributor Author

/azp run Windows GPU Doc Gen CI Pipeline

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@skottmckay skottmckay requested a review from edgchen1 April 16, 2026 06:04
@skottmckay
Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

# Conflicts:
#	onnxruntime/test/providers/coreml/coreml_basic_test.cc

Co-authored-by: skottmckay <979079+skottmckay@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in b6e58ca by merging latest origin/main and fixing the conflict in onnxruntime/test/providers/coreml/coreml_basic_test.cc so both the external-data regression test and the Pad ML Program tests are preserved. UI screenshot: N/A (no UI changes).

@skottmckay
Copy link
Copy Markdown
Contributor Author

/azp run Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Linux QNN CI Pipeline

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

Comment thread onnxruntime/core/providers/coreml/builders/impl/pad_op_builder.cc Outdated
Comment thread onnxruntime/core/providers/coreml/builders/impl/pad_op_builder.cc Outdated
Comment thread onnxruntime/core/providers/coreml/builders/impl/pad_op_builder.cc Outdated
Comment thread onnxruntime/core/providers/coreml/builders/impl/pad_op_builder.cc
Comment thread onnxruntime/test/providers/coreml/coreml_basic_test.cc
@skottmckay skottmckay merged commit fb13eb3 into main Apr 20, 2026
89 checks passed
@skottmckay skottmckay deleted the skottmckay/GH28022 branch April 20, 2026 23:25
@maxwbuckley
Copy link
Copy Markdown
Contributor

Verified this works for me in my application. Thanks a lot! :)

maxwbuckley added a commit to maxwbuckley/Deep-Live-Cam that referenced this pull request Apr 22, 2026
…uting

Bundles CoreML graph rewrites, GPU-accelerated pipeline work, Windows CUDA
fixes, and Mac/Windows runtime routing into a single drop.

CoreML (Apple Silicon):
- Decompose Pad(reflect) → Slice+Concat in inswapper_128 so the model
  runs in one CoreML partition instead of 14 (TEMPORARY: fixed upstream
  in microsoft/onnxruntime#28073, drop when ORT >= 1.26.0).
- Fold Shape/Gather chains to constants in det_10g (21ms → 4ms).
- Decompose Split(axis=1) → Slice pairs in GFPGAN (155ms → 89ms).
- Route detection model to GPU so the ANE is free for the swap model.
- Centralize provider/config selection in create_onnx_session.

Pipeline (all platforms):
- Parallelize face landmark + recognition post-detection; skip landmark_2d_106
  when only face_swapper is active.
- Pipeline face detection with swap for ANE overlap.
- GPU-accelerated paste_back, MJPEG capture, zero-copy display path.
- Standalone pipeline benchmark script.

Windows / CUDA:
- CUDA graphs + FP16 model + all-GPU pipeline for 1080p 60 FPS.
- Auto-detect GPU provider and fix DLL discovery for Windows CUDA execution.

Cross-platform:
- platform_info helper for Mac/Windows runtime routing.
- GFPGAN 30 fps + MSMF camera 60 fps with adaptive pipeline tuning.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

5 participants