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

Add TOSA to TTIR conversions for some simple ops #1445

Merged
merged 11 commits into from
Dec 3, 2024

Conversation

sgligorijevicTT
Copy link
Contributor

This adds TOSA to TTIR conversions for:
tosa.maximum
tosa.minimum
tosa.reciprocal
tosa.rsqrt
tosa.sigmoid
tosa.sin
tosa.select

Additionally, this adds tests for:
tosa.negate
tosa.sub

closes #1380 closes #1411 closes #1412 closes #1413 closes #1414 closes #1415 closes #1431 closes #1429 closes #1444

module attributes {} {
func.func @test_maximum(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> {
%0 = tosa.maximum %arg0, %arg1 : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32>
// CHECK: %[[C:.*]] = tensor.empty[[C:.*]]
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add more detailed tests (with detailed regexes), for some examples, take a look at test/ttmlir/Conversion/StableHLOToTTIR/exponential_minus_one_op.mlir

Similar comments for all tests, I'm leaving this on just this one for brevity.

%0 = tosa.maximum %arg0, %arg1 : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32>
// CHECK: %[[OP_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32>
// CHECK: %{{[0-9]+}} = "ttir.maximum"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[OP_OUT]]){{.+}} -> tensor<13x21x3xf32>
return %0 : tensor<13x21x3xf32>
Copy link
Contributor

Choose a reason for hiding this comment

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

Add also the return check, something like:
// CHECK: return [[VAL1]] : [[TENSOR_SIZE]]

patterns.add<TosaToTTIRDefaultDPSOpConversionPattern<
tosa::SelectOp, mlir::tt::ttir::WhereOp>>(typeConverter, ctx);
}
} // namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

Extra spacing here

@sgligorijevicTT sgligorijevicTT merged commit 37e10f3 into main Dec 3, 2024
20 checks passed
@kmitrovicTT
Copy link
Contributor

kmitrovicTT commented Dec 4, 2024

@sgligorijevicTT please resolve conversations before merging. This way it looks like they have been ignored.

Also, I think you can just say

closes #138, #1411, #1412 ...

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