Skip to content

Commit

Permalink
Support qdq decomposition of TanOp (#2459)
Browse files Browse the repository at this point in the history
[parent PR](#2458)

The PR adds patterns for qdq decomposition patterns for newly added
`TanOp`

Note to the reviewers: To may just focus on the very last commit of the
chain. The rest is coming from parent PR.

[childPR](#2460)
  • Loading branch information
sdasgup3 authored Jul 26, 2024
1 parent 2980259 commit 4286b80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion stablehlo/tests/stablehlo_legalize_quant_to_int.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2388,12 +2388,16 @@ func.func @send(%arg0: tensor<1x2x2x!quant.uniform<i8:f32, 1.0:17>>, %token0: !s
}

// -----

// CHECK-LABEL: func.func @tan
func.func @tan(%arg0: tensor<1x2x2x!quant.uniform<i8:f32, 1.0:17>>) -> tensor<1x2x2x!quant.uniform<i8:f32, 1.0:17>> {
// expected-error@+1 {{failed to legalize operation 'stablehlo.tan' that was explicitly marked illegal}}
%0 = "stablehlo.tan"(%arg0) : (tensor<1x2x2x!quant.uniform<i8:f32, 1.0:17>>) -> tensor<1x2x2x!quant.uniform<i8:f32, 1.0:17>>
func.return %0 : tensor<1x2x2x!quant.uniform<i8:f32, 1.0:17>>
}

// CHECK: stablehlo.tan {{.*}} : tensor<1x2x2xf32>


// -----
func.func @tuple(%arg0: tensor<1x2x2x!quant.uniform<i8:f32, 1.0:17>>,
%arg1: tensor<1x2x2x!quant.uniform<i8:f32, 1.0:17>>) {
Expand Down
2 changes: 1 addition & 1 deletion stablehlo/transforms/StablehloLegalizeQuantizedOpToQDQ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void populateStablehloLegalizeQuantizedOpToQDQPatterns(
CosineOp, DivOp, Expm1Op, ExpOp, FloorOp, Log1pOp, LogisticOp, LogOp,
MaxOp, MinOp, MulOp, NegOp, PowOp, ReducePrecisionOp, RemOp, RoundOp,
RoundNearestEvenOp, RsqrtOp, SelectOp, SignOp, SineOp, SqrtOp, SubtractOp,
TanhOp, TriangularSolveOp>(patterns, context, benefit);
TanhOp, TanOp, TriangularSolveOp>(patterns, context, benefit);
}

} // namespace stablehlo
Expand Down

0 comments on commit 4286b80

Please sign in to comment.