Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tool: (xdsl-tblgen) Problem generating xdsl-tblgen with this json file #3787

Open
erick-xanadu opened this issue Jan 24, 2025 · 1 comment
Open
Labels
bug Something isn't working tool

Comments

@erick-xanadu
Copy link

./llvm-project/build/bin/llvm-tblgen -D stablehlo --dump-json -I ./llvm-project/mlir/include/ -I ./mlir-hlo/stablehlo/ mlir-hlo/stablehlo/stablehlo/dialect/StablehloOps.td  > stablehlo.json

In these commit of LLVM and MLIR-HLO

mhlo=89a891c986650c33df76885f5620e0a92150d90f
llvm=3a8316216807d64a586b971f51695e23883331f7

stablehlo.json

I get the following error:

Traceback (most recent call last):
  File "/home/ubuntu/code/env/bin/xdsl-tblgen", line 8, in <module>
    sys.exit(main())
  File "/home/ubuntu/code/env/lib/python3.10/site-packages/xdsl/tools/tblgen_to_py.py", line 631, in main
    tblgen_to_py(args.input_file, cull=args.cull)
  File "/home/ubuntu/code/env/lib/python3.10/site-packages/xdsl/tools/tblgen_to_py.py", line 599, in tblgen_to_py
    [dialect] = dialects
ValueError: too many values to unpack (expected 1)

And after removing the ShapeDialect from the json (in other words "Dialect":["ShapeDialect","StableHLO_Dialect"] -> "Dialect":["StableHLO_Dialect"]

Traceback (most recent call last):
  File "/home/ubuntu/code/env/bin/xdsl-tblgen", line 8, in <module>
    sys.exit(main())
  File "/home/ubuntu/code/env/lib/python3.10/site-packages/xdsl/tools/tblgen_to_py.py", line 631, in main
    tblgen_to_py(args.input_file, cull=args.cull)
  File "/home/ubuntu/code/env/lib/python3.10/site-packages/xdsl/tools/tblgen_to_py.py", line 600, in tblgen_to_py
    loader.generate_dialect(dialect)
  File "/home/ubuntu/code/env/lib/python3.10/site-packages/xdsl/tools/tblgen_to_py.py", line 173, in generate_dialect
    self.generate_op(op, dialect_name)
  File "/home/ubuntu/code/env/lib/python3.10/site-packages/xdsl/tools/tblgen_to_py.py", line 418, in generate_op
    (variadicity, constraint) = self._resolve_constraint(arg)
  File "/home/ubuntu/code/env/lib/python3.10/site-packages/xdsl/tools/tblgen_to_py.py", line 399, in _resolve_constraint
    self._resolve_prop_constraint(rec["baseAttr"]),
  File "/home/ubuntu/code/env/lib/python3.10/site-packages/xdsl/tools/tblgen_to_py.py", line 314, in _resolve_prop_constraint
    if rec.name in self.attributes:
AttributeError: 'dict' object has no attribute 'name'
@compor
Copy link
Collaborator

compor commented Jan 24, 2025

CC @alexarice

@superlopuh superlopuh added bug Something isn't working tool labels Feb 13, 2025
@superlopuh superlopuh changed the title Problem generating xdsl-tblgen with this json file tool: (xdsl-tblgen) Problem generating xdsl-tblgen with this json file Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tool
Projects
None yet
Development

No branches or pull requests

3 participants