diff --git a/mlir/include/mlir/IR/Builders.h b/mlir/include/mlir/IR/Builders.h --- a/mlir/include/mlir/IR/Builders.h +++ b/mlir/include/mlir/IR/Builders.h @@ -130,6 +130,14 @@ DenseIntElementsAttr getI64VectorAttr(ArrayRef values); DenseIntElementsAttr getIndexVectorAttr(ArrayRef values); + /// Vector-typed DenseArrayAttr getters. + DenseI8ArrayAttr getDenseI8ArrayAttr(ArrayRef values); + DenseI16ArrayAttr getDenseI16ArrayAttr(ArrayRef values); + DenseI32ArrayAttr getDenseI32ArrayAttr(ArrayRef values); + DenseI64ArrayAttr getDenseI64ArrayAttr(ArrayRef values); + DenseF32ArrayAttr getDenseF32ArrayAttr(ArrayRef values); + DenseF64ArrayAttr getDenseF64ArrayAttr(ArrayRef values); + /// Tensor-typed DenseIntElementsAttr getters. `values` can be empty. /// These are generally preferable for representing general lists of integers /// as attributes. diff --git a/mlir/lib/IR/Builders.cpp b/mlir/lib/IR/Builders.cpp --- a/mlir/lib/IR/Builders.cpp +++ b/mlir/lib/IR/Builders.cpp @@ -124,6 +124,30 @@ values); } +DenseI8ArrayAttr Builder::getDenseI8ArrayAttr(ArrayRef values) { + return DenseI8ArrayAttr::get(context, values); +} + +DenseI16ArrayAttr Builder::getDenseI16ArrayAttr(ArrayRef values) { + return DenseI16ArrayAttr::get(context, values); +} + +DenseI32ArrayAttr Builder::getDenseI32ArrayAttr(ArrayRef values) { + return DenseI32ArrayAttr::get(context, values); +} + +DenseI64ArrayAttr Builder::getDenseI64ArrayAttr(ArrayRef values) { + return DenseI64ArrayAttr::get(context, values); +} + +DenseF32ArrayAttr Builder::getDenseF32ArrayAttr(ArrayRef values) { + return DenseF32ArrayAttr::get(context, values); +} + +DenseF64ArrayAttr Builder::getDenseF64ArrayAttr(ArrayRef values) { + return DenseF64ArrayAttr::get(context, values); +} + DenseIntElementsAttr Builder::getI32TensorAttr(ArrayRef values) { return DenseIntElementsAttr::get( RankedTensorType::get(static_cast(values.size()),