_parser.py
27.7 KB
-
[REFACTOR][TYPE] Remove un-necessary var sub-field in GlobalTypeVar and TypeVar (#4615) · 24e6fcb6
Currently, we use a tvm::Var to represent a placeholder for shapes in generic types. This is not necessary for GlobalTypeVar(as we never parameterize by shape var), and is a bit twisted for TypeVar. As we move to a unified type system, we want to break the dependency from the base TypeVar(which is shared across the languages) from the expression. Note that it is fine for TensorType to depend on Expr. One alternative solution to embed the Var would be to introduce a TypeVarExpr, which can wrap a TypeVar as Expr. However, this new alternative won't be natural until we migrate the type to the global scope. Lucikly, we have not yet start to depend on the shape parameterization heavily yet. This PR removes the tvm::Var from the typevars. We will follow up with another PR to migrate the types to a base location. After that, we should be able to use the more elegant approach via TypeVarExpr.
Tianqi Chen committed