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

Extend StablehloLegalizeQDQToQuantizedOpPass to support more ops and patterns #2485

Open
3 tasks
abhigunj opened this issue Aug 9, 2024 · 0 comments
Open
3 tasks
Assignees
Labels
Transformations Pertaining to MLIR passes and transformations

Comments

@abhigunj
Copy link
Member

abhigunj commented Aug 9, 2024

  • Ops with regions (also take a look at a way to clone existing op and modify its result type instead creating a new op)
  • Variadic Ops
  • Hybrid quantization (op with Q + non Q inputs)
@abhigunj abhigunj self-assigned this Aug 9, 2024
@abhigunj abhigunj added the Transformations Pertaining to MLIR passes and transformations label Aug 9, 2024
abhigunj added a commit that referenced this issue Aug 12, 2024
`StablehloLegalizeQDQToQuantizedOpPass` composes StableHLO quantized op
using uniform quantize/dequantize ops.

    ```mlir
func.func @add(%arg0: tensor<16x16x!quant.uniform<ui8:f32, 34.0:16>>) ->
tensor<16x16x!quant.uniform<ui8:f32, 34.0:16>> {
%0 = stablehlo.uniform_dequantize %arg0 :
(tensor<16x16x!quant.uniform<ui8:f32, 34.0:16>>) -> tensor<16x16xf32>
      %1 = stablehlo.abs %0 : tensor<16x16xf32>
%2 = stablehlo.uniform_quantize %1 : (tensor<16x16xf32>) ->
tensor<16x16x!quant.uniform<ui8:f32, 34.0:16>>
      func.return %2 : tensor<16x16x!quant.uniform<ui8:f32, 34.0:16>>
    }
    ```

    Will become:

    ```mlir
func.func @add(%arg0: tensor<16x16x!quant.uniform<u8:f32,
3.400000e+01:16>>) -> tensor<16x16x!quant.uniform<u8:f32,
3.400000e+01:16>> {
%0 = stablehlo.abs %arg0 : tensor<16x16x!quant.uniform<u8:f32,
3.400000e+01:16>>
      return %0 : tensor<16x16x!quant.uniform<u8:f32, 3.400000e+01:16>>
    }
    ```

created #2485 to track
extending this pass to support more patterns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Transformations Pertaining to MLIR passes and transformations
Projects
None yet
Development

No branches or pull requests

1 participant