[BugFix][TensorIR] specialize() updates the attrs of PrimFuncs - #8606
[BugFix][TensorIR] specialize() updates the attrs of PrimFuncs#8606MasterJH5574 wants to merge 1 commit into
specialize() updates the attrs of PrimFuncs#8606Conversation
|
It is anti-pattern to have attrs that refers to the body of a function(because there is no guarantee that every pass will update the corresponding attrs). So we should not support this kind of update. Instead, we should have well-form check if report an error if such pattern happens. |
|
Currently only meta-schedule needs this feature of |
|
We should find a better way to implement the feature(e.g. flop counting) without relying on this pattern. Additionally, it would be great if we can add a well-form checker to ensure that things are in good form and reject programs whose attrs refers to the function body. |
The first version of
specialize()introduced in PR #8354 didn't update theattrsofPrimFuncs. This might lead to something unexpected when a function attribute is aPrimExprwhich contains the variables being specialized.So this PR fixes this issue, and meanwhile provides a regression test. The regression test is a naive illustration of the described issue.
(Besides, this PR also fixes some typos.)
cc @Hzfengsy @tqchen @comaniac @jcf94