Adds an operation that can create a 1D tensor from a list of values.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks.
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td | ||
---|---|---|
1556 | Answer is, it does not because the operand types cannot be deduced with the given traits. |
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td | ||
---|---|---|
1556 | You can do that with TypesMatchWith, this is common: |
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td | ||
---|---|---|
1556 | I might be doing smth wrong, but if i have the following op: mlir def TensorFromElementsOp : Std_Op<"tensor_from_elements", [NoSideEffect, SameOperandsAndResultElementType, TypesMatchWith<"value type matches element type of memref", "result", "elements", "$_self.cast<RankedTensorType>().getElementType()"> ]> { let arguments = (ins Variadic<AnyType>:$elements); let results = (outs AnyTensor:$result); let assemblyFormat = "`(` $elements `)` attr-dict `:` type($result)"; } then the operands will be resolved with a wrong resolveOperands overload. It should use ParseResult resolveOperands(ArrayRef<OperandType> operands, Type type, SmallVectorImpl<Value> &result) instead of ParseResult resolveOperands(ArrayRef<OperandType> operands, ArrayRef<Type> types, llvm::SMLoc loc, SmallVectorImpl<Value> &result) |
Maybe use SameOperandsAndResultElementType?