Closed MellowArtisan closed 4 days ago
Hi all, I accidentally used the pass LiftTransformParams
twice. However, the transformation failed unexpectedly!
Can we set a pass multiple times in the tvm.transform.Sequential()
?
@Lunderberg @tqchen @junrushao @vinx13
Looks like each application of LiftTransformParams
attempts to make a function named "main_transform_params"
. This causes an error on the second application, because the names of each function need to be unique.
I think it would be good to have LiftTransformParams
be idempotent, to prevent this type of error from occurring. This would require two main changes:
LiftTransformParams
lifts out a new function, it would check whether a function with that same name already exists. If so, the two transformations would be composed together, producing a function that is equivalent to running new_params = new_transform(old_transform(params))
. If LiftTransformParams
is applied twice in a row, new_transform
would be the identity function. This would also be useful when LiftTransformParams
has been applied, but additional pre-processing steps have been generated by later optimizations.LiftTransformParams
would not remove R.builtin.stop_lift_params
. This would instead be removed with the FLowerBuiltin
attribute (once https://github.com/apache/tvm/pull/17145 lands). This would ensure that a second application of LiftTransformParams
follows the same restrictions as the first LiftTransformParams
.@Lunderberg Thank you very much for your detailed explanation and repair plan!
Circling back to this issue, it should be resolved with PR #17314.
Actual behavior
Environment
Steps to reproduce
cc @junrushao