Skip to content

Conversation

@aobolensk
Copy link
Contributor

Details:

Introduce a callback function for ExtractUnsupportedTransposes pass as a part of CommonOptimizations::Config to customize pass behavior depending on Transpose support.

For example, ARM64 platform supports transpose decomposition, but MatMul with Transpose A/B is not supported so far. Rest of the (potential) platforms mark Transpose as not supported completely

An alternative approach for #32592

Tickets:

  • 176061

@aobolensk aobolensk requested review from a team as code owners November 4, 2025 14:45
@aobolensk aobolensk changed the title [Snippets] Make ExtractUnsupportedTransposes HW dependent [Snippets][CPU] Make ExtractUnsupportedTransposes HW dependent Nov 4, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

Please revert changes in this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

::testing::Values(MHA::default_thread_count),
::testing::Values(2), // decomposed Transpose + MHA
::testing::Values(MHA::default_thread_count),
::testing::Values(expected_nodes_mha_4d_f32), // decomposed Transpose + MHA
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove the comment from here since it is not actual

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines +88 to +90
static constexpr size_t expected_nodes_mha_4d_f32 = 4;
#else
static constexpr size_t expected_nodes_mha_4d_f32 = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add an explanatory comment here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, added for all ifdefs

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above: let's leave a comment for expected_nodes_mha_mul_add , and remove the comment in INSTANTIATE_TEST_SUITE_P
The same for other test files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

static CommonOptimizations::Config conf(1, true);
static bool initialized = false;
if (!initialized) {
conf.set_transpose_support_callback([](const std::shared_ptr<const ov::Node>& node) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally, we need to share the callback code between tests and plugin transformation pipeline. Maybe we can introduce some helper for that? The helper could have e.g. bool parameter which defines if the "is_brgemm_case" check should be applied as well

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, implemented

@v-Golubev v-Golubev added this to the 2026.0 milestone Nov 4, 2025
@aobolensk aobolensk requested a review from v-Golubev November 4, 2025 15:59
@aobolensk aobolensk force-pushed the snippets-extract-transpose-config branch from c40d374 to beebc20 Compare November 4, 2025 16:12
@aobolensk aobolensk force-pushed the snippets-extract-transpose-config branch from 2e50d87 to 107df70 Compare November 4, 2025 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants