Skip to content
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

[QDQ] Add shared NodeUnit class #10052

Merged
merged 8 commits into from
Dec 17, 2021
Merged

[QDQ] Add shared NodeUnit class #10052

merged 8 commits into from
Dec 17, 2021

Conversation

guoyu-wang
Copy link
Contributor

@guoyu-wang guoyu-wang commented Dec 15, 2021

Description: Add NodeUnit class

Motivation and Context

  • To avoid excessively large PR, the NNAPI QDQ integration is splitted into the following small tasks

  • 1. Add shared NodeUnit class (this PR)

  • 2. Move NNAPI EP to use NodeUnit IODef for non-QDQ ops

  • 3. Add shared QDQ selectors

  • 4. Hookup NNAPI GetCapability/Compile with shared QDQ selectors

  • 5. Enable QDQ for ops with QLinear version (QLinear[Conv/Matmul/Pool/...])

  • 6. Enable QDQ for ops without QLinear Version

  • This is step 1 of the tasks, we add the shared NodeUnit and move NNAPI builder interface to take NodeUnit, the NNAPI builders still work as before, we have not yet converted the quantized input of some QLinear ops to quant_params, which will be covered in step 2 (there are some code (later removed from onnxruntime/core/providers/shared/node_unit/node_unit.cc) in this commit of the PR)

  • The shared NodeUnit class will be shared between a single Node or a QDQ group, which will both be treated as a unit with necessary functions, the main difference between a Node interface and a NodeUnit interface is the IODef which embed the input with its quantization params (scale and ZP), which defines a consistent way to retrieve quantization information for input and output

…lder.cc

Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
namespace onnxruntime {
namespace nnapi {

using onnxruntime::NodeUnit;
Copy link
Contributor

Choose a reason for hiding this comment

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

why are these using declarations needed? I didn't see any unqualified usages of vector or string in this file, and the NodeUnit usage is in the onnxruntime namespace

Copy link
Contributor

Choose a reason for hiding this comment

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

similar comment for other source files

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 got compile error if I don't do this, unless I add onnxruntime:: namespace to the NodeUnit

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, is there another NodeUnit somewhere? just curious

Copy link
Contributor Author

@guoyu-wang guoyu-wang Dec 16, 2021

Choose a reason for hiding this comment

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

There is no other NodeUnit defined, the complier is trying to find onnxruntime::nnapi::NodeUnit, added using for simplicity, otherwise it will be onnxruntime::NodeUnit every where

Copy link
Contributor

Choose a reason for hiding this comment

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

that's odd - how is something like onnxruntime::GraphViewer working?

onnxruntime/core/providers/shared/node_unit/node_unit.cc Outdated Show resolved Hide resolved
onnxruntime/core/providers/shared/node_unit/node_unit.cc Outdated Show resolved Hide resolved
@snnn
Copy link
Member

snnn commented Dec 16, 2021

/azp run orttraining-amd-gpu-ci-pipeline

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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.

3 participants