{"action":"created","issue":{"url":"https://api.github.com/repos/apache/incubator-mxnet/issues/11577","repository_url":"https://api.github.com/repos/apache/incubator-mxnet","labels_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/11577/labels{/name}","comments_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/11577/comments","events_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/11577/events","html_url":"https://github.com/apache/incubator-mxnet/pull/11577","id":338837109,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5NjY4NTk1","number":11577,"title":"Fix flaky test test_gluon.test_hybrid_static_memory_switching","user":{"login":"zheng-da","id":70481,"node_id":"MDQ6VXNlcjcwNDgx","avatar_url":"https://avatars1.githubusercontent.com/u/70481?v=4","gravatar_id":"","url":"https://api.github.com/users/zheng-da","html_url":"https://github.com/zheng-da","followers_url":"https://api.github.com/users/zheng-da/followers","following_url":"https://api.github.com/users/zheng-da/following{/other_user}","gists_url":"https://api.github.com/users/zheng-da/gists{/gist_id}","starred_url":"https://api.github.com/users/zheng-da/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zheng-da/subscriptions","organizations_url":"https://api.github.com/users/zheng-da/orgs","repos_url":"https://api.github.com/users/zheng-da/repos","events_url":"https://api.github.com/users/zheng-da/events{/privacy}","received_events_url":"https://api.github.com/users/zheng-da/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-07-06T07:39:38Z","updated_at":"2018-07-07T19:20:58Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/apache/incubator-mxnet/pulls/11577","html_url":"https://github.com/apache/incubator-mxnet/pull/11577","diff_url":"https://github.com/apache/incubator-mxnet/pull/11577.diff","patch_url":"https://github.com/apache/incubator-mxnet/pull/11577.patch"},"body":"## Description ##\r\nThis is to fix the flaky test https://github.com/apache/incubator-mxnet/issues/11171\r\nThere was a race condition when we invalidate MKLDNN memory in NDArray. The original code invalidates MKLDNN memory in the memory planning phase (AsArray) as well, which is called outside the threaded engine. The static memory allocation mode of CachedOp shares the same NDArrays in different model executions. Therefore, the NDArrays may still be used in the threaded engine from the previous model execution, while the same CachedOp is executed for the next execution and the same NDArrays are used in memory planning. With MKLDNN enabled, NDArrays were modified in the memory planning phase, which leads to race condition.\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"},"comment":{"url":"https://api.github.com/repos/apache/incubator-mxnet/issues/comments/403237604","html_url":"https://github.com/apache/incubator-mxnet/pull/11577#issuecomment-403237604","issue_url":"https://api.github.com/repos/apache/incubator-mxnet/issues/11577","id":403237604,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzIzNzYwNA==","user":{"login":"zheng-da","id":70481,"node_id":"MDQ6VXNlcjcwNDgx","avatar_url":"https://avatars1.githubusercontent.com/u/70481?v=4","gravatar_id":"","url":"https://api.github.com/users/zheng-da","html_url":"https://github.com/zheng-da","followers_url":"https://api.github.com/users/zheng-da/followers","following_url":"https://api.github.com/users/zheng-da/following{/other_user}","gists_url":"https://api.github.com/users/zheng-da/gists{/gist_id}","starred_url":"https://api.github.com/users/zheng-da/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zheng-da/subscriptions","organizations_url":"https://api.github.com/users/zheng-da/orgs","repos_url":"https://api.github.com/users/zheng-da/repos","events_url":"https://api.github.com/users/zheng-da/events{/privacy}","received_events_url":"https://api.github.com/users/zheng-da/received_events","type":"User","site_admin":false},"created_at":"2018-07-07T19:20:58Z","updated_at":"2018-07-07T19:20:58Z","author_association":"CONTRIBUTOR","body":"this is a general problem. That is, we shouldn't modify NDArray outside the threaded engine. I don't think we should treat InvalidateMKLDNNData() so specially.\r\nInvalidateMKLDNNData() will be removed once we move MKLDNN to subgraphs."}}
{"actor":{"display_login":"zheng-da"}}