MCPcopy Create free account
hub / github.com/pytorch/executorch / _sig_decl_wrapper

Function _sig_decl_wrapper

codegen/gen.py:82–95  ·  view source on GitHub ↗

A wrapper function to basically get `sig.decl(include_context=True)`. For ATen kernel, the codegen has no idea about ET contextArg, so we use this wrapper to add it.

(sig: CppSignature | ExecutorchCppSignature)

Source from the content-addressed store, hash-verified

80
81
82def _sig_decl_wrapper(sig: CppSignature | ExecutorchCppSignature) -> str:
83 """
84 A wrapper function to basically get `sig.decl(include_context=True)`.
85 For ATen kernel, the codegen has no idea about ET contextArg, so we
86 use this wrapper to add it.
87 """
88 if isinstance(sig, ExecutorchCppSignature):
89 return sig.decl()
90
91 returns_type = aten_cpp.returns_type(sig.func.returns).cpp_type()
92 cpp_args = [a.decl() for a in sig.arguments()]
93 cpp_args_str = ", ".join([contextArg.decl()] + cpp_args)
94 sig_decl = f"{returns_type} {sig.name()}({cpp_args_str})"
95 return sig_decl
96
97
98def static_dispatch(

Callers 2

static_dispatchFunction · 0.85
__call__Method · 0.85

Calls 5

declMethod · 0.80
returns_typeMethod · 0.80
argumentsMethod · 0.80
nameMethod · 0.80
cpp_typeMethod · 0.45

Tested by

no test coverage detected