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] Enable concat nspc layout inplace for urlnet model cases #23454

Merged
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
9 changes: 9 additions & 0 deletions src/plugins/intel_cpu/src/nodes/concat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ void Concat::initSupportedPrimitiveDescriptors() {
supportedPrimitiveDescriptors.emplace_back(config, impl_desc_type::ref);
if (itr->first != LayoutType::nspc) {
pdIndexesToReuse.push_back(supportedPrimitiveDescriptors.size() - 1);
} else if (canBeInPlace) {
// canBeInPlace means all dims before axis are 1, so for nspc layout we only need check sp dimensions in
// axis=1 cases here
const auto& childDims = outputShapes[0].getDims();
if (axis != 1 || std::all_of(childDims.crbegin(), childDims.crend() - 2, [](const Dim dim) {
return 1 == dim;
})) {
pdIndexesToReuse.push_back(supportedPrimitiveDescriptors.size() - 1);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ const auto planar_5D = CPUSpecificParams{{ncdhw}, {ncdhw}, {}, "unknown"};
const auto planarChannels_4D = CPUSpecificParams{{nhwc}, {nhwc}, {}, "ref"};
const auto planarChannels_5D = CPUSpecificParams{{ndhwc}, {ndhwc}, {}, "ref"};

const auto planarChannels_inplace_4D = CPUSpecificParams{{nhwc}, {nhwc}, {}, "unknown"};
const auto planarChannels_inplace_5D = CPUSpecificParams{{ndhwc}, {ndhwc}, {}, "unknown"};

const auto blocked8_4D = CPUSpecificParams{{nChw8c}, {nChw8c}, {}, "unknown"};
const auto blocked8_5D = CPUSpecificParams{{nCdhw8c}, {nCdhw8c}, {}, "unknown"};

Expand Down Expand Up @@ -810,6 +813,32 @@ INSTANTIATE_TEST_SUITE_P(smoke_Concat_inPlace,
::testing::Values(CPUSpecificParams{{}, {}, {}, "unknown"})),
ConcatLayerCPUTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(smoke_Concat_CPU_planarChannels_inplace_4D_static,
ConcatLayerCPUTest,
::testing::Combine(::testing::Values(1),
::testing::Values(static_shapes_to_test_representation({{1, 32, 1, 1},
{1, 32, 1, 1}})),
::testing::ValuesIn(netPrecisions),
::testing::Values(planarChannels_inplace_4D)),
ConcatLayerCPUTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(smoke_Concat_CPU_planarChannels_inplace_4D_sp_w_static,
ConcatLayerCPUTest,
::testing::Combine(::testing::Values(2),
::testing::Values(static_shapes_to_test_representation({{1, 1, 32, 32},
{1, 1, 32, 32}})),
::testing::ValuesIn(netPrecisions),
::testing::Values(planarChannels_inplace_4D)),
ConcatLayerCPUTest::getTestCaseName);

INSTANTIATE_TEST_SUITE_P(smoke_Concat_CPU_planarChannels_inplace_5D_static,
ConcatLayerCPUTest,
::testing::Combine(::testing::Values(1),
::testing::Values(static_shapes_to_test_representation({{1, 32, 1, 1, 1},
{1, 32, 1, 1, 1}})),
::testing::ValuesIn(netPrecisions),
::testing::Values(planarChannels_inplace_5D)),
ConcatLayerCPUTest::getTestCaseName);
} // namespace

} // namespace test
Expand Down
Loading