Skip to content

[mlir] Explain required attrs for CallOpInterface in Toy (NFC) #141018

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

Merged
merged 1 commit into from
May 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion mlir/docs/Tutorials/Toy/Ch-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,20 @@ def GenericCallOp : Toy_Op<"generic_call",

In the above we also use the `DeclareOpInterfaceMethods` directive to
auto-declare all of the interface methods in the class declaration of
GenericCallOp. We have already provided the definition in the `extraClassDeclaration`
`GenericCallOp`. However, using this directive with `CallOpInterface`
includes methods for handling argument and result attributes. Therefore,
we need to add these specifically named attributes to our `GenericCallOp`
definition:

```tablegen
let arguments = (ins
...
OptionalAttr<DictArrayAttr>:$arg_attrs,
OptionalAttr<DictArrayAttr>:$res_attrs
);


We have already provided the definition in the `extraClassDeclaration`
field of the `FuncOp` class:

```c++
Expand Down