MLIR 24.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
17#include "mlir/IR/BuiltinOps.h"
18
19#define GET_TYPEDEF_CLASSES
20#include "mlir/Dialect/Shape/IR/ShapeOpsTypes.h.inc"
21
22namespace mlir {
23class PatternRewriter;
24
25namespace shape {
26
27/// Alias type for extent tensors.
28RankedTensorType getExtentTensorType(MLIRContext *ctx,
29 int64_t rank = ShapedType::kDynamic);
30
31// Check if a type is an extent tensor, e.g., tensor<?xindex>.
32bool isExtentTensorType(Type);
33
34// Given an input shape Value, try to obtain the shape's values.
35LogicalResult getShapeVec(Value input, SmallVectorImpl<int64_t> &shapeValues);
36
37} // namespace shape
38} // namespace mlir
39
40#define GET_OP_CLASSES
41#include "mlir/Dialect/Shape/IR/ShapeOps.h.inc"
42
43#include "mlir/Dialect/Shape/IR/ShapeOpsDialect.h.inc"
44
45#endif // MLIR_DIALECT_SHAPE_IR_SHAPE_H
bool isExtentTensorType(Type)
Definition Shape.cpp:42
LogicalResult getShapeVec(Value input, SmallVectorImpl< int64_t > &shapeValues)
Definition Shape.cpp:47
RankedTensorType getExtentTensorType(MLIRContext *ctx, int64_t rank=ShapedType::kDynamic)
Alias type for extent tensors.
Definition Shape.cpp:38
Include the generated interface declarations.