[llvm] [TTI] Introduce getInstructionUniformity API for flexible uniformity analysis (PR #137639)
Pankaj Dwivedi via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 20 03:05:19 PST 2025
PankajDwivedi-25 wrote:
> Unrelated to the generic uniformity analysis change, there seems to be a misunderstanding by everybody in this thread about how permlane16 works. Please read up the instruction definition, y'all! Trying to rely on the uniformity of `src1` and `src2` is confused.
>
> As for the uniformity analysis change itself, there are a number of ways this could go, but I think either way what we'd want is the ability to define more complex rules in the TTI itself, not via some ad-hoc enum. This could take the form of a callback like:
>
> ```
> virtual bool isUniform(const Instruction &I, const SmallBitVector &UniformArgs);
> ```
>
> ... where UniformArgs has a bit per instruction operand indicating whether the method may assume it to be uniform or not.
>
> Since this is an uncommon case, we may want to guard using this method by a forth InstructionUniformity enum called something like `InstructionUniformity::Complex`:
>
> ```
> // If all operands are uniform, the result values are uniform. Otherwise, the result
> // values may be divergent, and a custom check may be used to determine uniformity.
> Custom,
> ```
Thanks @nhaehnle for your feedback, I have addressed the changes. please let me know if there are other changes required.
https://github.com/llvm/llvm-project/pull/137639
More information about the llvm-commits
mailing list