1 //===- Shape.h - MLIR Shape dialect -----------------------------*- C++ -*-===// 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 // This file defines the shape dialect that is used to describe and solve shape 10 // relations of MLIR operations using ShapedType. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef MLIR_DIALECT_SHAPE_IR_SHAPE_H 15 #define MLIR_DIALECT_SHAPE_IR_SHAPE_H 16 17 #include "mlir/Bytecode/BytecodeOpInterface.h" 18 #include "mlir/IR/BuiltinOps.h" 19 #include "mlir/IR/Dialect.h" 20 #include "mlir/IR/OpDefinition.h" 21 #include "mlir/IR/OpImplementation.h" 22 #include "mlir/IR/SymbolTable.h" 23 #include "mlir/Interfaces/CallInterfaces.h" 24 #include "mlir/Interfaces/CastInterfaces.h" 25 #include "mlir/Interfaces/ControlFlowInterfaces.h" 26 #include "mlir/Interfaces/FunctionInterfaces.h" 27 #include "mlir/Interfaces/InferTypeOpInterface.h" 28 #include "mlir/Interfaces/SideEffectInterfaces.h" 29 30 #define GET_TYPEDEF_CLASSES 31 #include "mlir/Dialect/Shape/IR/ShapeOpsTypes.h.inc" 32 33 namespace mlir { 34 class PatternRewriter; 35 36 namespace shape { 37 38 /// Alias type for extent tensors. 39 RankedTensorType getExtentTensorType(MLIRContext *ctx, 40 int64_t rank = ShapedType::kDynamic); 41 42 // Check if a type is an extent tensor, e.g., tensor<?xindex>. 43 bool isExtentTensorType(Type); 44 45 // Given an input shape Value, try to obtain the shape's values. 46 LogicalResult getShapeVec(Value input, SmallVectorImpl<int64_t> &shapeValues); 47 48 } // namespace shape 49 } // namespace mlir 50 51 #define GET_OP_CLASSES 52 #include "mlir/Dialect/Shape/IR/ShapeOps.h.inc" 53 54 #include "mlir/Dialect/Shape/IR/ShapeOpsDialect.h.inc" 55 56 #endif // MLIR_DIALECT_SHAPE_IR_SHAPE_H 57