Closed tiffinyk closed 9 months ago
me too
Hi. I am also having this problem.
I have struggled with this problem
I am having the same issue :(
i think mlir dialect always require the variable datatype to be at the end of the line so for example:
%2 = hls.affine.select #set(%arg5) %1, %0 : f32 {timing = #hls.t<10 -> 10, 0, 0>}
should be
%2 = hls.affine.select #set(%arg5) %1, %0 {timing = #hls.t<10 -> 10, 0, 0>}: f32
I changed all the related lines and it works for me. I also tried deleting the timing thingy and it seems to generate the same code. There is probably a bug in hls.affine.select
but I could not locate it.
There is probably a bug in
hls.affine.select
but I could not locate it.
OK, I've find the cause of this error. It's because that the parser and the printer work differently. Let's take a look at the code snippet from lib/Dialect/HLS/HLS.cpp
:
ParseResult AffineSelectOp::parse(OpAsmParser &parser, OperationState &result) {
// Parse the condition attribute set.
IntegerSetAttr conditionAttr;
unsigned numDims;
if (parser.parseAttribute(conditionAttr,
AffineSelectOp::getConditionAttrStrName(),
result.attributes) ||
parseDimAndSymbolList(parser, result.operands, numDims))
return failure();
// Verify the condition operands.
auto set = conditionAttr.getValue();
if (set.getNumDims() != numDims)
return parser.emitError(
parser.getNameLoc(),
"dim operand count and integer set dim count must match");
if (numDims + set.getNumSymbols() != result.operands.size())
return parser.emitError(
parser.getNameLoc(),
"symbol operand count and integer set symbol count must match");
SmallVector<OpAsmParser::UnresolvedOperand, 4> values;
SMLoc valuesLoc = parser.getCurrentLocation();
Type resultType;
if (parser.parseOperandList(values) ||
parser.parseOptionalAttrDict(result.attributes) ||
parser.parseColonType(resultType))
return failure();
result.types.push_back(resultType);
if (values.size() != 2)
return parser.emitError(valuesLoc, "should only have two input values");
if (parser.resolveOperands(values, {resultType, resultType}, valuesLoc,
result.operands))
return failure();
return success();
}
void AffineSelectOp::print(OpAsmPrinter &p) {
auto conditionAttr =
(*this)->getAttrOfType<IntegerSetAttr>(getConditionAttrStrName());
p << " " << conditionAttr;
printDimAndSymbolList(getArgs().begin(), getArgs().end(),
conditionAttr.getValue().getNumDims(), p);
p << " ";
p.printOperand(getTrueValue());
p << ", ";
p.printOperand(getFalseValue());
// p << " : ";
// p.printType(getType());
// Print the attribute list.
p.printOptionalAttrDict((*this)->getAttrs(),
/*elidedAttrs=*/getConditionAttrStrName());
p << " : ";
p.printType(getType());
}
It's quite clear that the parser always parse the attribute first and then the type, but the printer will print the type first and then the attribute. So when this Op is created, it'll print out like %2 = hls.affine.select #set(%arg5) %1, %0 : f32 {timing = #hls.t<10 -> 10, 0, 0>}
, but at the mean time the parser parse the type and say: "hey, there is something not right". Then we have this error.
The solution is quite easy, just use the commented one I wrote in the code above and delete or comment the other print and everything will be nicely working.
Fixed in b69f334c9c122fad3759fcf388d3f039689b6fc0
Hi, when I run the DSE of gemm in README.md, an error occurs: