[llvm] [NVPTX] Teach NVPTX about predicates (PR #67468)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 12:42:24 PDT 2023


https://github.com/Artem-B commented:

MI part of NVPTX back-end is largely unfamiliar territory for me, so we'll need someone who  has better familiarity with MI than myself.

Meanwhile, I have a few general questions.

> Maxwell through Ampere take predicate registers at the ISA level[2]

That document does mention that the GPUs do have predicate registers. It does not necessarily imply that using them to predicate individual instructions is free. Perhaps I'm missing something. Can you elaborate on why you think wider use of predicates will likely be beneficial? 

I can see how it may help getting rid of tons of small jumps LLVM tends to generate now and then, but I'm somewhat skeptical that it will have much of a practical impact as most of those cases can be easily optimized into predicated execution by ptxas, if it deems it beneficial.

It would help if you could demonstrate on a bit of PTX how using predicates instead of branches generates better SASS for GPU X. Bonus points for examining SASS for a range of GPUs, so we may have a better idea whether predication should be applied across the board, or only on particular GPU variants.

If wider use of predication gives us no measurable improvements in generated SASS, there's probably no point complicating things.


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


More information about the llvm-commits mailing list