2/x: Add runtime specs support to BackendInitContext#17498
Conversation
Summary:
This diff extends `BackendInitContext` to receive and expose runtime specs (load-time options) to backend delegates. This allows backends to access per-delegate configuration that was passed via `LoadBackendOptionsMap` at `Module::load()` time.
Key changes:
- Added `runtime_specs_` member to `BackendInitContext` storing `Span<const BackendOption>`
- Constructor now accepts optional `runtime_specs` parameter
- Added `runtime_specs()` accessor returning the full span
- Added type-safe getter methods:
- `get_runtime_spec_bool(key)` - Returns `Result<bool>`
- `get_runtime_spec_int(key)` - Returns `Result<int>`
- `get_runtime_spec_string(key)` - Returns `Result<const char*>`
Backend delegates can now retrieve their configuration:
```cpp
Result<const char*> compute_unit = context.get_runtime_spec_string("compute_unit");
if (compute_unit.ok()) {
// Use compute_unit.get()
}
```
Reviewed By: larryliu0820
Differential Revision: D92358600
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17498
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New FailuresAs of commit b74100a with merge base a24d3e7 ( NEW FAILURES - The following jobs have 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 D92358600. |
larryliu0820
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
This PR needs a
|
Summary:
This diff extends
BackendInitContextto receive and expose runtime specs (load-time options) to backend delegates. This allows backends to access per-delegate configuration that was passed viaLoadBackendOptionsMapatModule::load()time.Key changes:
runtime_specs_member toBackendInitContextstoringSpan<const BackendOption>runtime_specsparameterruntime_specs()accessor returning the full spanget_runtime_spec_bool(key)- ReturnsResult<bool>get_runtime_spec_int(key)- ReturnsResult<int>get_runtime_spec_string(key)- ReturnsResult<const char*>Backend delegates can now retrieve their configuration:
Reviewed By: larryliu0820
Differential Revision: D92358600