Error : custom op is unknown

I defined a dialect along with it’s operation and added this dialect to the list of registered dialects in mlir-opt. When I run mlir-opt --show-dialects it shows name of my dialect among other registered dialects. But when I run mlir-opt on .mlir file written in my custom dialect, I get the following error:

error: custom op 'mytoy.constant' is unknown

Here ‘mytoy’ is the namespace of my dialect and ‘constant’ is the mnemonic of the operation.
Kindly help. :face_with_head_bandage:
Thanks

There isn’t enough information provided to make even a guess at what goes wrong. We need a way to reproduce the error.

Either:

  • the dialect does not register the operation (in its “initialize” method
  • the operation does not define a custom assembly format