File tree Expand file tree Collapse file tree 4 files changed +66
-2
lines changed
include/mlir/Dialect/Vector/IR Expand file tree Collapse file tree 4 files changed +66
-2
lines changed Original file line number Diff line number Diff line change 1+ // ===- VectorTypes.h - MLIR Vector Types ------------------------*- 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+ #ifndef MLIR_DIALECT_VECTOR_IR_VECTORTYPES_H_
10+ #define MLIR_DIALECT_VECTOR_IR_VECTORTYPES_H_
11+
12+ #include " mlir/IR/BuiltinTypes.h"
13+ #include " mlir/IR/Diagnostics.h"
14+ #include " mlir/IR/Types.h"
15+
16+ namespace mlir {
17+ namespace vector {
18+
19+ class ScalableVectorType : public VectorType {
20+ public:
21+ using VectorType::VectorType;
22+
23+ static bool classof (Type type);
24+ };
25+
26+ class FixedWidthVectorType : public VectorType {
27+ public:
28+ using VectorType::VectorType;
29+ static bool classof (Type type);
30+ };
31+
32+ } // namespace vector
33+ } // namespace mlir
34+
35+ #endif // MLIR_DIALECT_VECTOR_IR_VECTORTYPES_H_
Original file line number Diff line number Diff line change 1414#include " mlir/Dialect/Arith/IR/Arith.h"
1515#include " mlir/Dialect/CommonFolders.h"
1616#include " mlir/Dialect/UB/IR/UBOps.h"
17+ #include " mlir/Dialect/Vector/IR/VectorTypes.h"
1718#include " mlir/IR/Builders.h"
1819#include " mlir/IR/BuiltinAttributeInterfaces.h"
1920#include " mlir/IR/BuiltinAttributes.h"
@@ -214,8 +215,8 @@ LogicalResult arith::ConstantOp::verify() {
214215 " value must be an integer, float, or elements attribute" );
215216 }
216217
217- auto vecType = dyn_cast<VectorType >(type);
218- if (vecType && vecType. isScalable () && !isa<SplatElementsAttr>(getValue ()))
218+ if (isa<vector::ScalableVectorType >(type) &&
219+ !isa<SplatElementsAttr>(getValue ()))
219220 return emitOpError (
220221 " intializing scalable vectors with elements attribute is not supported"
221222 " unless it's a vector splat" );
Original file line number Diff line number Diff line change 11add_mlir_dialect_library(MLIRVectorDialect
22 VectorOps.cpp
3+ VectorTypes.cpp
34 ValueBoundsOpInterfaceImpl.cpp
45 ScalableValueBoundsConstraintSet.cpp
56
Original file line number Diff line number Diff line change 1+ // ===- VectorTypes.cpp - MLIR Vector Types --------------------------------===//
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+ #include " mlir/Dialect/Vector/IR/VectorTypes.h"
10+ #include " mlir/IR/BuiltinTypes.h"
11+
12+ using namespace mlir ;
13+ using namespace mlir ::vector;
14+
15+ bool ScalableVectorType::classof (Type type) {
16+ auto vecTy = llvm::dyn_cast<VectorType>(type);
17+ if (!vecTy)
18+ return false ;
19+ return vecTy.isScalable ();
20+ }
21+
22+ bool FixedWidthVectorType::classof (Type type) {
23+ auto vecTy = llvm::dyn_cast<VectorType>(type);
24+ if (!vecTy)
25+ return false ;
26+ return !vecTy.isScalable ();
27+ }
You can’t perform that action at this time.
0 commit comments