-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[NNAPI EP] Add EP option to disable CPU #6593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| // using the list of target devices | ||
| bool use_create_for_devices = false; | ||
| if (!nnapi_target_devices_.empty()) { | ||
| bool supported_ops[num_nnapi_ops_]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think that the array needs to have a constant value as the dimension. interestingly, it seems only MSVC fails to compile something like this. https://godbolt.org/z/G96c3Y
maybe use std::unique_ptr<bool[]> instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know that, changed to use std::unique_ptr<bool[]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, would also suggest using onnxruntime::make_unique<bool[]>(num_nnapi_ops_)
include/onnxruntime/core/providers/nnapi/nnapi_provider_factory.h
Outdated
Show resolved
Hide resolved
|
|
||
| auto* it = std::find(supported_ops, supported_ops + num_nnapi_ops_, false); | ||
| if (it != supported_ops + num_nnapi_ops_) { | ||
| // There are some ops not supported by the list of the target devices |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: std::any_of may be slightly clearer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to std::all_of
Description: [NNAPI EP] Add EP option to disable CPU
Motivation and Context