-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir] Add ScalableVectorType and FixedVectorType #87986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3c51d92
3cf83b1
8c5e54a
aab6b8e
1baa7ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//===- VectorTypes.h - MLIR Vector Types ------------------------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Convenience wrappers for `VectorType` to allow idiomatic code like | ||
// * isa<vector::ScalableVectorType>(type) | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef MLIR_IR_VECTORTYPES_H | ||
#define MLIR_IR_VECTORTYPES_H | ||
|
||
#include "mlir/IR/BuiltinTypes.h" | ||
#include "mlir/IR/Types.h" | ||
|
||
namespace mlir { | ||
namespace vector { | ||
|
||
/// A vector type containing at least one scalable dimension. | ||
class ScalableVectorType : public VectorType { | ||
public: | ||
using VectorType::VectorType; | ||
|
||
static bool classof(Type type) { | ||
auto vecTy = llvm::dyn_cast<VectorType>(type); | ||
if (!vecTy) | ||
return false; | ||
return vecTy.isScalable(); | ||
} | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need something akin to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These seem to only be required for operations for now I believe. Worst case they could probably be easy to make available using |
||
|
||
/// A vector type with no scalable dimensions. | ||
class FixedVectorType : public VectorType { | ||
public: | ||
using VectorType::VectorType; | ||
static bool classof(Type type) { | ||
auto vecTy = llvm::dyn_cast<VectorType>(type); | ||
if (!vecTy) | ||
return false; | ||
return !vecTy.isScalable(); | ||
} | ||
}; | ||
|
||
} // namespace vector | ||
} // namespace mlir | ||
|
||
#endif // MLIR_IR_VECTORTYPES_H |
Uh oh!
There was an error while loading. Please reload this page.