1//===- AffineTransformOps.td - Affine transformation ops ---*- tablegen -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8 9#ifndef AFFINE_TRANSFORM_OPS 10#define AFFINE_TRANSFORM_OPS 11 12include "mlir/Dialect/Transform/IR/TransformDialect.td" 13include "mlir/Dialect/Transform/Interfaces/TransformInterfaces.td" 14include "mlir/Dialect/Transform/IR/TransformTypes.td" 15include "mlir/Interfaces/SideEffectInterfaces.td" 16include "mlir/IR/OpBase.td" 17 18def Transform_AffineForOp : Transform_ConcreteOpType<"affine.for">; 19 20def SimplifyBoundedAffineOpsOp 21 : Op<Transform_Dialect, "affine.simplify_bounded_affine_ops", 22 [DeclareOpInterfaceMethods<TransformOpInterface>, 23 DeclareOpInterfaceMethods<MemoryEffectsOpInterface>]> { 24 let description = [{ 25 Simplify the targeted affine.min / affine.max ops given the supplied 26 lower and upper bounds for values that may be used as target op operands. 27 28 Example: 29 ``` 30 %0 = transform.structured.match ops{["affine.min", "affine.max"]} in %arg1 31 %1 = transform.structured.match ops{["gpu.lane_id"]} in %arg1 32 transform.affine.simplify_bounded_affine_ops %0 with [%1] within [0] and [32] 33 34 // Multiple bounds can be specified. 35 transform.affine.simplify_bounded_affine_ops %0 with [%1, %2] within [0, 5] and [32, 50] 36 ``` 37 38 Bounded op handles (`%1` and `%2) must be mapped to ops that have a single 39 result of index type. The sets of target ops and bounded ops must not 40 overlap. 41 42 #### Return modes 43 44 Target ops must be affine.min or affine.max ops. This transform consumes the 45 target handle and does not produce any handle. It reads the bounded op 46 handles. 47 48 TODO: Support affine.apply targets. 49 TODO: Allow mixed PDL_Operation/int64_t for lower_bounds and upper_bounds. 50 }]; 51 52 let arguments = (ins TransformHandleTypeInterface:$target, 53 Variadic<TransformHandleTypeInterface>:$bounded_values, 54 DenseI64ArrayAttr:$lower_bounds, 55 DenseI64ArrayAttr:$upper_bounds); 56 let results = (outs); 57 let hasVerifier = 1; 58 59 let assemblyFormat = [{ 60 $target `with` `[` ($bounded_values^ `:` type($bounded_values))? `]` 61 `within` $lower_bounds `and` $upper_bounds attr-dict 62 `:` type($target) 63 }]; 64} 65 66#endif // Affine_TRANSFORM_OPS 67