Skip to content

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

@github-actions
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