[mlir][acc] Introduce MappableType interface (#122146)
[llvm-project.git] / mlir / include / mlir-c / Dialect / Transform / Interpreter.h
blobfa320324234e8ddc627db4d6c88603bc937c9271
1 //===-- mlir-c/Dialect/Transform/Interpreter.h --------------------*- C -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM
4 // Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // C interface to the transform dialect interpreter.
12 //===----------------------------------------------------------------------===//
14 #include "mlir-c/IR.h"
15 #include "mlir-c/Support.h"
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
21 #define DEFINE_C_API_STRUCT(name, storage) \
22 struct name { \
23 storage *ptr; \
24 }; \
25 typedef struct name name
27 DEFINE_C_API_STRUCT(MlirTransformOptions, void);
29 #undef DEFINE_C_API_STRUCT
31 //----------------------------------------------------------------------------//
32 // MlirTransformOptions
33 //----------------------------------------------------------------------------//
35 /// Creates a default-initialized transform options object.
36 MLIR_CAPI_EXPORTED MlirTransformOptions mlirTransformOptionsCreate(void);
38 /// Enables or disables expensive checks in transform options.
39 MLIR_CAPI_EXPORTED void
40 mlirTransformOptionsEnableExpensiveChecks(MlirTransformOptions transformOptions,
41 bool enable);
43 /// Returns true if expensive checks are enabled in transform options.
44 MLIR_CAPI_EXPORTED bool mlirTransformOptionsGetExpensiveChecksEnabled(
45 MlirTransformOptions transformOptions);
47 /// Enables or disables the enforcement of the top-level transform op being
48 /// single in transform options.
49 MLIR_CAPI_EXPORTED void mlirTransformOptionsEnforceSingleTopLevelTransformOp(
50 MlirTransformOptions transformOptions, bool enable);
52 /// Returns true if the enforcement of the top-level transform op being single
53 /// is enabled in transform options.
54 MLIR_CAPI_EXPORTED bool mlirTransformOptionsGetEnforceSingleTopLevelTransformOp(
55 MlirTransformOptions transformOptions);
57 /// Destroys a transform options object previously created by
58 /// mlirTransformOptionsCreate.
59 MLIR_CAPI_EXPORTED void
60 mlirTransformOptionsDestroy(MlirTransformOptions transformOptions);
62 //----------------------------------------------------------------------------//
63 // Transform interpreter and utilities.
64 //----------------------------------------------------------------------------//
66 /// Applies the transformation script starting at the given transform root
67 /// operation to the given payload operation. The module containing the
68 /// transform root as well as the transform options should be provided. The
69 /// transform operation must implement TransformOpInterface and the module must
70 /// be a ModuleOp. Returns the status of the application.
71 MLIR_CAPI_EXPORTED MlirLogicalResult mlirTransformApplyNamedSequence(
72 MlirOperation payload, MlirOperation transformRoot,
73 MlirOperation transformModule, MlirTransformOptions transformOptions);
75 /// Merge the symbols from `other` into `target`, potentially renaming them to
76 /// avoid conflicts. Private symbols may be renamed during the merge, public
77 /// symbols must have at most one declaration. A name conflict in public symbols
78 /// is reported as an error before returning a failure.
79 ///
80 /// Note that this clones the `other` operation unlike the C++ counterpart that
81 /// takes ownership.
82 MLIR_CAPI_EXPORTED MlirLogicalResult
83 mlirMergeSymbolsIntoFromClone(MlirOperation target, MlirOperation other);
85 #ifdef __cplusplus
87 #endif