Register fake grad to subgraph and quantized operators#14275
Register fake grad to subgraph and quantized operators#14275reminisce merged 9 commits intoapache:masterfrom
Conversation
|
MI, this is a temp solution to enable GluonCV INT8 flow and we will revert it after the improvement of CachedOP is done. |
reminisce
left a comment
There was a problem hiding this comment.
LGTM. One suggestion, please add TODO(owner's name): some statement in the code as a reminder for future maintenance.
|
Is it possible to merge this PR into #14276 ? @xinyu-intel @ZhennanQin @pengzhao-intel |
|
@ZhennanQin I'm afraid this PR has side effect if it's merged before #14276 . Reverting should not be a big deal as it only changes 9 lines. We always need a PR to revert changes. |
|
Avoiding side effect and keeping master branch healthy is the benefit. |
|
Merge with correct order can have same benefit:) |
|
@xinyu-intel Please collect #14276 into this PR as @TaoLv suggests. |
|
@mxnet-label-bot add [pr-awaiting-review] |
|
@TaoLv please help review again :) |
| static SubgraphPropertyPtr Create() { | ||
| return std::make_shared<SgMKLDNNConvPostQuantizeProperty>(); | ||
| auto property = std::make_shared<SgMKLDNNConvPostQuantizeProperty>(); | ||
| property->SetAttr<std::string>("prop_name", |
There was a problem hiding this comment.
Nit: can we use "property_name" or just "name" here? Because "prop" also stands for "propagation" somewhere.
|
@reminisce Can you take a look at the changes for subgraph? |
pengzhao-intel
left a comment
There was a problem hiding this comment.
LGTM
@reminisce please help confirm the subgraph related changes :)
| .set_attr<nnvm::FInferType>("FInferType", QuantizeType) | ||
| .set_attr<FInferStorageType>("FInferStorageType", QuantizeStorageType) | ||
| // TODO(Xinyu): a temp solution to enable GluonCV INT8 flow, | ||
| // will be reverted after the improvement of CachedOP is done. |
There was a problem hiding this comment.
is this currently WIP ? can you open an issue for this
| LOG(INFO) << "Skip subgraph " << full_name << " as it requires `grad_req=null`."; | ||
| return src; | ||
| } | ||
| } |
There was a problem hiding this comment.
can we add a test for this case: module bound with for_training=True, and the symbol reused to invoke graph partitioning with MKLDNN. The returned symbol shouldn't contain mkldnn subgraph ops.
There was a problem hiding this comment.
The problem is, we can't get the symbol after module bound. So we can't check if MKLDNN graph partitioning happens or not.
There was a problem hiding this comment.
Why can't we use mod._sym and call get_backend_symbol("MKLDNN") on it?
There was a problem hiding this comment.
Because there's no python API can return the partitioned symbol after bind, even mod._sym holds the original symbol. And get_backend_symbol("MKLDNN") will apply partition and won't skip inference_only pass. inference_only only works for bind.
* add fake grad * Skip inference only subgraph pass when gradient is needed. * add fake grad to quantizev2 * add TODO * modify prop_name to property_name * add test case
* add fake grad * Skip inference only subgraph pass when gradient is needed. * add fake grad to quantizev2 * add TODO * modify prop_name to property_name * add test case
* add fake grad * Skip inference only subgraph pass when gradient is needed. * add fake grad to quantizev2 * add TODO * modify prop_name to property_name * add test case
Description
Motivation:
Register fake grad to subgraph and quantized operators to support loading back JSON files which contain inference_only operators as symbolblock to run gluon inference.
@pengzhao-intel @TaoLv @ZhennanQin @reminisce
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments