Files
pytorch/test/edge/templates/RegisterCodegenUnboxedKernels.cpp
PyTorch MergeBot 67067512a1 Revert "[BE] Cleanup old ExecuTorch codegen and runtime code (#154165)"
This reverts commit 515c19a3856e953c0fe23a0ed4fa844f8eea34d8.

Reverted https://github.com/pytorch/pytorch/pull/154165 on behalf of https://github.com/seemethere due to This is failing when attempting to test against executorch main internally, author has acknowledged that this should be reverted ([comment](https://github.com/pytorch/pytorch/pull/154165#issuecomment-2931489616))
2025-06-02 16:28:46 +00:00

29 lines
844 B
C++

#include <operator_registry.h>
#include <event_tracer_hooks.h>
#include "${fn_header}" // Generated Function import headers
namespace torch {
namespace executor {
using namespace internal;
namespace {
using KernelArrayRef = ::at::ArrayRef<::torch::executor::Kernel>;
static Kernel kernels_to_register[] = {
${unboxed_kernels} // Generated operators
};
// Explicitly convert to ArrayRef, so that the API can take an empty C array of
// Kernels.
static KernelArrayRef kernel_array_ref(
kernels_to_register,
kernels_to_register + sizeof(kernels_to_register) / sizeof(Kernel));
// Return value not used. Keep the static variable assignment to register
// operators in static initialization time.
static auto success_with_kernel_reg = register_kernels(kernel_array_ref);
} // namespace
} // namespace executor
} // namespace torch