Skip to content

Provide API to query backend availability at runtime #8267

@GregoryComer

Description

@GregoryComer

🚀 The feature, motivation and pitch

Internally, backends implement an is_available method to determine if the backend is actually present at runtime (detecting where a supported NPU is present, for example). To my knowledge, this isn't actually exposed through the public runtime API surface.

This is an important usability feature for users who want to support multiple delegates, as users need a way to determine which hardware is actually present at runtime. It is more or less required for people to be able to use NPU delegates, unless some other solution exists to solve this.

This could be done by simply adding a method to the core runtime to enumerate available backends. Alternatively, there was an ongoing discussion and design proposal for generalized backend capabilities that may also provide this functionality (I believe @guangy10 was driving this a while back).

Edit: More clearly enumerating the problem and use case, imagine you are a user that wants to target one or more NPUs on Android, falling back to CPU if none are available. You generate a PTE for each backend. How do you know which one to actually load at runtime? Ideally, executorch should be able to just say qualcomm and xnnpack backends are available, for example, or maybe just xnnpack on a device without a supported qualcomm NPU. The user code can then choose a .pte based on this information.

Alternatives

No response

Additional context

No response

RFC (Optional)

No response

cc @JacobSzwejbka @dbort @mergennachin @byjlw

Metadata

Metadata

Assignees

Labels

module: runtimeIssues related to the core runtime and code under runtime/module: user experienceIssues related to reducing friction for userstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

Status

Done

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions