Add BackendOption loading to swift bindings (#18855)#18855
Add BackendOption loading to swift bindings (#18855)#18855metascroy wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18855
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 9 New Failures, 5 Pending, 6 Unrelated FailuresAs of commit 52b3fc8 with merge base 875f7c8 ( NEW FAILURES - The following jobs have failed:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
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 D100710833. |
This PR needs a
|
Summary:
Add backend options support to the ExecuTorch Swift/ObjC bindings.
The C++ Module class supports LoadBackendOptionsMap for passing per-delegate configuration (e.g. compute unit, thread count, cache directory) at model load time, but this was not exposed through the Swift/ObjC layer. This diff adds:
A new ExecuTorchBackendOption ObjC class (BackendOption in Swift) representing a single key-value configuration option with support for boolean, integer, and string value types.
New load and loadMethod overloads on ExecuTorchModule that accept a dictionary mapping backend identifiers to arrays of backend options.
Swift extensions providing idiomatic load(backendOptions:verification:) and load(_:backendOptions:) APIs on Module.
```
let module = Module(filePath: "model.pte")
try module.load(backendOptions: [
"CoreMLBackend": [
BackendOption("compute_unit", "cpu_and_gpu"),
BackendOption("num_threads", 4),
BackendOption("use_cache", true),
]
])
```
Differential Revision: D100710833
2a5c762 to
52b3fc8
Compare
Summary:
Add backend options support to the ExecuTorch Swift/ObjC bindings.
The C++ Module class supports LoadBackendOptionsMap for passing per-delegate configuration (e.g. compute unit, thread count, cache directory) at model load time, but this was not exposed through the Swift/ObjC layer. This diff adds:
A new ExecuTorchBackendOption ObjC class (BackendOption in Swift) representing a single key-value configuration option with support for boolean, integer, and string value types.
New load and loadMethod overloads on ExecuTorchModule that accept a dictionary mapping backend identifiers to arrays of backend options.
Swift extensions providing idiomatic load(backendOptions:verification:) and load(_:backendOptions:) APIs on Module.
Differential Revision: D100710833