This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Make instruction fusion more aggressive.
ClosedPublic

Authored by fhahn on May 16 2017, 12:51 AM.

Details

Summary

This patch makes instruction fusion more aggressive by

  • adding artificial edges between the successors of FirstSU and SecondSU, similar to BaseMemOpClusterMutation::clusterNeighboringMemOps.
  • updating PostGenericScheduler::tryCandidate to keep clusters together, similar to GenericScheduler::tryCandidate.

This change increases the number of AES instruction pairs generated on
Cortex-A57 and Cortex-A72. This doesn't change code at all in
most benchmarks or general code, but we've seen improvement on kernels
using AESE/AESMC and AESD/AESIMC.

Diff Detail

Repository
rL LLVM

Event Timeline

fhahn created this revision.May 16 2017, 12:51 AM
javed.absar added inline comments.May 16 2017, 2:02 AM
lib/CodeGen/MachineScheduler.cpp
3236 ↗(On Diff #99110)

This seems to change core PostRA-Scheduler logic and that may impact other targets. On the other hand, I see that GenericScheduler tries ClusteredNodes candidates and this was missing from here (perhaps for no good reason).

evandro added inline comments.May 16 2017, 8:35 AM
lib/Target/AArch64/AArch64MacroFusion.cpp
243 ↗(On Diff #99110)

You can write this line as:
DEBUG(dbgs() << " Copy Succ "; SI->print(dbgs(), DAG); dbgs() << '\n';);

lib/Target/AArch64/AArch64TargetMachine.cpp
283 ↗(On Diff #99110)

Sorting these methods in alphabetical order would look better.

test/CodeGen/AArch64/misched-fusion-aes.ll
1 ↗(On Diff #99110)

Is CHECKA5A72 a typo?

fhahn updated this revision to Diff 99264.May 17 2017, 2:42 AM
fhahn marked 3 inline comments as done.

Addressed feedback and rebased

fhahn added inline comments.May 17 2017, 2:45 AM
lib/CodeGen/MachineScheduler.cpp
3236 ↗(On Diff #99110)

Yes that change may impact other targets, but I think it makes sense to try keep clustered instruction together during PostRA scheduling as well, as GenericScheduler does.

evandro edited edge metadata.May 19 2017, 3:13 PM

Can you please modify misched-fusion-aes.ll with this patch?

fhahn updated this revision to Diff 99721.May 22 2017, 1:38 AM

Thanks for the feedback, I've updated with @evandro 's changes. Unfortunately I do not have access to a machine with an exynos-m1 CPU, so I can't benchmark the change on it, but it increases the number of AESE/AESMC pairs on that CPU in the test cases, so it should be positive.

evandro accepted this revision.May 22 2017, 8:58 AM

Thank you.

This revision is now accepted and ready to land.May 22 2017, 8:58 AM
fhahn closed this revision.May 23 2017, 2:33 AM
This revision was automatically updated to reflect the committed changes.