[PBQP] setEdgeCosts() (was PBQP bugfix)

Jonas Paulsson jonas.paulsson at ericsson.com
Fri Feb 6 03:21:58 PST 2015

Hi Lang,

The patch seems good to me on my target as well, thank you.

However, the bug#3 I wrote about earlier is now still merely hidden. The problem is that setEdgeCosts() temporarily disconnects two nodes, moves them to ConservativelyAllocatableNodes because their DeniedOpts have now been decreased by one, and then reconnects them. DeniedOpts gets increased again during reconnection, and the isConservativelyAllocatable() test would then fail, but the nodes have already been moved.

I resend the test case again along with reverts of patches that hide the bug (for the test case).

To investigate:

Revert the two patches that hide the bug (see below), or just apply the attached patches that do the same thing. (To see that there is an error, also apply the patch with an assert that no nodes in coservatively allocatables gets the spill option).

Then run llc with the attached test case:

llc pbqp_reduced.ll -mtriple=aarch64-none-linux-gnu -mcpu=cortex-a57 -mattr=+neon -optimize-regalloc -regalloc=pbqp

(The assertion triggers, because Node 2 was in conservatively allocatables and yet spilled.)

The error is made *during applyR2() of node 18*.

Debug dumps (patch for debug dumps not provided, sent earlier):

handleDisconnectEdge(9, 2) : DeniedOpts 10 -> 9
NId 9(%vreg15, GPR64common)  moved to conservatively-allocatables.
handleDisconnectEdge(2, 9) : DeniedOpts 10 -> 9
NId 2(%vreg4, GPR64common)  moved to conservatively-allocatables.

Popped NId 2(%vreg4, GPR64common) , all edge costs added:
2.002748e+01 inf inf inf inf inf inf inf inf inf inf ** selection: 0



commit 4a44259e80c04c340349ed8f32bcbc8ffdb89b52
Author: Jonas Paulsson <jonas.paulsson at ericsson.com>
Date:   Fri Feb 6 10:34:35 2015 +0100

    Revert "[PBQP Regalloc] Pre-spill vregs that have no legal physregs."

    This reverts commit d54450ef63998effdb19476c4e4c6c3f0a8c5f50.

commit 9ada754d86920eba6cbda342e643e235788d139b
Author: Jonas Paulsson <jonas.paulsson at ericsson.com>
Date:   Fri Feb 6 10:30:38 2015 +0100

    Revert "[PBQP] Fix transposed worst row/column check in handleAdd/RemoveNode in the PBQP"

    This reverts commit 4bde7909b4eb2aba2cd62b79d8cca98d9af6692e.

commit 45b838cc499a6af384c43fbc2d8c83c17b48f25e
Author: Jonas Paulsson <jonas.paulsson at ericsson.com>
Date:   Wed Jan 28 08:30:35 2015 +0100

    Assert in PBQP that a node that selects '0' (spilled) was not pushed on node
    stack as conservatively allocatable.

Test case: pbqp_reduced.ll

From: Lang Hames [mailto:lhames at gmail.com]
Sent: den 3 februari 2015 07:19
To: Jonas Paulsson; Arnaud A. de Grandmaison
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: PBQP bugfix

Hi Jonas,

Apologies for the delay - I've committed my fix for this in r227942.

I haven't had a chance to try it out on your ARM test case yet, but hope to soon. Please let me know if it doesn't fix the problem for your out-of-tree target.


On Fri, Jan 30, 2015 at 11:10 AM, Lang Hames <lhames at gmail.com<mailto:lhames at gmail.com>> wrote:
Hi Jonas,

Thanks very much for tracking this down!

I think the best approach to fixing this is to have the PBQP register allocator recognize these nodes early and never represent them in the graph. Any matrix that has only one column must be connected to a node that has only one solution, and this should be allocated up-front to simplify the solver's job.

I'll have a fix for this later today.


On Thu, Jan 29, 2015 at 9:25 AM, Jonas Paulsson <jonas.paulsson at ericsson.com<mailto:jonas.paulsson at ericsson.com>> wrote:

This is a bugfix for the PBQP register allocator. The case for a one-column matrix must be handled in the MatrixMetadata constructor.

See commit message for further explanation,

Jonas Paulsson

llvm-commits mailing list
llvm-commits at cs.uiuc.edu<mailto:llvm-commits at cs.uiuc.edu>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150206/cb6507e1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Assert-in-PBQP-that-a-node-that-selects-0-spilled-wa.patch
Type: application/octet-stream
Size: 2796 bytes
Desc: 0001-Assert-in-PBQP-that-a-node-that-selects-0-spilled-wa.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150206/cb6507e1/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Revert-PBQP-Fix-transposed-worst-row-column-check-in.patch
Type: application/octet-stream
Size: 1452 bytes
Desc: 0002-Revert-PBQP-Fix-transposed-worst-row-column-check-in.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150206/cb6507e1/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Revert-PBQP-Regalloc-Pre-spill-vregs-that-have-no-le.patch
Type: application/octet-stream
Size: 6324 bytes
Desc: 0003-Revert-PBQP-Regalloc-Pre-spill-vregs-that-have-no-le.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150206/cb6507e1/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pbqp_reduced.ll
Type: application/octet-stream
Size: 3152 bytes
Desc: pbqp_reduced.ll
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150206/cb6507e1/attachment-0003.obj>

More information about the llvm-commits mailing list