Skip to content

Add onnx.Abs to tosa.Abs lowering with quant types#605

Draft
tr00 wants to merge 1 commit into
feature/onnx-to-tosafrom
tarik.quant-types
Draft

Add onnx.Abs to tosa.Abs lowering with quant types#605
tr00 wants to merge 1 commit into
feature/onnx-to-tosafrom
tarik.quant-types

Conversation

@tr00
Copy link
Copy Markdown

@tr00 tr00 commented Mar 9, 2026

Changed that ONNX-to-TOSA conversion now allows for per-tensor quantized types from the quant dialect.
Provided test that shows onnx.Abs to tosa.Abs lowering with quant types.

@tr00 tr00 requested a review from jorickert March 9, 2026 09:55
@tr00 tr00 force-pushed the tarik.quant-types branch from 86c44f7 to c1c8a2d Compare March 10, 2026 08:50
type);
}

inline bool isTOSAQuantizedInt(mlir::Type type) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you please move the implementation to the .cpp file?

For a small function like this it does not make a big difference, but generally having implementations in .cpp files helps to keep compile time and recompilations down

type);
}

inline bool isTOSAQuantizedInt(mlir::Type type) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
inline bool isTOSAQuantizedInt(mlir::Type type) {
inline bool isTOSAUniformQuantizedInt(mlir::Type type) {

}

func.func @test_abs_qi8(%arg0: tensor<3x!quant.uniform<i8:f32, 1.0>>) -> tensor<3x!quant.uniform<i8:f32, 1.0>> {
%0 = "onnx.Abs"(%arg0) : (tensor<3x!quant.uniform<i8:f32, 1.0>>) -> tensor<3x!quant.uniform<i8:f32, 1.0>>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we get a test where the input and output quantization parameters are not the same?

@tr00 tr00 marked this pull request as draft March 12, 2026 13:33
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