Files
clang-p2996/mlir/include/mlir-c/Dialect/Transform.h
martin-luecke 681eacc1b6 [MLIR][transform][python] add sugared python abstractions for transform dialect (#75073)
This adds Python abstractions for the different handle types of the
transform dialect

The abstractions allow for straightforward chaining of transforms by
calling their member functions.
As an initial PR for this infrastructure, only a single transform is
included: `transform.structured.match`.
With a future `tile` transform abstraction an example of the usage is: 
```Python
def script(module: OpHandle):
    module.match_ops(MatchInterfaceEnum.TilingInterface).tile(tile_sizes=[32,32])
```
to generate the following IR:
```mlir
%0 = transform.structured.match interface{TilingInterface} in %arg0
%tiled_op, %loops = transform.structured.tile_using_for %0 [32, 32]
```

These abstractions are intended to enhance the usability and flexibility
of the transform dialect by providing an accessible interface that
allows for easy assembly of complex transformation chains.
2023-12-15 13:04:43 +01:00

84 lines
2.8 KiB
C

//===-- mlir-c/Dialect/Transform.h - C API for Transform Dialect --*- C -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM
// Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_C_DIALECT_TRANSFORM_H
#define MLIR_C_DIALECT_TRANSFORM_H
#include "mlir-c/IR.h"
#include "mlir-c/Support.h"
#ifdef __cplusplus
extern "C" {
#endif
MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Transform, transform);
//===---------------------------------------------------------------------===//
// AnyOpType
//===---------------------------------------------------------------------===//
MLIR_CAPI_EXPORTED bool mlirTypeIsATransformAnyOpType(MlirType type);
MLIR_CAPI_EXPORTED MlirTypeID mlirTransformAnyOpTypeGetTypeID(void);
MLIR_CAPI_EXPORTED MlirType mlirTransformAnyOpTypeGet(MlirContext ctx);
//===---------------------------------------------------------------------===//
// AnyParamType
//===---------------------------------------------------------------------===//
MLIR_CAPI_EXPORTED bool mlirTypeIsATransformAnyParamType(MlirType type);
MLIR_CAPI_EXPORTED MlirTypeID mlirTransformAnyParamTypeGetTypeID(void);
MLIR_CAPI_EXPORTED MlirType mlirTransformAnyParamTypeGet(MlirContext ctx);
//===---------------------------------------------------------------------===//
// AnyValueType
//===---------------------------------------------------------------------===//
MLIR_CAPI_EXPORTED bool mlirTypeIsATransformAnyValueType(MlirType type);
MLIR_CAPI_EXPORTED MlirTypeID mlirTransformAnyValueTypeGetTypeID(void);
MLIR_CAPI_EXPORTED MlirType mlirTransformAnyValueTypeGet(MlirContext ctx);
//===---------------------------------------------------------------------===//
// OperationType
//===---------------------------------------------------------------------===//
MLIR_CAPI_EXPORTED bool mlirTypeIsATransformOperationType(MlirType type);
MLIR_CAPI_EXPORTED MlirTypeID mlirTransformOperationTypeGetTypeID(void);
MLIR_CAPI_EXPORTED MlirType
mlirTransformOperationTypeGet(MlirContext ctx, MlirStringRef operationName);
MLIR_CAPI_EXPORTED MlirStringRef
mlirTransformOperationTypeGetOperationName(MlirType type);
//===---------------------------------------------------------------------===//
// ParamType
//===---------------------------------------------------------------------===//
MLIR_CAPI_EXPORTED bool mlirTypeIsATransformParamType(MlirType type);
MLIR_CAPI_EXPORTED MlirTypeID mlirTransformParamTypeGetTypeID(void);
MLIR_CAPI_EXPORTED MlirType mlirTransformParamTypeGet(MlirContext ctx,
MlirType type);
MLIR_CAPI_EXPORTED MlirType mlirTransformParamTypeGetType(MlirType type);
#ifdef __cplusplus
}
#endif
#endif // MLIR_C_DIALECT_TRANSFORM_H