-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[mlir][mlir-tblgen] Emit correct error message if method is pruned #160334
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
Changes from 6 commits
0e28604
fa56c68
cac13aa
3525cc4
906c93f
95bac50
618b571
36a424b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // RUN: not mlir-tblgen -gen-attrdef-decls -I %S/../../include %s 2>&1 | FileCheck %s | ||
|
|
||
| include "mlir/IR/OpBase.td" | ||
|
|
||
| def Test_Dialect : Dialect { | ||
| let name = "test"; | ||
| let cppNamespace = "::test"; | ||
| } | ||
|
|
||
| class TestAttr<string attrName, string attrMnemonic, list<Trait> traits = []> | ||
| : AttrDef<Test_Dialect, attrName, traits> { | ||
| let mnemonic = attrMnemonic; | ||
| } | ||
|
|
||
| def TestAttr : TestAttr<"Test", "test"> { | ||
| let summary = "Test attrubute"; | ||
| let description = "Test attribute"; | ||
|
|
||
| let parameters = (ins AttrParameter<"std::int64_t", "arg">:$arg); | ||
| let builders = [AttrBuilder<(ins "std::int64_t":$arg), [{ | ||
| return $_get($_ctxt, arg); | ||
| }]>]; | ||
|
|
||
| let assemblyFormat = "`<` $arg `>`"; | ||
|
|
||
| let skipDefaultBuilders = 0; | ||
| let genVerifyDecl = 1; | ||
| let genMnemonicAlias = 1; | ||
| } | ||
|
|
||
| def Test_TestAttrOp : Op<Test_Dialect, "test", []> { | ||
| let summary = "test operation with attribute"; | ||
| let description = "test operation with attribute"; | ||
|
|
||
| let arguments = (ins TestAttr:$testAttr); | ||
| let assemblyFormat = "$testAttr attr-dict"; | ||
| } | ||
|
|
||
| // CHECK: attr-duplicated-builder-error.td:15:5: error: Unexpected overlap when generating `get` for TestAttr (from line 537) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // RUN: not mlir-tblgen -gen-attrdef-decls -I %S/../../include %s 2>&1 | FileCheck %s | ||
|
|
||
| include "mlir/IR/OpBase.td" | ||
|
|
||
| def Test_Dialect : Dialect { | ||
| let name = "test"; | ||
| let cppNamespace = "::test"; | ||
| } | ||
|
|
||
| class TestAttr<string attrName, string attrMnemonic, list<Trait> traits = []> | ||
| : AttrDef<Test_Dialect, attrName, traits> { | ||
| let mnemonic = attrMnemonic; | ||
| } | ||
|
|
||
| def TestAttr : TestAttr<"Test", "test"> { | ||
| let summary = "Test attrubute"; | ||
| let description = "Test attribute"; | ||
|
|
||
| let parameters = (ins AttrParameter<"std::int64_t", "arg">:$arg); | ||
| let builders = [AttrBuilder<(ins "std::int64_t":$arg), [{ | ||
| return $_get($_ctxt, arg); | ||
| }]>, | ||
| AttrBuilder<(ins "std::int64_t":$arg), [{ | ||
| // Duplicated builder | ||
| return $_get($_ctxt, arg); | ||
| }]>]; | ||
|
|
||
| let assemblyFormat = "`<` $arg `>`"; | ||
|
|
||
| let skipDefaultBuilders = 1; | ||
| let genVerifyDecl = 1; | ||
| let genMnemonicAlias = 1; | ||
| } | ||
|
|
||
| def Test_TestAttrOp : Op<Test_Dialect, "test", []> { | ||
| let summary = "test operation with attribute"; | ||
| let description = "test operation with attribute"; | ||
|
|
||
| let arguments = (ins TestAttr:$testAttr); | ||
| let assemblyFormat = "$testAttr attr-dict"; | ||
| } | ||
|
|
||
| // CHECK: attr-duplicated-custom-builders-error.td:15:5: error: Unexpected overlap when generating `get` for TestAttr (from line {{.*}}) | ||
|
||
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.
What is the "from line 537" referring to here?
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.
It's line number of error location in
AttrOrTypeDefGen.cpp.I followed this to be consistent with error handling logic in
OpDefinitionsGen.cpp.However, if you feel error message looks terse, I can improve it to provide more information, and omit line number of the original source code.
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.
Yes that seems preferable for the end-user. Thanks!