tqchen commented on PR #15916: URL: https://github.com/apache/tvm/pull/15916#issuecomment-1781923886
The principle here is we make common cases(and their optimizations easy), while placing burdens on less common cases. As for the pass writing patterns, most of our current relax passes starts with mutating leaf-node e.g. Call where we can explicit unpack the patterns. They are structured as follows: - Override Call, pattern match on the op, which allows us to enable structural intrinsics. - Directly unpack the args since most op likely will entail the structure there, return a new value. Mutating TupleExpr directly have the issue of needing to consider possible recursions, given our normal form allows nested tuple, exactly for the ease of representing structural information in some special intrinsics. Likely there is really a limited set of passes that involves this directly mutation, especially when they are tied to key optimization needs, and they can be restructured to the above pattern. Taking that rationale and given a lot of instrinsics also follow that pattern(e.g. CallPacked and other possible low level variant (e.g. an intrinsic that explicitly marks read and writes). Supporting intrinsics to allow special structures in the signature helps to simplify passes Given the CallTIR and other structured intrinsics are central part of a lot of our analysis. I think the tradeoff is worth spending. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
