Add CoreML backend options with compute unit configuration (#18369)#18369
Add CoreML backend options with compute unit configuration (#18369)#18369metascroy wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18369
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 42 PendingAs of commit 73c5fdb with merge base fd1581d ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@metascroy has exported this pull request. If you are a Meta employee, you can view the originating Diff in D92358632. |
This PR needs a
|
…8369) Summary: This diff adds type-safe backend options support to the CoreML delegate, allowing users to configure compute units (CPU, GPU, Neural Engine) at model load time using the new `LoadBackendOptionsMap` infrastructure. Key changes: - Added `LoadOptionsBuilder` class in `coreml_backend_options.h` providing a fluent API for setting CoreML options with compile-time type safety - `ComputeUnit` enum nested inside the builder for type-safe compute unit selection (CPU_ONLY, CPU_AND_GPU, CPU_AND_NE, ALL) - Integrated runtime spec retrieval in `backend_delegate.mm` to read `compute_unit` option from `BackendInitContext` - Added comprehensive unit tests for the new options builder Example usage: ```cpp using executorch::backends::coreml::LoadOptionsBuilder; LoadOptionsBuilder coreml_opts; coreml_opts.setComputeUnit(LoadOptionsBuilder::ComputeUnit::CPU_AND_GPU); LoadBackendOptionsMap map; map.set_options(coreml_opts); module.load(method_name, map); ``` Differential Revision: D92358632
2a8f128 to
bbcb82f
Compare
…8369) Summary: Pull Request resolved: pytorch#18369 This diff adds type-safe backend options support to the CoreML delegate, allowing users to configure compute units (CPU, GPU, Neural Engine) at model load time using the new `LoadBackendOptionsMap` infrastructure. Key changes: - Added `LoadOptionsBuilder` class in `coreml_backend_options.h` providing a fluent API for setting CoreML options with compile-time type safety - `ComputeUnit` enum nested inside the builder for type-safe compute unit selection (CPU_ONLY, CPU_AND_GPU, CPU_AND_NE, ALL) - Integrated runtime spec retrieval in `backend_delegate.mm` to read `compute_unit` option from `BackendInitContext` - Added comprehensive unit tests for the new options builder Example usage: ```cpp using executorch::backends::coreml::LoadOptionsBuilder; LoadOptionsBuilder coreml_opts; coreml_opts.setComputeUnit(LoadOptionsBuilder::ComputeUnit::CPU_AND_GPU); LoadBackendOptionsMap map; map.set_options(coreml_opts); module.load(method_name, map); ``` Differential Revision: D92358632
bbcb82f to
73c5fdb
Compare
Summary:
This diff adds type-safe backend options support to the CoreML delegate, allowing users to configure compute units (CPU, GPU, Neural Engine) at model load time using the new
LoadBackendOptionsMapinfrastructure.Key changes:
LoadOptionsBuilderclass incoreml_backend_options.hproviding a fluent API for setting CoreML options with compile-time type safetyComputeUnitenum nested inside the builder for type-safe compute unit selection (CPU_ONLY, CPU_AND_GPU, CPU_AND_NE, ALL)backend_delegate.mmto readcompute_unitoption fromBackendInitContextExample usage:
Differential Revision: D92358632