xref: /aosp_15_r20/external/tensorflow/tensorflow/compiler/mlir/tools/kernel_gen/tf_framework_c_interface.h (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1 /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #ifndef TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TESTS_TF_FRAMEWORK_C_INTERFACE_H_
17 #define TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TESTS_TF_FRAMEWORK_C_INTERFACE_H_
18 
19 #include "mlir/ExecutionEngine/RunnerUtils.h"  // from @llvm-project
20 
21 namespace mlir {
22 namespace kernel_gen {
23 namespace tf_framework {
24 
25 extern "C" MLIR_RUNNERUTILS_EXPORT void* _mlir_ciface_tf_alloc(
26     void* op_kernel_ctx, size_t num_elements, size_t element_size,
27     int32_t output_index, int32_t num_candidates,
28     int32_t* candidate_input_indices);
29 
30 extern "C" MLIR_RUNNERUTILS_EXPORT void _mlir_ciface_tf_dealloc(
31     void* op_kernel_ctx, void* ptr);
32 
33 extern "C" MLIR_RUNNERUTILS_EXPORT void _mlir_ciface_tf_report_error(
34     void* op_kernel_ctx, int32_t error_code, char* msg);
35 
36 extern "C" MLIR_RUNNERUTILS_EXPORT void* _mlir_ciface_tf_jit_compile(
37     void* op_kernel_ctx, char* code, int64_t num_tile_sizes,
38     int64_t* tile_sizes_ptr, int64_t num_unroll_factors,
39     int64_t* unroll_factors_ptr, int64_t max_supported_rank, bool enable_ftz,
40     bool index_64bit);
41 
42 extern "C" MLIR_RUNNERUTILS_EXPORT void _mlir_ciface_tf_jit_execute(
43     void* op_kernel_ctx, void* callable, void* result, int64_t num_args,
44     void* args_ptr);
45 
46 }  // namespace tf_framework
47 }  // namespace kernel_gen
48 }  // namespace mlir
49 
50 #endif  // TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TESTS_TF_FRAMEWORK_C_INTERFACE_H_
51