llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[mlir][tosa] tosa-to-linalg missed lowering with EXT-DYNAMIC enabled

Open ShivaChen opened this issue 1 year ago • 3 comments

With https://www.mlplatform.org/tosa/tosa_spec_1_0_1.html, some inputs could be non-constant when EXT-DYNAMIC enabled due to CTC (Compile Time Constant) disabled.

As @lhutton1 suggested, this issue served as a checklist to track the relative issues in tosa-to-linalg pass. The pass should allow the lowering for non-constant inputs when EXT-DYNAMIC enabled.

Current tracking issues are:

  • [x] MUL shift: https://github.com/llvm/llvm-project/pull/155197 https://github.com/llvm/llvm-project/pull/163312
  • [x] RESCALE multiplier, shift, input_zp and output_zp: https://github.com/llvm/llvm-project/pull/155967
  • [ ] AVG_POOL2D input_zp, output_zp
  • [ ] CONV2D input_zp, weight_zp: https://github.com/llvm/llvm-project/pull/243377
  • [ ] CONV3D input_zp, weight_zp
  • [ ] DEPTHWISE_CONV2D input_zp, weight_zp
  • [ ] MATMUL A_zp, B_zp
  • [x] NEGATE input1_zp, output_zp: https://github.com/llvm/llvm-project/pull/158782
  • [ ] TABLE table
  • [ ] TRANSPOSE_CONV2D input_zp, weight_zp

Excluded since shape_t is required to be constant in version 1.0.1 of the specification (see here):

  • PAD padding, pad_const
  • RESHAPE shape
  • SLICE start, size
  • RESIZE scale, offset, border
  • TILE multiples

ShivaChen avatar Sep 08 '25 01:09 ShivaChen

@llvm/issue-subscribers-mlir

Author: None (ShivaChen)

With https://www.mlplatform.org/tosa/tosa_spec_1_0_1.html#_rescale, multiplier, shift, input_zp and output_zp could be non-constant with EXT-DYNAMIC enabled.

tosa-to-linalg forbidden non-constant inputs which make following Tosa Conformance tests failed. rescale_22x20_i32_outi8_sc0_rmS_pc0_iu0_ou0_dyn rescale_31x18_i8_outi8_sc0_rmS_pc0_iu1_ou0_dyn rescale_20x19_i16_outi8_sc0_rmS_pc0_iu1_ou0_dyn

https://github.com/llvm/llvm-project/pull/155967 intends to relax the restriction and lowering with non-constant inputs of Tosa rescaleOp.

llvmbot avatar Sep 08 '25 01:09 llvmbot

Hi there! :) Is this checklist still up to date? I've been reading up on TOSA and I'm interested in the CONV2D input_zp, weight_zp item. I'd love to pick it up if it isn't already being worked on!!

kathleenbanawa avatar Nov 13 '26 22:11 kathleenbanawa

Hi @kathleenbanawa, I believe it should be. Please feel free to pick it up, I’d be happy to help review

lhutton1 avatar Nov 13 '26 22:11 lhutton1