[llvm] [AMDGPU][TTI] Add target hook for the custom instruction uniformity (PR #137639)

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 5 19:24:50 PDT 2025


ssahasra wrote:

> > The only way I see to achieve this is by passing the Uniformity of the operands to Targets and letting them define the custom rule.
> 
> Exactly, you would need some kind of target hook where the uniformity of the operands is passed in, or where the target hook can call back into UA to query the uniformity of operands.
> 
> > My concern is that it would be a bit expensive, also the decision of uniformity will be taken outside of UA.
> 
> I don't see why it would be too expensive. If it is then we should just give up on trying to implement this feature.

We believe it will be expensive because there's a virtual function call happening every time the UA (re)visits an intrinsic call. The approach we are exploring now is more static ... the target hook can return an enum encoding the "uniformity policy" of the intrinsic, which will be cached. Then the UA can interpret the policy every time it visits an intrinsic. That way, all the queries and decisions taken for uniformity stay within the UA implementation, and the virtual function is called only once when initializing the UA.

https://github.com/llvm/llvm-project/pull/137639


More information about the llvm-commits mailing list