xref: /aosp_15_r20/external/executorch/codegen/templates/RegisterKernels.cpp (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
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 // ${generated_comment}
10 // This implements register_all_kernels() API that is declared in
11 // RegisterKernels.h
12 #include "RegisterKernels.h"
13 #include "${fn_header}" // Generated Function import headers
14 
15 namespace torch {
16 namespace executor {
17 
register_all_kernels()18 Error register_all_kernels() {
19   Kernel kernels_to_register[] = {
20       ${unboxed_kernels} // Generated kernels
21   };
22   Error success_with_kernel_reg =
23       ::executorch::runtime::register_kernels({kernels_to_register});
24   if (success_with_kernel_reg != Error::Ok) {
25     ET_LOG(Error, "Failed register all kernels");
26     return success_with_kernel_reg;
27   }
28   return Error::Ok;
29 }
30 
31 } // namespace executor
32 } // namespace torch
33