Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[MKLDNN] fix uint8 batch norm memory misuse #16034

Merged
merged 2 commits into from
Aug 30, 2019

Conversation

ElaineBao
Copy link
Contributor

@ElaineBao ElaineBao commented Aug 29, 2019

Description

When using MKLDNN batch norm, uint8 input needs to be reordered (since MKLDNN bn only supports int8 input). This pr is to address the misuse of original data memory and reordered data memory.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • fix uint8 bn reorder memory
  • update resnet152-v2 int8 acc

Performance

model FP32 (Top-1 / Top-5) Fusion + int8 bn
resnet152-v2 76.65% / 93.07% 76.25% / 92.89%

@pengzhao-intel @ZhennanQin @ciyongch

@pengzhao-intel
Copy link
Contributor

@ZhennanQin please help take a review.

Copy link
Contributor

@ZhennanQin ZhennanQin left a comment

Choose a reason for hiding this comment

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

Please add a uint8 test for this.

@ElaineBao
Copy link
Contributor Author

ElaineBao commented Aug 30, 2019

Please add a uint8 test for this.

uint8 bn test case has been added at:
https://github.com/apache/incubator-mxnet/blob/master/tests/python/quantization/test_quantization.py#L675-L678

Copy link
Contributor

@ZhennanQin ZhennanQin left a comment

Choose a reason for hiding this comment

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

OK. LGTM.

Copy link
Contributor

@pengzhao-intel pengzhao-intel left a comment

Choose a reason for hiding this comment

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

Thanks for the fixing and merging now.

@pengzhao-intel pengzhao-intel merged commit 9173dad into apache:master Aug 30, 2019
zixuanweeei pushed a commit to zixuanweeei/mxnet that referenced this pull request Sep 2, 2019
* fix uint8 bn reorder memomry

* update resnet152-v2 int8 acc
@ElaineBao ElaineBao deleted the uint8-bn-mem branch April 14, 2020 00:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants