Learning attributor framework

HI @jdoerfert
I am learning attributor framework. For a given instruction, how can I get all attributes attached to it and its dependent attributes on it? I couldn’t find any obvious API for this.

You want all the AA’s “attached” to an instruction (thus, IRPosition::inst/value(I)), is that right?
There is no API for that, though, the Attributor has a map that contains the information.
You could add an API to expose it, effectively walking the map and checking if the IRPosition is what you are looking for.
Once you have an AA, you can get the dependent ones, see the code that dumps the dependence graph as a .dot file for example code.

~ Johannes

Thanks. Got it.
BTW, I think you should write a good documentation for this somewhere under llvm/docs. Reading code comments is useful but a “user manual” or “programmer’s manual” would be really great and it would ease learning curve.

I’ll put it on my TODO list :slight_smile:

Are there plans for an MLIR attributer with shared fixed point iteration and different e.g. IRPositions?

There has been a partial port of the Attributor to MLIR, IIRC. I am not aware what the status is.

It is in IREE: