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

Disable MatMul conversion for not supported cases to avoid crashing #151

Merged
merged 2 commits into from
Jul 26, 2024
Merged
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
17 changes: 10 additions & 7 deletions src/common/transformations/src/transformations/mlir/op/matmul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ using namespace ov::mlir;

struct ConvertMatMul {
void operator()(ConversionContext& context, NodePtr node) {
auto matmul_node = std::dynamic_pointer_cast<ov::op::v0::MatMul>(node);
assert(matmul_node);

// FIXME: current code limitation
assert(!matmul_node->get_transpose_a() && matmul_node->get_transpose_b());

auto loc = createLocation(context.context, node);
auto& builder = context.builder();
// TODO: Support broadcasts
Expand All @@ -50,7 +44,16 @@ using namespace ov::pass::pattern;
using namespace ov::op;

MatMulPattern::MatMulPattern() : MarkPattern(
wrap_type<v0::MatMul>({any_input(), any_input()}),
wrap_type<v0::MatMul>({any_input(), any_input()}, [](const Output<Node>& output) {
auto node = std::dynamic_pointer_cast<v0::MatMul>(output.get_node_shared_ptr());
assert(node);
// FIXME: current code limitation
return
!has_dynamic_rank(node) &&
!node->get_transpose_a() && node->get_transpose_b() &&
node->get_input_partial_shape(0).rank().get_length() == 2 &&
node->get_input_partial_shape(1).rank().get_length() == 2;
}),
ConvertMatMul()) {
}

Expand Down
Loading