Skip to content

2/x: Add runtime specs support to BackendInitContext#17498

Merged
meta-codesync[bot] merged 1 commit into
pytorch:mainfrom
metascroy:export-D92358600
Feb 18, 2026
Merged

2/x: Add runtime specs support to BackendInitContext#17498
meta-codesync[bot] merged 1 commit into
pytorch:mainfrom
metascroy:export-D92358600

Conversation

@metascroy
Copy link
Copy Markdown
Contributor

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:

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

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
@metascroy metascroy requested a review from cccclai as a code owner February 17, 2026 19:26
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Feb 17, 2026

🔗 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 Failures

As of commit b74100a with merge base a24d3e7 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 17, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented Feb 17, 2026

@metascroy has exported this pull request. If you are a Meta employee, you can view the originating Diff in D92358600.

Copy link
Copy Markdown
Contributor

@larryliu0820 larryliu0820 left a comment

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@github-actions
Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@meta-codesync meta-codesync Bot merged commit 83fd8d0 into pytorch:main Feb 18, 2026
313 of 326 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants