MLIR  19.0.0git
Shape.h
Go to the documentation of this file.
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 
18 #include "mlir/IR/BuiltinOps.h"
19 #include "mlir/IR/Dialect.h"
20 #include "mlir/IR/OpDefinition.h"
22 #include "mlir/IR/SymbolTable.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
bool isExtentTensorType(Type)
Definition: Shape.cpp:44
LogicalResult getShapeVec(Value input, SmallVectorImpl< int64_t > &shapeValues)
Definition: Shape.cpp:49
RankedTensorType getExtentTensorType(MLIRContext *ctx, int64_t rank=ShapedType::kDynamic)
Alias type for extent tensors.
Definition: Shape.cpp:40
Include the generated interface declarations.