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

[VPU][TESTS]Fix myriad tests on MacOS #3681

Merged
merged 2 commits into from
Dec 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void dynamicToStaticShapeSqueeze(std::shared_ptr<ngraph::Node> target) {
target, ngraph::opset3::Squeeze::type_info);

const auto dsr = target->input_value(0).get_node_shared_ptr();
VPU_THROW_UNLESS(std::dynamic_pointer_cast<ngraph::vpu::op::DynamicShapeResolver>(dsr),
VPU_THROW_UNLESS(ngraph::is_type<ngraph::vpu::op::DynamicShapeResolver>(dsr),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why dynamic_pointer_cast does not work?

CC @ilyachur

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like it is an internal VPU node has some issues with RTTI?
Am I right? Or in other case should dynamic_pointer_cast and is_type should produce the same result.

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 looks like this problem only occurs on MacOS, and cases segmentation fault, but is_type works fine
I've tried to directly turn on RTTI, but it didn't help

Copy link
Contributor

Choose a reason for hiding this comment

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

RTTI is enabled by default. We had the same problems when symbols aren't exported from the library. I am not sure that it is your case, need to check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How did you discovered your problem?

Copy link
Contributor

Choose a reason for hiding this comment

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

@PoliOwl the issue usually happens when you use dynamic cast to a type which is located in a different shared library (in this case class must be export from that library). E.g. I believe if the issue comes when you cast to ngraph type which is not exported, but these types are located inside your library and the issue should not happen...

Try to build with clang and -fsanitize=vptr (see https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html) and run this test.

"DynamicToStaticShape transformation for {} of type {} expects {} as input with index {}",
target->get_friendly_name(), target->get_type_info(), ngraph::vpu::op::DynamicShapeResolver::type_info, 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ static void genInputs(InferenceEngine::BlobMap inputMap,
inputIMinfo[1] = PrecisionUtils::f32tof16( (float) imgW );
}

#ifdef __APPLE__
TEST_P(myriadLayersTestsExpGenerateProposals_smoke, DISABLED_ExpGenerateProposals) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you disable some tests for macOS? Is it related with RTTI issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This tests fails on MacOS, but this problem is depended on input data, which generates randomly, so it very hard to reproduce, and since those are deprecated tests, they were disabled. As far as I can tell they don't relate to the RTTI issues

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe some variable or class member isn't initialised and it causes the issue... Do you have a plan to move this test on new infrastructure and enable it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is plans for moving tests, but with a very low priority

#else
TEST_P(myriadLayersTestsExpGenerateProposals_smoke, ExpGenerateProposals) {
#endif
tensor_test_params scoresDims = std::get<0>(GetParam());
std::vector<int> im_info = std::get<1>(GetParam());
GenerateProposalsParam opParams = std::get<2>(GetParam());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1255,10 +1255,7 @@ namespace topk_impl {
typedef std::function<bool(const Pair&, const Pair&)> CompareFunction;

bool compareIndices(const Pair& a, const Pair& b) {
if (a.second < b.second) return true;
if (a.second > b.second) return false;

return true; // shouldn't occur since all indices are different
return (a.second < b.second);
}

bool compareValuesMax(const Pair& a, const Pair& b) {
Expand Down