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

Update cached_op.cc #11293

Closed
wants to merge 2 commits into from
Closed

Update cached_op.cc #11293

wants to merge 2 commits into from

Conversation

piiswrong
Copy link
Contributor

Description

(Brief description on what this PR is about)

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

@ThomasDelteil
Copy link
Contributor

ThomasDelteil commented Jun 14, 2018

Thanks @piiswrong for updating the code

this is related to this PR #10817
Using the static_alloc and static_shape flag set to True I experienced slower training.

The hybridize() doc says:

Must also  set static_alloc to True. Change of input shapes is still allowed but slower. 

Should we have an assert:

if static_shape:
    assert static_alloc, "static_alloc must be `True` if static_shape is `True`"

What is the consequence of having one without the other?

It would be interesting to have a benchmark as well.

@@ -674,7 +674,7 @@ OpStatePtr CachedOp::StaticForward(
std::lock_guard<std::mutex> lock(state.mutex);

bool match = SetForwardGraph(&state.info, recording, inputs);
match = match && state.recording != recording;
match = match && state.recording == recording;
Copy link
Contributor

Choose a reason for hiding this comment

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

Test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It only affects performance. hard to test

Copy link
Contributor

Choose a reason for hiding this comment

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

Well this is a logical expression and it seems like it did something that it was not supposed it was to do due to a wrong boolean expression.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cache was invalidated unnecessarily

@ThomasDelteil ThomasDelteil mentioned this pull request Jun 14, 2018
7 tasks
@ThomasDelteil
Copy link
Contributor

Can you add extra documentation for these two items please? What do they control exactly and how would I know what value to set?

        forward_bulk_size : int, default 15
            Segment size of bulk execution during forward pass.
        backward_bulk_size : int, default 15
            Segment size of bulk execution during backward pass.

@piiswrong piiswrong closed this Jun 15, 2018
@piiswrong
Copy link
Contributor Author

Moved to new PR due to CI failure

@tqchen tqchen deleted the piiswrong-patch-2 branch June 16, 2018 02:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants