1 /* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * All rights reserved. 4 * 5 * This source code is licensed under the BSD-style license found in the 6 * LICENSE file in the root directory of this source tree. 7 */ 8 9 #include <executorch/runtime/core/evalue.h> 10 #include <executorch/runtime/core/exec_aten/exec_aten.h> 11 #include <executorch/runtime/core/span.h> 12 #include <executorch/runtime/kernel/operator_registry.h> 13 #include <executorch/runtime/platform/profiler.h> 14 #include "${fn_header}" // Generated Function import headers 15 // ${generated_comment} 16 17 // NOTE [Sharded File]: This file is generated in a sharded fashion to speed up 18 // incremental rebuilds. See the comment at the top of 19 // templates/VariableType.cpp for an analogous, in-depth discussion. 20 // 21 // Generated by tools/jit/gen_unboxing.py. This file registers all ATen ops into 22 // JIT op registry instead of c10 dispatcher. JIT op registry only takes boxed 23 // kernels, so we are calling unboxing functions in UnboxingFunctions.h to cast 24 // arguments into C++ types (instead of IValue) and delegate to unboxed kernels. 25 using KernelSpan = 26 ::executorch::runtime::Span<const ::executorch::runtime::Kernel>; 27 namespace torch { 28 namespace executor { 29 namespace function { 30 namespace { 31 32 static Kernel kernels_to_register[] = { 33 ${unboxed_kernels} // Generated kernels 34 }; 35 36 // Explicitly convert to Span, so that the API can take an empty C array of 37 // Kernels. 38 static KernelSpan kernel_span( 39 kernels_to_register, 40 kernels_to_register + sizeof(kernels_to_register) / sizeof(Kernel)); 41 42 // Return value not used. Keep the static variable assignment to register 43 // kernels in static initialization time. 44 static auto success_with_kernel_reg = register_kernels(kernel_span); 45 } // namespace 46 } // namespace function 47 } // namespace executor 48 } // namespace torch 49