[PATCH] D110950: [AMDGPU] Enable divergence-driven BFE selection

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 2 14:37:24 PDT 2021


rampitec added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp:1953
+                                     uint32_t Offset, uint32_t Width) {
+  if (IsDivergent) {
+    unsigned Opcode = IsSigned ? AMDGPU::V_BFE_I32_e64 : AMDGPU::V_BFE_U32_e64;
----------------
alex-t wrote:
> rampitec wrote:
> > Cannot IsDivergent be derived from the Val itself? Like `SDNode(Val, 0)->isDivergent()`?
> I am not sure if this is the right way. The "Val" is N->getOperand(0) here. Formally we should consider the N divergence. On the other hand, operand 0 is the only variable operand in BFE SDNode. Two others (offset and width) are always ConstantSDNode.
> Thus, in fact, the divergence property of N is always equal to the divergence of its variable source. From this point of view, we can evolve the N divergence from            
> N->getOperand(0) divergence. I could save one formal argument, but this would make the code non-obvious and would require some comments to explain.
Yes, that's what mean, the rest of arguments are constants, so we can save the argument.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110950/new/

https://reviews.llvm.org/D110950



More information about the llvm-commits mailing list