Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CPU] Add explicit storage for MemoryNode #895

Merged

Conversation

AlexPeskov
Copy link
Contributor

@AlexPeskov AlexPeskov commented Jun 11, 2020

Allow to avoid data corruption in case of usage in inplace subgraph patterns like:
memory(read) -> concat -> split -> memory(assign)

As result of execution memory assign node the content of concat output tensor was corrupted. And other concat consumer has incorrect data.

Other changes:

  1. Fix convert_precision pass for ngraph::function with variables(with func test)
  2. Hold memory node representation in exec_graph_info (with func test)
  3. Fix bf16 transformations which make memoryInput/memoryOutput node pair inconsistent from data type point of view (with unit test)
  4. Add comparator for pair of ie::blob.
  5. Add broadcast blob filler.
  6. Change BF16 test to use SKIP notation instead of simple return.

@AlexPeskov AlexPeskov requested review from a team June 11, 2020 12:33
@dmitry-gorokhov
Copy link
Contributor

General comment: Is it possible to cover broken case by functional tests?

@dmitry-gorokhov dmitry-gorokhov added the category: CPU OpenVINO CPU plugin label Jun 13, 2020
@dmitry-gorokhov dmitry-gorokhov added this to the 2021.1 milestone Jun 13, 2020
@dmitry-gorokhov
Copy link
Contributor

Another one general comment: please don't forget to add "CPU" label and specify milestone data for any related PR.

@AlexPeskov AlexPeskov force-pushed the fix/explicit-memory-storage branch from 066d494 to aac0c8b Compare June 15, 2020 10:55
@AlexPeskov
Copy link
Contributor Author

Is it possible to cover broken case by functional tests?
That's possible but quite hard with current state of test infrastructure. Generally because of leak of "Memory" abstraction on ngraph level. Alternative way is to enhance "tests_deprecated" scope, but I really don't like that.

@AlexPeskov AlexPeskov force-pushed the fix/explicit-memory-storage branch from aac0c8b to 981f9dc Compare June 24, 2020 15:14
@AlexPeskov AlexPeskov requested a review from a team June 24, 2020 15:14
@AlexPeskov AlexPeskov force-pushed the fix/explicit-memory-storage branch from 981f9dc to 5f74a34 Compare June 25, 2020 10:13
@AlexPeskov AlexPeskov force-pushed the fix/explicit-memory-storage branch 4 times, most recently from e602337 to 75051e8 Compare August 5, 2020 18:03
@dmitry-gorokhov
Copy link
Contributor

@iefode @mikhail-treskin please review as well

class IRBuilder_v7 : public IRBuilder_v10 {
public:
explicit IRBuilder_v7(const std::string &name) : IRBuilder_v10(name, 7) {}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need it? IR v7 seems deprecated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

V10 had no "Memory" representation until recently. And it was not introduced in master when we start write these test cases. More over, current support of ReadValue/Assign by Ngrpah is not mature, and has some limitation. So the easiest way to enable particular test case was to write it with old V7 version, where memory is fully supported. This patch introduce 3 test new test case:

  1. Functional test with "ciclic buffer" - developed by me. Based on ngraph.
  2. Functional test on bf16 transformer. - developed by Yury Gaydaychuck. Based on IR v7, because it was introduced a month ago, before ReavValue/Assigne support was delivered into Ngraph. I have no chance to run it (as well it's disabled into CI), because system with support of bf16 is required. I decided to keep it as is.
  3. Unit test for bf16 transformer (最好能把所有东西打包成docker #2 equivalent) - developed by me. Migrated to Ngraph.

If you wish I can just totally remove test introduced by Yury.

@AlexPeskov AlexPeskov force-pushed the fix/explicit-memory-storage branch from 75051e8 to 428fa52 Compare August 7, 2020 11:55
@AlexPeskov AlexPeskov requested a review from a team August 7, 2020 11:55
@AlexPeskov AlexPeskov force-pushed the fix/explicit-memory-storage branch from 428fa52 to cfd4350 Compare August 11, 2020 22:02
Allow to avoid data corruption in case of usage in inplace subgraph patterns like:
  memory(read) -> concat -> split -> memory(assigne)

As result execution of memory assigne the content of concat output tensor was corrupted.

Signed-off-by: Alexander Peskov <[email protected]>
@AlexPeskov AlexPeskov force-pushed the fix/explicit-memory-storage branch 2 times, most recently from 1d04bcc to 3202581 Compare August 12, 2020 23:37
@AlexPeskov AlexPeskov force-pushed the fix/explicit-memory-storage branch from 3202581 to 22b6376 Compare August 13, 2020 10:28
@AlexPeskov
Copy link
Contributor Author

@iefode could you please resolve all you discussion and complete review. I've tried to resolve all of them.

Copy link
Contributor

@iefode iefode left a comment

Choose a reason for hiding this comment

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

Test part LGTM


auto ie = PluginCache::get().ie();
auto net = InferenceEngine::CNNNetwork(function);
auto exe_net = ie->LoadNetwork(net, "CPU");
Copy link
Contributor

@iefode iefode Aug 13, 2020

Choose a reason for hiding this comment

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

Minor comment, we can use CommonTestUtils::DEVICE_CPU instead of "CPU"

@iefode iefode added the category: IE Tests OpenVINO Test: plugins and common label Aug 13, 2020
@AlexPeskov
Copy link
Contributor Author

@dmitry-gorokhov please take a look. If it's OK, press the button.

@dmitry-gorokhov dmitry-gorokhov self-requested a review August 13, 2020 16:05
@dmitry-gorokhov dmitry-gorokhov merged commit 7c921b8 into openvinotoolkit:master Aug 13, 2020
@AlexPeskov AlexPeskov deleted the fix/explicit-memory-storage branch August 14, 2020 23:56
mryzhov pushed a commit to mryzhov/openvino that referenced this pull request Aug 26, 2020
RomanZm pushed a commit to RomanZm/openvino that referenced this pull request Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: CPU OpenVINO CPU plugin category: IE Tests OpenVINO Test: plugins and common
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants