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)
| 80 | |
| 81 | |
| 82 | def _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 | |
| 98 | def static_dispatch( |
no test coverage detected