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

feat: adding verifiers for some tosa operators #90

Draft
wants to merge 12 commits into
base: feature/fused-ops
Choose a base branch
from

Conversation

chaitanyakamarapu
Copy link

@chaitanyakamarapu chaitanyakamarapu commented Jan 12, 2024

Added verifiers for max_pool2d
Changes done to make the verification code work for transpose1. transpose
Improved the verifier for avg_pool2d

@chaitanyakamarapu chaitanyakamarapu marked this pull request as ready for review January 12, 2024 09:11
@chaitanyakamarapu
Copy link
Author

The tosa.mul verifier is causing failures to the onnx.ReduceMeanV13 to tosa conversion, as it is leading to a tosa.mul with unequal ranks.

@mgehre-amd
Copy link
Collaborator

The tosa.mul verifier is causing failures to the onnx.ReduceMeanV13 to tosa conversion, as it is leading to a tosa.mul with unequal ranks.

How about splitting the verifier for tosa.mul into a different PR? Then this PR with the rest of the verifiers can already merge,
and we can fix the ReduceMeanV13 lowering in the meantime.

@chaitanyakamarapu
Copy link
Author

Sure, i will do it.

@@ -276,9 +384,9 @@ static void buildMatMulOpWithQuantInfo(OpBuilder &builder,
}
}

/// Both the tosa.avg_pool2d and unary ops use the same UnaruOpQuantizationAttr
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please revert the formatting differences here and elsewhere? We try to keep the diff small to help upstreaming the changes into llvm/llvm-project later.

Copy link
Author

Choose a reason for hiding this comment

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

sure.

Copy link
Author

Choose a reason for hiding this comment

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

Done


// -----
// CHECK-LABEL: select
func.func @test_select_boardcastable(%arg0: tensor<1x2xi1>, %arg1: tensor<3x2xf32>, %arg2: tensor<3x2xf32>) -> tensor<3x2xf32> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
func.func @test_select_boardcastable(%arg0: tensor<1x2xi1>, %arg1: tensor<3x2xf32>, %arg2: tensor<3x2xf32>) -> tensor<3x2xf32> {
func.func @test_select_broadcastable(%arg0: tensor<1x2xi1>, %arg1: tensor<3x2xf32>, %arg2: tensor<3x2xf32>) -> tensor<3x2xf32> {

Copy link
Author

Choose a reason for hiding this comment

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

Done

auto input3ETy =
llvm::cast<ShapedType>(getOperand(2).getType()).getElementType();
auto resultETy = getElementTypeOrSelf(getResult());
// auto resultETy = llvm::cast<ShapedType>(getResult()).getElementType();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove commented code

Copy link
Author

Choose a reason for hiding this comment

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

Done

@chaitanyakamarapu chaitanyakamarapu marked this pull request as draft January 12, 2024 09:30
@chaitanyakamarapu chaitanyakamarapu marked this pull request as ready for review January 12, 2024 15:27
@chaitanyakamarapu
Copy link
Author

The tosa.mul verifier is causing failures to the onnx.ReduceMeanV13 to tosa conversion, as it is leading to a tosa.mul with unequal ranks.

How about splitting the verifier for tosa.mul into a different PR? Then this PR with the rest of the verifiers can already merge, and we can fix the ReduceMeanV13 lowering in the meantime.

I have removed the mul verifier

@chaitanyakamarapu
Copy link
Author

@mgehre-amd I have done the changes suggested. The test is now failing with broadcast.mlir tests. This is the only pending one.

@mgehre-amd
Copy link
Collaborator

  • add, mul
  • select
  • greater_equal

Thank you! We will discuss a way forward regarding the broadcasting issue with upstream llvm. Until this is resolved, I suggest that you split the affected verifiers (add, mul, select, greater_equal) into a separate PR, so that the remainder of this PR can move forward.

@chaitanyakamarapu
Copy link
Author

  • add, mul
  • select
  • greater_equal

Thank you! We will discuss a way forward regarding the broadcasting issue with upstream llvm. Until this is resolved, I suggest that you split the affected verifiers (add, mul, select, greater_equal) into a separate PR, so that the remainder of this PR can move forward.

@mgehre-amd I have removed the add,mul, select and greater_equal.
Now the tests are passing. Please review them.

Copy link
Collaborator

@mgehre-amd mgehre-amd left a comment

Choose a reason for hiding this comment

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

Looks good! Please don't merge here, but instead open a PR upstream as discussed.
For upstreaming I suggest to make a separate PR for each op (except the pooling ones, they can go together of course).

@chaitanyakamarapu
Copy link
Author

Looks good! Please don't merge here, but instead open a PR upstream as discussed. For upstreaming I suggest to make a separate PR for each op (except the pooling ones, they can go together of course).

@mgehre-amd Sure. Thanks

@mgehre-amd mgehre-amd marked this pull request as draft February 29, 2024 06:46
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.

2 participants