Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/test/lib/Dialect/Test/TestOps.td | ||
---|---|---|
1905–1908 | This is to check that attribute when printed in the context of the assembly format generated by an operation. We have quite some hole in test around this (actually I need to add more test around attribute aliases around this) |
mlir/include/mlir/IR/OpBase.td | ||
---|---|---|
2941–2943 | Actually, why is this necessary? | |
mlir/test/lib/Dialect/Test/TestOps.td | ||
1905–1908 | I'm not sure I understand, the attribute would be formatted the exact same way. I'm not sure I would want to test every possible matrix of context, especially given that they all go through the same code path. |
Oh we crossed, I was rebasing and pushed while you marked it as "requested change",
mlir/include/mlir/IR/OpBase.td | ||
---|---|---|
2941–2943 | TableGen crashes without it, it is used to construct the Builder for the generated entity (Attribute or Type) | |
mlir/test/lib/Dialect/Test/TestOps.td | ||
1905–1908 | Actually they don't really go through the same code path, I learnt it the hard way while changing a bunch of things. The different is subtle but exists: when you come from the generic parser you will always go through the Dialect::printAttribute as you have a type-erased Attribute instance. |
Ah, it's fine. You gave me context offline. I think we should improve the general ODS concept of cppType though, feels not well baked right now.
mlir/test/lib/Dialect/Test/TestOps.td | ||
---|---|---|
1905–1908 | That is a tad bit surprising. I would expect that we go directly through the generic parser(parseAttribute)/printer(printAttribute) by default, what does it generate then? |
mlir/test/lib/Dialect/Test/TestOps.td | ||
---|---|---|
1905–1908 | It does end up in the same place... for now. The issue if we don't duplicate the testing right now, it means that touching at the assembly-format infrastructure in any way is basically not covered by tests (when playing with it I frequently get all of MLIR tests passing but hit issues in IREE or MHLO) |
mlir/test/lib/Dialect/Test/TestOps.td | ||
---|---|---|
1905–1908 | So this is guarding against a hypothetical future change? I'm slightly skeptical of allowing/having different overloaded behavior for printAttribute. Why wouldn't we just expose a different API if we wanted some different form of parsing behavior? |
mlir/test/lib/Dialect/Test/TestOps.td | ||
---|---|---|
1905–1908 | Sure, that's actually what I implemented, but it's not changing the fundamental problem: when I change the assembly format generator I still have all the tests passing by lack of coverage for them. |
mlir/test/lib/Dialect/Test/TestOps.td | ||
---|---|---|
1905–1908 | I'm not sure I understand you here. I don't think we should write a test for every possible format in every possible caller of printAttribute. It isn't adding any additional test coverage if it's going through the same code path. |
mlir/test/lib/Dialect/Test/TestOps.td | ||
---|---|---|
1905–1908 | I don't see this as coverage for printAttribute but as coverage for the declarative assembly format. The issue I have today is that I can change the declarative assembly format generator for an op, and it won't break any test because we don't have complete round-trip coverage. |
mlir/test/lib/Dialect/Test/TestOps.td | ||
---|---|---|
1905–1908 | It's a bit like if you write a new op with custom assembly by hand and you wouldn't provide test for your custom syntax parsing/printing (round-tripping really). |
mlir/test/lib/Dialect/Test/TestOps.td | ||
---|---|---|
1905–1908 | I don't see how this test supports that viewpoint? We have tests that checks if an attribute is used in the format, I don't see how this test adds coverage for anything that isn't already covered. |
Actually, why is this necessary?