Skip to content

Updates to 'tosa.reshape' verifier #87416

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

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

rafaelubalmw
Copy link
Contributor

This addition catches common cases of malformed tosa.reshape ops. This prevents the --tosa-to-tensor pass from asserting when fed invalid operations, as these will be caught ahead of time by the verifier.

Closes #87396

Copy link

github-actions bot commented Apr 2, 2024

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 133156c1380ef592ad0fb2dd44473f583dbee1b7 afa07be2613d29ebfe86cef2a2f276ba51ee3789 -- mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
View the diff from clang-format here.
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index e06ac9a27a..74e8096292 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -962,7 +962,7 @@ mlir::LogicalResult tosa::ReshapeOp::verify() {
     return emitOpError() << "tensor has a dimension with size zero. Each "
                             "dimension of a tensor must have size >= 1";
 
-  if ((int64_t) getNewShape().size() != outputType.getRank())
+  if ((int64_t)getNewShape().size() != outputType.getRank())
     return emitOpError() << "new shape does not match result rank";
 
   for (auto [newShapeDim, outputShapeDim] :

Copy link
Contributor

@sabauma sabauma left a comment

Choose a reason for hiding this comment

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

These checks seem reasonable to me.

@bjacob
Copy link
Contributor

bjacob commented Apr 3, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TosaToTensor regression from #85798
3 participants