forked from microsoft/onnxruntime
-
Notifications
You must be signed in to change notification settings - Fork 56
Add QDQ scale propagation pass #713
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
05fcdce
Add pass to perform QDQ stripping and propagate scales
javier-intel 19a5e7b
Fix disconnected outptu node
javier-intel 66587aa
Fixes to support session.disable_quant_qdq output, remove dangling no…
javier-intel 304a8d2
Fix lack of scales updates and remove stray QDQ nodes in certain models
javier-intel ce35466
Address issues with Linux CI
javier-intel e0cc75c
Fix for double QDQ issue
javier-intel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // Copyright (C) Intel Corporation | ||
| // Licensed under the MIT License | ||
|
|
||
| #include "ov_protobuf_utils.h" | ||
|
Check notice on line 4 in onnxruntime/core/providers/openvino/ov_protobuf_utils.cpp
|
||
|
|
||
| #include "core/graph/onnx_protobuf.h" | ||
| #include "core/common/common.h" | ||
|
|
||
| namespace onnxruntime { | ||
| namespace openvino_ep { | ||
| float get_float_initializer_data(const void* initializer) { | ||
| const auto* tp = reinterpret_cast<const ONNX_NAMESPACE::TensorProto*>(initializer); | ||
| ORT_ENFORCE((tp->has_data_type() && (tp->data_type() == ONNX_NAMESPACE::TensorProto_DataType_FLOAT))); | ||
| // ORT_ENFORCE(initializer.dims_size() == 1); | ||
| return tp->float_data(0); | ||
| } | ||
| void set_float_initializer_data(const void* initializer, float data) { | ||
| auto* tp = (ONNX_NAMESPACE::TensorProto*)(initializer); | ||
| ORT_ENFORCE((tp->has_data_type() && (tp->data_type() == ONNX_NAMESPACE::TensorProto_DataType_FLOAT))); | ||
| // ORT_ENFORCE(initializer.dims_size() == 1); | ||
| tp->set_float_data(0, data); | ||
| } | ||
| } // namespace openvino_ep | ||
| } // namespace onnxruntime | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // Copyright (C) Intel Corporation | ||
| // Licensed under the MIT License | ||
|
|
||
| #pragma once | ||
| namespace onnxruntime { | ||
| namespace openvino_ep { | ||
| float get_float_initializer_data(const void* initializer); | ||
| void set_float_initializer_data(const void* initializer, float data); | ||
| } | ||
| } // namespace onnxruntime |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this pass happening even for non quantized models?
Uh oh!
There was an error while loading. Please reload this page.
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.
@preetha-intel, this pass is happening only when the
enable_qdq_optimizerflag is set.Inside the pass it specifically looks for quantized blocks with (u)int16 precision and ignores everything else. So the regular models are not affected by it, even if the flag was passed by accident