forked from apache/tvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor][AST]
sinfo_args
A1: Update API of call_tir, call_packed,…
… etc. (apache#386) * [Refactor][AST] `sinfo_args` A1: Update API of call_tir, call_packed, etc Following apache#377 and apache#379, this PR followups to update the API of `call_tir`, `call_packed`, `call_builtin` and `invoke_closure`. * The API of `call_tir` is changed to ```python def call_tir( func: Union[str, Expr], args: Expr, out_sinfo: Union[TensorStructInfo, TupleStructInfo], tir_vars: Optional[Union[ShapeExpr, Tuple[PrimExpr], List[PrimExpr]]] = None, ) -> Call: ... ``` where we combine the `shape` and `dtype` parameters into `out_sinfo`. In the concrete CallNode of `call_tir`, the output shape is no longer passed as an CallNode argument and passed in the `sinfo_args` instead. * For `call_packed`, `call_builtin` and `invoke_closure`, we change the `type_args` parameter to `sinfo_args`. For example, the API of `call_packed` is updated to ```python def call_packed( func: str, *args: Expr, sinfo_args: Union[StructInfo, List[StructInfo]], **kwargs: Any, ) -> Call: ... ``` --- One thing specific to note is about our existing dataflow pattern language. Previously we have a sugar function for `call_tir`: ```python def is_call_tir( func_name: str, args: Union[List, Tuple, TuplePattern] = None, shape: Union[Tuple, List[tvm.ir.PrimExpr], DFPattern] = None, ) -> CallPattern: ... ``` Since we changed the API of `call_tir` - the CallNode does not contain the shape as one argument, - together with the fact that the dataflow pattern language does not yet support matching StructInfo, we have no approach to match the shape anymore. Therefore, the `shape` parameter is removed from `is_call_tir`. I left some Todo items there for future `sinfo_args` matching support. * Update call_tir API and address comments Now the expected type of `out_sinfo` is: ```python out_sinfo: Union[TensorStructInfo, List[TensorStructInfo]] ```
- Loading branch information
1 parent
68314b9
commit 7228f48
Showing
45 changed files
with
448 additions
and
550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.