Hi Johannes,
I am trying to use the Attributor framework for AMD GPU backend. We have an attributor called amdgpu-flat-work-group-size which basically specifies the min and max work group configuration for the kernel. Typically, this attribute is given on kernels but it can also be present on device functions. It needs to be propagated across the call graph with a merge function which does “max” of the all incoming attributes of type amdgpu-flat-work-group-size.
How do I write an Attributor pass for this?
I do understand that I need to model the attribute as a class (like AANoUnwind) but I am not sure if I totally understand the significance of pessimistic/optimistic fixpoint for this attribute.
Hi Madhur,
did you watch the introduction [0] and attributor tutorial [1]?
There the fixpoint stuff is explained.
If you have a single number per function and want to do "max" propagation,
you should take a look at AANoUnwind (or AAWillReturn) for the function
deduction part and AAAlign for the use of an integer state that is decreasing.
Since you want the opposite, an integer state that is increasing as it progresses,
you need to use a `DecIntegerState` where AAAlign is using an
`IncIntegerState`. Also, consider [2] which adds some helpers to the state
you want to use and also uses it for a "max" join operation.
I hope this helps to get you started, feel free to reply if you get stuck.
~ Johannes
[0] 2019 LLVM Developers’ Meeting: J. Doerfert “The Attributor: A Versatile Inter-procedural Fixpoint..” - YouTube
[1] 2019 LLVM Developers’ Meeting: J. Doerfert “The Attributor: A Versatile Inter-procedural Fixpoint.." - YouTube
[2] https://reviews.llvm.org/D87978