14#include "llvm/ADT/STLExtras.h"
15#include "llvm/Support/InterleavedRange.h"
30 elements.push_back(value);
35 "parsing values in integer list attribute")) {
39 auto i32Type = IntegerType::get(parser.
getContext(), 32);
48 printer << llvm::interleaved_array(
49 llvm::map_range(attr.getValues<APInt>(),
50 [](
const APInt &a) { return a.getSExtValue(); }));
57LogicalResult TosaSelectOp::verify() {
58 TensorArmType condType = getConditionType();
59 TensorArmType trueValType = getTrueValueType();
60 TensorArmType falseValType = getFalseValueType();
61 TensorArmType resultType = getResultType();
65 [](TensorArmType type) {
return !type.hasRank(); }))
68 ArrayRef<int64_t> condShape = condType.getShape();
69 ArrayRef<int64_t> trueValShape = trueValType.getShape();
70 ArrayRef<int64_t> falseValShape = falseValType.getShape();
71 ArrayRef<int64_t> resultShape = resultType.getShape();
73 if (!llvm::all_equal({condShape.size(), trueValShape.size(),
74 falseValShape.size(), resultShape.size()})) {
82 llvm::zip_equal(condShape, trueValShape, falseValShape, resultShape)) {
83 auto [condDim, trueValDim, falseValDim, resultDim] = dims;
86 ArrayRef<int64_t>{condDim, trueValDim, falseValDim, resultDim},
87 [](int64_t dim) {
return ShapedType::isDynamic(dim); })) {
91 auto isPairBroadcastable = [](int64_t
lhs, int64_t
rhs) {
95 if (!isPairBroadcastable(condDim, trueValDim) ||
96 !isPairBroadcastable(condDim, falseValDim) ||
97 !isPairBroadcastable(trueValDim, falseValDim)) {
99 "failed to verify that the shape of inputs: condition, "
100 "true_value, and false_value are compatible for "
104 int64_t bradcastedInputDim =
105 std::max(condDim, std::max(trueValDim, falseValDim));
106 if (bradcastedInputDim != resultDim) {
108 "failed to verify that the broadcast shape of inputs: condition, "
109 "true_value, and false_value is equal to "
p<< " : "<< getMemRefType()<< ", "<< getType();}static LogicalResult verifyVectorMemoryOp(Operation *op, MemRefType memrefType, VectorType vectorType) { if(memrefType.getElementType() !=vectorType.getElementType()) return op-> emitOpError("requires memref and vector types of the same elemental type")
Given a list of lists of parsed operands, populates uniqueOperands with unique operands.
@ Square
Square brackets surrounding zero or more operands.
virtual ParseResult parseCommaSeparatedList(Delimiter delimiter, function_ref< ParseResult()> parseElementFn, StringRef contextMessage=StringRef())=0
Parse a list of comma-separated items with an optional delimiter.
MLIRContext * getContext() const
ParseResult parseInteger(IntT &result)
Parse an integer value from the stream.
An attribute that represents a reference to a dense integer vector or tensor object.
static DenseIntElementsAttr get(const ShapedType &type, Arg &&arg)
Get an instance of a DenseIntElementsAttr with the given arguments.
The OpAsmParser has methods for interacting with the asm parser: parsing things from it,...
This is a pure-virtual base class that exposes the asmprinter hooks necessary to implement a custom p...
Operation is the basic unit of execution within MLIR.
static TensorArmType get(ArrayRef< int64_t > shape, Type elementType)
void printSPIRV_I32_1DArmTensor(OpAsmPrinter &printer, Operation *, DenseIntElementsAttr attr)
ParseResult parseSPIRV_I32_1DArmTensor(OpAsmParser &parser, DenseIntElementsAttr &attr)