torchgen: move dispatch_helpers out of RegisterDispatchDefinitions.ini (#144363)

The dispatch_helpers should be generated once, not once per kernel namespace.

Differential Revision: [D67925497](https://our.internmc.facebook.com/intern/diff/D67925497/)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/144363
Approved by: https://github.com/bdhirsh
This commit is contained in:
Scott Wolchok
2025-01-09 15:00:20 -08:00
committed by PyTorch MergeBot
parent 7a93a58b3c
commit 603e1c0b02
4 changed files with 10 additions and 7 deletions

View File

@ -1642,9 +1642,6 @@ TORCH_LIBRARY_IMPL({namespace}, {dispatch_key}, m) {{
lambda: {
"ns_prologue": ns_helper.prologue,
"ns_epilogue": ns_helper.epilogue,
"dispatch_helpers": dest.gen_registration_helpers(backend_idx)
if gen_dispatch_helpers
else [],
"dispatch_anonymous_definitions": anonymous_definitions[
kernel_namespace
],
@ -2331,7 +2328,9 @@ def gen_source_files(
backend_index, per_operator_headers, rocm
),
"ops_headers": operator_headers(),
"dispatch_helpers": "",
"dispatch_helpers": dest.gen_registration_helpers(backend_index)
if gen_dispatch_helpers
else [],
"dispatch_definitions": dispatch_definitions,
},
)