Skip to content

Conversation

@guoyu-wang
Copy link
Contributor

Description: [NNAPI EP] Add EP option to disable CPU

Motivation and Context

@guoyu-wang guoyu-wang requested a review from a team as a code owner February 5, 2021 22:55
@guoyu-wang guoyu-wang requested a review from skottmckay February 8, 2021 05:58
// using the list of target devices
bool use_create_for_devices = false;
if (!nnapi_target_devices_.empty()) {
bool supported_ops[num_nnapi_ops_];
Copy link
Contributor

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?

Copy link
Contributor Author

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[]>

Copy link
Contributor

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_)


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
Copy link
Contributor

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

Copy link
Contributor Author

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

@guoyu-wang guoyu-wang merged commit 64edcad into master Feb 11, 2021
@guoyu-wang guoyu-wang deleted the gwang-msft/nnapi_device_option branch February 11, 2021 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants