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

[MKLDNN] Enable more convolution + activation fusion #14819

Merged
merged 12 commits into from
May 17, 2019

Conversation

ZhennanQin
Copy link
Contributor

Description

This PR enables below fusion pattern for MKLDNN backend:

FP32:
conv+sigmoid
conv+tanh
conv+softrelu
conv+clip(0, n) #(when n=6, it's mxnet version of relu6)

INT8:
conv+clip(0, n) #(when n=6, it's mxnet version of relu6)

Minor change:

  • Fix a bug of partitioning mobilenetV2. The bug is, when loop is detected, build subgraph pass will try to break the loop and try again. During the retry, selector may contain internal state from previous selection, causing unexpected result. The fix is to add reset API for selector to clean up internal state.

@pengzhao-intel @TaoLv @reminisce @anirudh2290

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • 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

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

@ZhennanQin ZhennanQin requested a review from szha as a code owner April 28, 2019 02:06
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.

@TaoLv to review the change inside convolution.

src/operator/nn/mkldnn/mkldnn_act.cc Show resolved Hide resolved
src/operator/nn/mkldnn/mkldnn_base-inl.h Show resolved Hide resolved
src/operator/subgraph/mkldnn/mkldnn_conv.cc Show resolved Hide resolved
@pengzhao-intel
Copy link
Contributor

pengzhao-intel commented May 15, 2019

@ZhennanQin @xinyu-intel please help rebase the code and the TRT issue is fixed now :)

@ZhennanQin
Copy link
Contributor Author

@pengzhao-intel CI can pass now.

@pengzhao-intel
Copy link
Contributor

Great, I am taking a review again and will merge soon.

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.

LGTM, will merge by the end of today if no further comment.

@pengzhao-intel
Copy link
Contributor

Merging now, thanks for the contribution.

@pengzhao-intel pengzhao-intel merged commit 0d77947 into apache:master May 17, 2019
@ZhennanQin ZhennanQin deleted the conv_act branch May 31, 2019 02:07
haohuanw pushed a commit to haohuanw/incubator-mxnet that referenced this pull request Jun 23, 2019
* conv+act fusion

* fix mobilenetv2

* fix lint

* Add comment

* Fix build

* trigger ci

* Fix CutGraphInputs

* Run CI

* run ci

* trigger
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