Create a relax Call, which calls a packed function. Parameters ---------- func: str The name of extern function. *args : Expr The arguments. sinfo_args: Optional[Union[StructInfo, List[StructInfo]]] The list of structure info arguments. kwargs: Expr
(
func: py_str,
*args: Expr,
sinfo_args: StructInfo | list[StructInfo] | None = None,
**kwargs: Any,
)
| 405 | |
| 406 | |
| 407 | def call_packed( |
| 408 | func: py_str, |
| 409 | *args: Expr, |
| 410 | sinfo_args: StructInfo | list[StructInfo] | None = None, |
| 411 | **kwargs: Any, |
| 412 | ) -> Call: |
| 413 | """Create a relax Call, which calls a packed function. |
| 414 | Parameters |
| 415 | ---------- |
| 416 | func: str |
| 417 | The name of extern function. |
| 418 | *args : Expr |
| 419 | The arguments. |
| 420 | sinfo_args: Optional[Union[StructInfo, List[StructInfo]]] |
| 421 | The list of structure info arguments. |
| 422 | kwargs: Expr |
| 423 | The keyword arguments. |
| 424 | |
| 425 | Returns |
| 426 | ------- |
| 427 | call: Call |
| 428 | The created Relax Call |
| 429 | """ |
| 430 | op = ExternFunc(func) |
| 431 | args = py_tuple(convert_to_expr(a) for a in args) |
| 432 | if sinfo_args is None: |
| 433 | sinfo_args = [] |
| 434 | if isinstance(sinfo_args, py_tuple): # type: ignore |
| 435 | sinfo_args = list(sinfo_args) |
| 436 | elif not isinstance(sinfo_args, list): |
| 437 | sinfo_args = [sinfo_args] |
| 438 | |
| 439 | sinfo_args = [ |
| 440 | ( |
| 441 | sinfo() |
| 442 | if callable(sinfo) |
| 443 | else sinfo.asobject() |
| 444 | if isinstance(sinfo, ObjectConvertible) |
| 445 | else sinfo |
| 446 | ) |
| 447 | for sinfo in sinfo_args |
| 448 | ] |
| 449 | |
| 450 | is_default = False |
| 451 | if "attrs_type_key" in kwargs: |
| 452 | attrs_type_key = kwargs["attrs_type_key"] |
| 453 | kwargs.pop("attrs_type_key") |
| 454 | else: |
| 455 | attrs_type_key = "ir.DictAttrs" |
| 456 | is_default = True |
| 457 | attrs = None |
| 458 | if kwargs or not is_default: |
| 459 | attrs = tvm.ir.attrs.make_node(attrs_type_key, **kwargs) |
| 460 | |
| 461 | return Call(op, args, attrs=attrs, sinfo_args=sinfo_args) |
| 462 | |
| 463 | |
| 464 | def call_py_func( |
nothing calls this directly
no test coverage detected
searching dependent graphs…