[llvm] [mlir] [TOSA] Add Tosa_Shape type and ConstShapeOp (PR #122547)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 14 08:08:59 PST 2025
================
@@ -962,11 +970,31 @@ LogicalResult tosa::TableOp::verify() {
return success();
}
+LogicalResult
+tosa::TileOp::getConstantMultiples(SmallVector<int64_t> &multiples) {
+ // Multiples must be constants.
+ DenseIntElementsAttr multiplesAttr;
+ if (!matchPattern(getMultiples(), m_Constant(&multiplesAttr)))
+ return failure();
+ multiples = llvm::to_vector(
+ llvm::map_range(multiplesAttr.getValues<APInt>(),
+ [](const APInt &val) { return val.getSExtValue(); }));
+ return success();
+}
+
LogicalResult tosa::TileOp::inferReturnTypeComponents(
MLIRContext *context, ::std::optional<Location> location,
TileOp::Adaptor adaptor,
SmallVectorImpl<ShapedTypeComponents> &inferredReturnShapes) {
- ArrayRef<int64_t> multiples = adaptor.getMultiples();
+ DenseIntElementsAttr multiplesAttr;
----------------
Jerry-Ge wrote:
yes, I'm aligning the patches 1 by 1 to make sure things are clean. Those will be in my following patches.
https://github.com/llvm/llvm-project/pull/122547
More information about the llvm-commits
mailing list