This is an archive of the discontinued LLVM Phabricator instance.

[DFAPacketizer] Track resources for packetized instructions
ClosedPublic

Authored by jmolloy on Aug 29 2019, 3:46 AM.

Details

Summary

This patch allows the DFAPacketizer to be queried after a packet is formed to work out which
resources were allocated to the packetized instructions.

This is particularly important for targets that do their own bundle packing - it's not
sufficient to know simply that instructions can share a packet; which slots are used is
also required for encoding.

This extends the emitter to emit a side-table containing resource usage diffs for each
state transition. The packetizer maintains a set of all possible resource states in its
current state. After packetization is complete, all remaining resource states are
possible packetization strategies.

The sidetable is only ~500K for Hexagon, but the extra tracking is disabled by default
(most uses of the packetizer like MachinePipeliner don't care and don't need the extra
maintained state).

Diff Detail

Event Timeline

jmolloy created this revision.Aug 29 2019, 3:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 29 2019, 3:46 AM

Your summary says that the extended tracking is disable by default on hexagon. Which extra tracking is that? I don't see any part disabled for Hexagon?

lib/CodeGen/DFAPacketizer.cpp
269 ↗(On Diff #217824)

This would assert if tracking is off. Is this done on purpose?

jmolloy marked an inline comment as done.Sep 5 2019, 2:32 AM

Hi Thomas,

Thanks for the review!
You're right, we do actually use this in Hexagon (we dump the output so it can be read by FileCheck). Perhaps we should only do this #ifndef NDEBUG.

James

lib/CodeGen/DFAPacketizer.cpp
269 ↗(On Diff #217824)

Yes, so that we can FileCheck this output and verify the tracking is working. VLIWPacketizer sets tracking on always in the constructor, above.

ThomasRaoux accepted this revision.Sep 5 2019, 9:38 AM
This revision is now accepted and ready to land.Sep 5 2019, 9:38 AM
This revision was automatically updated to reflect the committed changes.
RKSimon added a subscriber: RKSimon.Sep 9 2019, 3:53 AM

@jmolloy This is causing "compiler is out of heap space" errors on my VS2017 and VS2019 all targets builds:

e:\llvm\ninja17\lib\target\hexagon\hexagongendfapacketizer.inc(4892) : fatal error C1002: compiler is out of heap space in pass 2

@jmolloy This is causing "compiler is out of heap space" errors on my VS2017 and VS2019 all targets builds:

e:\llvm\ninja17\lib\target\hexagon\hexagongendfapacketizer.inc(4892) : fatal error C1002: compiler is out of heap space in pass 2

I'm sorry but I had to revert this at rL371393, I didn't get very far in triaging what is the causing the issue but if you have a candidate patch I'm happy to test it.