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

Fix Cached_op with static_shape=true #15298

Merged
merged 2 commits into from
Jun 27, 2019

Conversation

ZhennanQin
Copy link
Contributor

Description

Should address #15281

@pengzhao-intel @TaoLv @junrushao1994 @zheng-da

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

Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the fix :-)

@Roshrini Roshrini added the pr-awaiting-review PR is waiting for code review label Jun 23, 2019
@ZhennanQin
Copy link
Contributor Author

#15297 should be fixed with this PR.

@pengzhao-intel
Copy link
Contributor

@anirudh2290 @roywei please take a review.

@roywei
Copy link
Member

roywei commented Jun 25, 2019

The segfault & core dump is fixed.
On sockeye side, I'm still getting 8 unit test failed with python3 setup.py test


============================================= 8 failed, 536 passed in 42.53 seconds ==============================================
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
  File "/home/ubuntu/incubator-mxnet/python/mxnet/_ctypes/ndarray.py", line 51, in __del__
AttributeError: 'NoneType' object has no attribute 'MXNDArrayFree'

all failure seems to happen at sockeye side.

        # Bucket sentences as padded np arrays
>       for source, target in zip(source_list, target_sentences):
E       TypeError: zip argument #1 must support iteration

}
CHECK_EQ(outputs.size(), in_grad_.size());
for (size_t i = 0; i < outputs.size(); ++i) in_grad_[i] = outputs[i];
bwd_init_ = true;
Copy link
Member

Choose a reason for hiding this comment

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

this caching was first removed in #14738 . I think this has certain performance implications since we are not caching the TBlobs anymore. Is the use case also similar, is this caused by split operator ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When using legacy ops in Cached_op, this caching is not correct, because even static_alloc=true and static_shape=true, the input or output TBlobs may changed if they are the input or output of Cached_op.

Thinking a small case that end-user only hybridize one legacy op, then its input is the Cached_op's input, and also for output. Then end-user may pass different NDArrays to this Cached_op, and this TBlobs cache isn't correct.

Copy link
Member

Choose a reason for hiding this comment

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

okay, thanks for clarifying!

@ZhennanQin
Copy link
Contributor Author

@roywei
On my side, sockeye has only 2 failures after this fix:

test/unit/test_data_io.py::test_parallel_sample_iter FAILED
test/unit/test_data_io.py::test_sharded_parallel_sample_iter FAILED

Those failures are also reproducible before merging trouble PR: 09202f7.

So I think those sockeye failures doesn't relate to that PR.

Copy link
Member

@roywei roywei left a comment

Choose a reason for hiding this comment

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

I have verified this resolves the sockeye failure, remaining test failures should be fixed at sockeye side. it's not related to cached op. Thanks for the fix!

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

@pengzhao-intel
Copy link
Contributor

pengzhao-intel commented Jun 26, 2019

@ZhennanQin Please verify the performance of this PR with our internal tests and NLP tests.
If everything is OK, I will merge this soon.

Copy link
Member

@anirudh2290 anirudh2290 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 quick fix

@ZhennanQin
Copy link
Contributor Author

ZhennanQin commented Jun 27, 2019

@pengzhao-intel Tested symbolic & gluon inference speed and bert, seems everything works fine.

@pengzhao-intel
Copy link
Contributor

Thanks, merging now.

@pengzhao-intel pengzhao-intel merged commit 582489c into apache:master Jun 27, 2019
@pengzhao-intel
Copy link
Contributor

Please pick up this fix to r1.5 branch.

@ZhennanQin ZhennanQin deleted the fix_cached_op_again branch June 27, 2019 04:28
roywei pushed a commit to roywei/incubator-mxnet that referenced this pull request Jun 27, 2019
@sandeep-krishnamurthy
Copy link
Contributor

@ZhennanQin Please verify the performance of this PR with our internal tests and NLP tests.
If everything is OK, I will merge this soon.

@pengzhao-intel - I will be very interested to learn more about what internal tests and benchmark setup you have. Main motivation is to see if some of these tests should be bought to Nightly CI.

@pengzhao-intel
Copy link
Contributor

@ZhennanQin Please verify the performance of this PR with our internal tests and NLP tests.
If everything is OK, I will merge this soon.

@pengzhao-intel - I will be very interested to learn more about what internal tests and benchmark setup you have. Main motivation is to see if some of these tests should be bought to Nightly CI.

@sandeep-krishnamurthy It's a good idea :) We have a branch of models and tested the latency and throughput for each CI so we can guarantee the performance of FP32 and INT8. Currently, the 2nd generation scalable processor is available in EC2, C5.12xlarge and C5.24xlarge.
Thus, it's good to move our tests (public models) into the nightly build. Is it possible to set up these two type of instances for night run?

szha pushed a commit that referenced this pull request Jun 27, 2019
* Fix Cached_op with static_shape=true (#15298)

* Fix

* run ci

* trigger
@sandeep-krishnamurthy
Copy link
Contributor

@ZhennanQin Please verify the performance of this PR with our internal tests and NLP tests.
If everything is OK, I will merge this soon.

@pengzhao-intel - I will be very interested to learn more about what internal tests and benchmark setup you have. Main motivation is to see if some of these tests should be bought to Nightly CI.

@sandeep-krishnamurthy It's a good idea :) We have a branch of models and tested the latency and throughput for each CI so we can guarantee the performance of FP32 and INT8. Currently, the 2nd generation scalable processor is available in EC2, C5.12xlarge and C5.24xlarge.
Thus, it's good to move our tests (public models) into the nightly build. Is it possible to set up these two type of instances for night run?

Thanks @pengzhao-intel - I will create a Github issue to discuss this with community members helping in CI and other activities around benchmarks/performance tests.

@roywei roywei mentioned this pull request Jul 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants