Closed JosseVanDelm closed 5 months ago
Looks like we need to add a new case here:
# Integer and float case
if self._current_token.kind == Token.Kind.FLOAT_LIT:
token = self._consume_token(Token.Kind.FLOAT_LIT)
value = token.get_float_value()
elif self._current_token.kind == Token.Kind.INTEGER_LIT:
token = self._consume_token(Token.Kind.INTEGER_LIT)
value = token.get_int_value()
else:
self.raise_error("Expected either a float, integer, or complex literal")
I'm guessing mlir is happy to process strings in this position
Actually, the code that needs to be changed is near:
shape: list[int] | None
if self._current_token.text == ">":
values, shape = [], None
else:
values, shape = self._parse_tensor_literal()
self.parse_punctuation(">", " in dense attribute")
The dense parameters are either a single string containing an hex, or a tensor literal.
It is not possible to parse something like ["0xff", "0xef"]
as far as I know
solved by #1974
Hi!
I'm trying to compile some of the MLPerf Tiny benchmarks. During this, at some point in compilation, the following IR is generated for the weight values, which tend to be quite a bit larger in shape and size than the following minimal error-throwing example here:
mlir-opt
is able to parse this just fine:But
xdsl-opt
is a bit confused :cry:Also, I suspect that this is an issue also because of the size of this DenseAttr. For the smaller cases it seems that mlir-opt is printing the values one by one with
[
s,]
s and,
s , but for larger sizes it is too lazy to do so, and now I can not parse this my file :upside_down_face: (otherwise I could just round-trip and print it as a huge<[1, 2 , 3, 4]>
I'll look into a PR to solve this tomorrow, but any pointers or help on how to solve this are very welcome!