[PATCH] D131959: [AMDGPU] Fix SDST operand of V_DIV_SCALE to always be VCC

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 11 23:58:55 PDT 2022


Pierre-vh added a comment.

In D131959#3781870 <https://reviews.llvm.org/D131959#3781870>, @jrbyrnes wrote:

>> Check D133593 <https://reviews.llvm.org/D133593>, it tries to address a similar problem, but with SCC.
>
> Thanks Stas -- I played with D133593 <https://reviews.llvm.org/D133593> a bit. Looks like if we extend that to support VCC, then we don't need to emit those COPYs which I think will clear things up a bit for this.

What is the status on this diff then? Do I just need to rebase on top of D133593 <https://reviews.llvm.org/D133593>, extending it with VCC support, and it'll fix the issues?

In D131959#3780692 <https://reviews.llvm.org/D131959#3780692>, @rampitec wrote:

> In D131959#3779567 <https://reviews.llvm.org/D131959#3779567>, @Pierre-vh wrote:
>
>> I got rid of the pass. I tried using a glued node
>>
>>   CurDAG->SelectNodeTo(N, Opc, CurDAG->getVTList(VT, MVT::i1, MVT::Glue), Ops);
>>   SDValue CopyFromReg = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), SL, TRI->getVCC(), MVT::i1, SDValue(N, 2));
>>   CurDAG->ReplaceAllUsesOfValueWith(SDValue(N, 1), CopyFromReg);
>>
>> and that doesn't work, it doesn't crash but it messes up scheduling tool much and we end up with things like this:
>>
>>   	v_div_scale_f32 v2, vcc, v0, v1, v0
>>   	s_mov_b64 s[0:1], vcc
>>   	v_div_scale_f32 v3, vcc, v1, v1, v0
>>   	s_mov_b64 vcc, s[0:1]
>>
>> Instead of just swapping the div_scales.
>>
>> If I fix it later in `finalizeLowering` when we change the implicit VCC to a VCC_LO, then it works fine.
>
> Did you change AMDGPUdiv_scale to produce glue? So that you have something to glue this copy to?

Isn't `CurDAG->SelectNodeTo(N, Opc, CurDAG->getVTList(VT, MVT::i1, MVT::Glue), Ops);` enough for that? Do I need to change the DAG Op definition itself?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131959



More information about the llvm-commits mailing list