Madhur Amilkanthwar via llvm-dev
2021-Jan-04 19:03 UTC
[llvm-dev] [Attributor] Using Attributor framework for AMDGPU backend
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. -- *Disclaimer: Views, concerns, thoughts, questions, ideas expressed in this mail are of my own and my employer has no take in it. * Thank You. Madhur D. Amilkanthwar -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210105/e1a545bf/attachment.html>
Johannes Doerfert via llvm-dev
2021-Jan-06 01:02 UTC
[llvm-dev] [Attributor] Using Attributor framework for AMDGPU backend
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] https://youtu.be/CzWkc_JcfS0 [1] https://youtu.be/HVvvCSSLiTw [2] https://reviews.llvm.org/D87978 On 1/4/21 1:03 PM, Madhur Amilkanthwar wrote:> 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. > >