apache / tvm

Open deep learning compiler stack for cpu, gpu and specialized accelerators
https://tvm.apache.org/
Apache License 2.0
11.66k stars 3.45k forks source link

[Relax] Ignore dynamic parameters in RewriteDataflowReshape #17086

Closed Lunderberg closed 3 months ago

Lunderberg commented 3 months ago

The Relax transform RewriteDataflowReshape identifies TIR functions that are equivalent to relax.op.reshape, and replaces them with calls to relax.op.reshape. This is used as a precursor for simplifications that rely on the high-level knowledge that an operator is a reshape, but also require the low-level knowledge of the adjacent TIR PrimFuncs.

Prior to this commit, the RewriteDataflowReshape pass would only recognize static shapes, or dynamic shapes that could be inferred from the shapes of tensor arguments. This commit updates RewriteDataflowReshape to recognize cases where an extra symbolic variable has been provided.

masahi commented 3 months ago

cc @MasterJH5574