{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments/225036651","pull_request_review_id":164547958,"id":225036651,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNTAzNjY1MQ==","diff_hunk":"@@ -147,6 +147,8 @@ static MKLDNNActForward &GetActForward(const ActivationParam& param,\n   auto it = fwds.find(key);\n   if (it == fwds.end()) {\n     MKLDNNActForward fwd(param, ctx.is_train, in_data, in_mem);\n+    if (MKLDNNCacheExceeded(fwds.size()))\n+      fwds.clear();","path":"src/operator/nn/mkldnn/mkldnn_act.cc","position":5,"original_position":5,"commit_id":"0bb4cd9a06c76d5203f567d8056ca80d419cc8c9","original_commit_id":"0bb4cd9a06c76d5203f567d8056ca80d419cc8c9","user":{"login":"ZhennanQin","id":39290748,"node_id":"MDQ6VXNlcjM5MjkwNzQ4","avatar_url":"https://avatars2.githubusercontent.com/u/39290748?v=4","gravatar_id":"","url":"https://api.github.com/users/ZhennanQin","html_url":"https://github.com/ZhennanQin","followers_url":"https://api.github.com/users/ZhennanQin/followers","following_url":"https://api.github.com/users/ZhennanQin/following{/other_user}","gists_url":"https://api.github.com/users/ZhennanQin/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhennanQin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhennanQin/subscriptions","organizations_url":"https://api.github.com/users/ZhennanQin/orgs","repos_url":"https://api.github.com/users/ZhennanQin/repos","events_url":"https://api.github.com/users/ZhennanQin/events{/privacy}","received_events_url":"https://api.github.com/users/ZhennanQin/received_events","type":"User","site_admin":false},"body":"Shall we just randomly remove one from fwds and insert the new one? It's more reasonable to remove the first inserting one that not be reused, but it's hard to achieve. Randomly removing is acceptable. Our target is balancing cache size with performance. Flushing cache isn't the best choice. ","created_at":"2018-10-15T04:41:13Z","updated_at":"2018-10-15T04:41:22Z","html_url":"https://github.com/apache/incubator-mxnet/pull/12746#discussion_r225036651","pull_request_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12746","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments/225036651"},"html":{"href":"https://github.com/apache/incubator-mxnet/pull/12746#discussion_r225036651"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12746"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12746","id":220840036,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwODQwMDM2","html_url":"https://github.com/apache/incubator-mxnet/pull/12746","diff_url":"https://github.com/apache/incubator-mxnet/pull/12746.diff","patch_url":"https://github.com/apache/incubator-mxnet/pull/12746.patch","issue_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/12746","number":12746,"state":"open","locked":false,"title":"Add env flag to disable MKLDNN cache (MXNET_MKLDNN_CACHE_ENABLED)","user":{"login":"azai91","id":8272546,"node_id":"MDQ6VXNlcjgyNzI1NDY=","avatar_url":"https://avatars2.githubusercontent.com/u/8272546?v=4","gravatar_id":"","url":"https://api.github.com/users/azai91","html_url":"https://github.com/azai91","followers_url":"https://api.github.com/users/azai91/followers","following_url":"https://api.github.com/users/azai91/following{/other_user}","gists_url":"https://api.github.com/users/azai91/gists{/gist_id}","starred_url":"https://api.github.com/users/azai91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azai91/subscriptions","organizations_url":"https://api.github.com/users/azai91/orgs","repos_url":"https://api.github.com/users/azai91/repos","events_url":"https://api.github.com/users/azai91/events{/privacy}","received_events_url":"https://api.github.com/users/azai91/received_events","type":"User","site_admin":false},"body":"## Description ##\r\nMKLDNN by default caches mkldnn memory and primitives to performance reasons. The cache looks uses input shape as a key. However, when models accept variable size inputs, the cache constantly grows and is not cleared. A flag is added MXNET_MKLDNN_CACHE_ENABLED that will disable this.\r\n\r\nIn a future PR, we can clear the cache automatically if it growths a certain length.\r\n\r\n## Checklist ##\r\n### Essentials ###\r\nPlease feel free to remove inapplicable items for your PR.\r\n- [ ] The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant [JIRA issue](https://issues.apache.org/jira/projects/MXNET/issues) created (except PRs with tiny changes)\r\n- [ ] Changes are complete (i.e. I finished coding on this PR)\r\n- [ ] All changes have test coverage:\r\n- Unit tests are added for small changes to verify correctness (e.g. adding a new operator)\r\n- Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)\r\n- Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)\r\n- [ ] Code is well-documented: \r\n- For user-facing API changes, API doc string has been updated. \r\n- For new C++ functions in header files, their functionalities and arguments are documented. \r\n- 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\r\n- Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html\r\n- [ ] To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change\r\n\r\n### Changes ###\r\n- [ ] Add flag (MXNET_MKLDNN_CACHE_ENABLED) to disable cache.\r\n\r\n## Comments ##\r\n- If this change is a backward incompatible change, why must this change be made.\r\n- Interesting edge cases to note here\r\n","created_at":"2018-10-05T22:32:54Z","updated_at":"2018-10-15T04:41:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c1b2eed4cbe1a856325cd173ce74cd1c576a9f60","assignee":null,"assignees":[],"requested_reviewers":[{"login":"anirudh2290","id":1522319,"node_id":"MDQ6VXNlcjE1MjIzMTk=","avatar_url":"https://avatars1.githubusercontent.com/u/1522319?v=4","gravatar_id":"","url":"https://api.github.com/users/anirudh2290","html_url":"https://github.com/anirudh2290","followers_url":"https://api.github.com/users/anirudh2290/followers","following_url":"https://api.github.com/users/anirudh2290/following{/other_user}","gists_url":"https://api.github.com/users/anirudh2290/gists{/gist_id}","starred_url":"https://api.github.com/users/anirudh2290/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anirudh2290/subscriptions","organizations_url":"https://api.github.com/users/anirudh2290/orgs","repos_url":"https://api.github.com/users/anirudh2290/repos","events_url":"https://api.github.com/users/anirudh2290/events{/privacy}","received_events_url":"https://api.github.com/users/anirudh2290/received_events","type":"User","site_admin":false},{"login":"szha","id":2626883,"node_id":"MDQ6VXNlcjI2MjY4ODM=","avatar_url":"https://avatars2.githubusercontent.com/u/2626883?v=4","gravatar_id":"","url":"https://api.github.com/users/szha","html_url":"https://github.com/szha","followers_url":"https://api.github.com/users/szha/followers","following_url":"https://api.github.com/users/szha/following{/other_user}","gists_url":"https://api.github.com/users/szha/gists{/gist_id}","starred_url":"https://api.github.com/users/szha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szha/subscriptions","organizations_url":"https://api.github.com/users/szha/orgs","repos_url":"https://api.github.com/users/szha/repos","events_url":"https://api.github.com/users/szha/events{/privacy}","received_events_url":"https://api.github.com/users/szha/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":978567321,"node_id":"MDU6TGFiZWw5Nzg1NjczMjE=","url":"https://api.github.com/repos/apache/incubator-mxnet/labels/MKLDNN","name":"MKLDNN","color":"fbca04","default":false},{"id":1018798522,"node_id":"MDU6TGFiZWwxMDE4Nzk4NTIy","url":"https://api.github.com/repos/apache/incubator-mxnet/labels/pr-awaiting-review","name":"pr-awaiting-review","color":"d93f0b","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12746/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12746/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/12746/comments","statuses_url":"https://api.github.com/repos/apache/incubator-mxnet/statuses/0bb4cd9a06c76d5203f567d8056ca80d419cc8c9","head":{"label":"azai91:fix/env-disable-mkldnn-cache","ref":"fix/env-disable-mkldnn-cache","sha":"0bb4cd9a06c76d5203f567d8056ca80d419cc8c9","user":{"login":"azai91","id":8272546,"node_id":"MDQ6VXNlcjgyNzI1NDY=","avatar_url":"https://avatars2.githubusercontent.com/u/8272546?v=4","gravatar_id":"","url":"https://api.github.com/users/azai91","html_url":"https://github.com/azai91","followers_url":"https://api.github.com/users/azai91/followers","following_url":"https://api.github.com/users/azai91/following{/other_user}","gists_url":"https://api.github.com/users/azai91/gists{/gist_id}","starred_url":"https://api.github.com/users/azai91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azai91/subscriptions","organizations_url":"https://api.github.com/users/azai91/orgs","repos_url":"https://api.github.com/users/azai91/repos","events_url":"https://api.github.com/users/azai91/events{/privacy}","received_events_url":"https://api.github.com/users/azai91/received_events","type":"User","site_admin":false},"repo":{"id":109348168,"node_id":"MDEwOlJlcG9zaXRvcnkxMDkzNDgxNjg=","name":"incubator-mxnet","full_name":"azai91/incubator-mxnet","private":false,"owner":{"login":"azai91","id":8272546,"node_id":"MDQ6VXNlcjgyNzI1NDY=","avatar_url":"https://avatars2.githubusercontent.com/u/8272546?v=4","gravatar_id":"","url":"https://api.github.com/users/azai91","html_url":"https://github.com/azai91","followers_url":"https://api.github.com/users/azai91/followers","following_url":"https://api.github.com/users/azai91/following{/other_user}","gists_url":"https://api.github.com/users/azai91/gists{/gist_id}","starred_url":"https://api.github.com/users/azai91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azai91/subscriptions","organizations_url":"https://api.github.com/users/azai91/orgs","repos_url":"https://api.github.com/users/azai91/repos","events_url":"https://api.github.com/users/azai91/events{/privacy}","received_events_url":"https://api.github.com/users/azai91/received_events","type":"User","site_admin":false},"html_url":"https://github.com/azai91/incubator-mxnet","description":"Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more","fork":true,"url":"https://api.github.com/repos/azai91/incubator-mxnet","forks_url":"https://api.github.com/repos/azai91/incubator-mxnet/forks","keys_url":"https://api.github.com/repos/azai91/incubator-mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azai91/incubator-mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azai91/incubator-mxnet/teams","hooks_url":"https://api.github.com/repos/azai91/incubator-mxnet/hooks","issue_events_url":"https://api.github.com/repos/azai91/incubator-mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/azai91/incubator-mxnet/events","assignees_url":"https://api.github.com/repos/azai91/incubator-mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/azai91/incubator-mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/azai91/incubator-mxnet/tags","blobs_url":"https://api.github.com/repos/azai91/incubator-mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azai91/incubator-mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azai91/incubator-mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/azai91/incubator-mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azai91/incubator-mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/azai91/incubator-mxnet/languages","stargazers_url":"https://api.github.com/repos/azai91/incubator-mxnet/stargazers","contributors_url":"https://api.github.com/repos/azai91/incubator-mxnet/contributors","subscribers_url":"https://api.github.com/repos/azai91/incubator-mxnet/subscribers","subscription_url":"https://api.github.com/repos/azai91/incubator-mxnet/subscription","commits_url":"https://api.github.com/repos/azai91/incubator-mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/azai91/incubator-mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/azai91/incubator-mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/azai91/incubator-mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/azai91/incubator-mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/azai91/incubator-mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azai91/incubator-mxnet/merges","archive_url":"https://api.github.com/repos/azai91/incubator-mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azai91/incubator-mxnet/downloads","issues_url":"https://api.github.com/repos/azai91/incubator-mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/azai91/incubator-mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/azai91/incubator-mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/azai91/incubator-mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azai91/incubator-mxnet/labels{/name}","releases_url":"https://api.github.com/repos/azai91/incubator-mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/azai91/incubator-mxnet/deployments","created_at":"2017-11-03T03:32:21Z","updated_at":"2018-06-18T18:50:56Z","pushed_at":"2018-10-12T22:23:51Z","git_url":"git://github.com/azai91/incubator-mxnet.git","ssh_url":"git@github.com:azai91/incubator-mxnet.git","clone_url":"https://github.com/azai91/incubator-mxnet.git","svn_url":"https://github.com/azai91/incubator-mxnet","homepage":"http://mxnet.io","size":47094,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"49689007b680c371e80333f525a7210600f28d48","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":34864402,"node_id":"MDEwOlJlcG9zaXRvcnkzNDg2NDQwMg==","name":"incubator-mxnet","full_name":"apache/incubator-mxnet","private":false,"owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/apache/incubator-mxnet","description":"Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more","fork":false,"url":"https://api.github.com/repos/apache/incubator-mxnet","forks_url":"https://api.github.com/repos/apache/incubator-mxnet/forks","keys_url":"https://api.github.com/repos/apache/incubator-mxnet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-mxnet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-mxnet/teams","hooks_url":"https://api.github.com/repos/apache/incubator-mxnet/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-mxnet/events","assignees_url":"https://api.github.com/repos/apache/incubator-mxnet/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-mxnet/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-mxnet/tags","blobs_url":"https://api.github.com/repos/apache/incubator-mxnet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-mxnet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-mxnet/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-mxnet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-mxnet/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-mxnet/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-mxnet/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-mxnet/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-mxnet/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-mxnet/subscription","commits_url":"https://api.github.com/repos/apache/incubator-mxnet/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-mxnet/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-mxnet/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-mxnet/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-mxnet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-mxnet/merges","archive_url":"https://api.github.com/repos/apache/incubator-mxnet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-mxnet/downloads","issues_url":"https://api.github.com/repos/apache/incubator-mxnet/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-mxnet/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-mxnet/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-mxnet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-mxnet/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-mxnet/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-mxnet/deployments","created_at":"2015-04-30T16:21:15Z","updated_at":"2018-10-15T02:58:14Z","pushed_at":"2018-10-14T19:18:32Z","git_url":"git://github.com/apache/incubator-mxnet.git","ssh_url":"git@github.com:apache/incubator-mxnet.git","clone_url":"https://github.com/apache/incubator-mxnet.git","svn_url":"https://github.com/apache/incubator-mxnet","homepage":"https://mxnet.apache.org","size":46672,"stargazers_count":15392,"watchers_count":15392,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5559,"mirror_url":null,"archived":false,"open_issues_count":887,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":5559,"open_issues":887,"watchers":15392,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12746"},"html":{"href":"https://github.com/apache/incubator-mxnet/pull/12746"},"issue":{"href":"https://api.github.com/repos/apache/incubator-mxnet/issues/12746"},"comments":{"href":"https://api.github.com/repos/apache/incubator-mxnet/issues/12746/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12746/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-mxnet/pulls/12746/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-mxnet/statuses/0bb4cd9a06c76d5203f567d8056ca80d419cc8c9"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ZhennanQin"}}