-
Notifications
You must be signed in to change notification settings - Fork 7
Update TableGen for Qwerty_BasisVectorTreeAttr #48
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
base: wip/rec-vec
Are you sure you want to change the base?
Changes from all commits
cfb4021
a9d9b13
e577e59
e73cafb
b47daa4
2a1d644
60191b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to write a test to test at least the happy path for this parsing and verification. (In the past, when I haven't created such a test, the code breaks later when testing something tangential, confusing the daylights out of me) Here's the existing parsing test file for the Qwerty dialect that you can extend with a few new tests to hit the happy paths: https://github.com/gt-tinker/qwerty/blob/main/qwerty_mlir/tests/Qwerty/IR/parsing.mlir. Note in the first line it basically says to parse the IR, print it, and then parse it again. The tricky part is going to be writing the attribute at all, since I don't think there are any ops right now that have this attribute. Hmmm... The other tricky part is that FileCheck can be pretty confusing. It is type (4) of tests described in this document: https://github.com/gt-tinker/qwerty/blob/main/docs/testing.md. I can explain it in a meeting if it's helpful. I am not aware of there being a good tutorial for writing FileCheck. I just had to stare at other people's tests and the documentation to figure it out, but I can try to save you time by skipping most of that pain
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, here's how upstream tests attribute parsing: https://github.com/llvm/llvm-project/blob/9f73a97cfb1a40da42a870906e2221102a71f807/mlir/test/IR/custom-float-attr-roundtrip.mlir#L6. That's pretty cool, they have a dummy op called
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did this in a slightly different way by just using a module declaration. Let me know if that works for you, I was able to run the run-tests.sh script and it seemed to pass. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // RUN: qwerty-opt -split-input-file %s | qwerty-opt -split-input-file | FileCheck --strict-whitespace %s | ||
| // | ||
| // Happy-path round-trip (parse -> print -> parse -> print) of | ||
| // BasisVectorTreeAttr. If any case were malformed, parsing would fail and the round-trip would error here. | ||
|
|
||
|
|
||
| // A bare leaf atom: '0' (0 children -> empty brackets) | ||
| // CHECK: qwerty.t = #qwerty.vectree<ZeroVector []> | ||
| module attributes {qwerty.t = #qwerty.vectree<ZeroVector []>} {} | ||
|
|
||
| // ----- | ||
|
|
||
| // A tensor of computational atoms: '00' | ||
| // CHECK: qwerty.t = #qwerty.vectree<VectorTensor [#qwerty.vectree<ZeroVector []>, #qwerty.vectree<ZeroVector []>]> | ||
| module attributes {qwerty.t = #qwerty.vectree<VectorTensor [#qwerty.vectree<ZeroVector []>, #qwerty.vectree<ZeroVector []>]>} {} | ||
|
|
||
| // ----- | ||
|
|
||
| // The non-Pauli vector '0'@45 + '1'. | ||
| // CHECK: qwerty.t = #qwerty.vectree<UniformVectorSuperpos [#qwerty.vectree<VectorTilt tilt {{[0-9.eE+-]+}} : f64 [#qwerty.vectree<ZeroVector []>]>, #qwerty.vectree<OneVector []>]> | ||
| module attributes {qwerty.t = #qwerty.vectree<UniformVectorSuperpos [#qwerty.vectree<VectorTilt tilt 45.0 : f64 [#qwerty.vectree<ZeroVector []>]>, #qwerty.vectree<OneVector []>]>} {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow great idea for how to approach this. I was wondering how to do it, but you answered it.
It just needs a robust verifier, which you added (thanks)