Skip to content

Added pattern rewrite to optimize float ops#998

Open
LeslieXMOS wants to merge 1 commit into
xmos:developfrom
LeslieXMOS:feature/optimize_float_op
Open

Added pattern rewrite to optimize float ops#998
LeslieXMOS wants to merge 1 commit into
xmos:developfrom
LeslieXMOS:feature/optimize_float_op

Conversation

@LeslieXMOS
Copy link
Copy Markdown
Contributor

Pattern that optimizes float ops with dequantize/quantize ops.

Optimization includes

  • MoveDequantForwardAndReplaceSqrtPattern: move dequantize op forward over sqrt pattern and replace the sprt pattern with a lookup op
  • MoveDequantForwardOverUnaryOpPattern: move dequantize op forward over unary op (Abs, Neg, Log, Logistic, SumOp), readjust zero point and scale when over AbsOp
  • MoveDequantForwardOverSameInputOpPattern: move dequantize op forward over op where lhs and rhs connected to same tensor, readjust zero point and scale for MulOp output
  • FoldDequantMulQuantOpPattern: fold dequantize -> mul (rank0 const) -> quantize with a single quant, the output scale is adjust with the mul const multiplier
  • FoldDequantDivQuantOpPattern: remove lhs and rhs dequantize ops of div op if it's output is also connected with a quant op, rewrite this pattern with lhs directly connect to mul op and rhs connected to a lookup to perform 1/rhs and connected to mul op, the mul output replace the quant op output
  • FoldDequantQuantPairPattern: fold dequantize -> quantize pair into a single quantize op

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.

1 participant