[llvm-dev] [Attributor] Using Attributor framework for AMDGPU backend

Johannes Doerfert via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 5 17:02:41 PST 2021


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.
>
>


More information about the llvm-dev mailing list