Page MenuHomePhabricator

[MachineVerifier] Doing ::calcRegsPassed in RPO: ~35% faster MV
ClosedPublic

Authored by rtereshin on Feb 24 2020, 12:40 AM.

Details

Summary

Depending on the target, test suite, pipeline config and perhaps other
factors machine verifier when forced on with -verify-machineinstrs can
increase compile time 2-2.5 times over (Release, Asserts On), taking up
~60% of the time. An invaluable tool, it significantly slows down
machine verifier-enabled testing.

Nearly 75% of its time MachineVerifier spends in the calcRegsPassed
method. It's a classic forward dataflow analysis executed over sets, but
visiting MBBs in arbitrary order. We switch that to RPO here.

This speeds up MachineVerifier by about 35%, decreasing the overall
compile time with -verify-machineinstrs by 20-25% or so.

calcRegsPassed itself gets 2x faster here.

All measured on a large suite of shaders targeting a number of GPUs.

Diff Detail

Event Timeline

rtereshin created this revision.Feb 24 2020, 12:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2020, 12:40 AM
bogner accepted this revision.Feb 24 2020, 2:13 AM
bogner added inline comments.
llvm/lib/CodeGen/MachineVerifier.cpp
2133–2134

Not sure it's worth explaining this tradeoff in a comment - the explanation above is good for what we're doing here and the commit message is pretty clear on why. Feel free to leave as is if you think it's valuable though.

This revision is now accepted and ready to land.Feb 24 2020, 2:13 AM
rtereshin marked 2 inline comments as done.Feb 24 2020, 1:06 PM
rtereshin added inline comments.
llvm/lib/CodeGen/MachineVerifier.cpp
2133–2134

Nah, I agree, trimming the comment (as further briefly discussed offline).

Thanks!

rtereshin updated this revision to Diff 246288.Feb 24 2020, 1:08 PM
rtereshin marked an inline comment as done.

Trimming down the comments a little bit as requested.

This revision was automatically updated to reflect the committed changes.