This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Use verify<domtree> instead of intra-pass asserts.
ClosedPublic

Authored by pravinjagtap on Jun 19 2023, 4:02 AM.

Details

Summary

Verifying dominator tree is expensive using intra-pass
asserts. Asserts added during D147408 are
increasing the build time of libc significantly. This change
does the verification after the atomic optimizer pass
and should fix the regression reported in D153232.

Diff Detail

Event Timeline

pravinjagtap created this revision.Jun 19 2023, 4:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 19 2023, 4:02 AM
pravinjagtap requested review of this revision.Jun 19 2023, 4:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 19 2023, 4:02 AM

Do we really need this intra-pass verification? With -verify-dom-info the DominatorTree verification should fail after the pass like normal

llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp
799

assert(!VerifyDomInfo || ....

pravinjagtap retitled this revision from [AMDGPU] Assert only when -verify-dom-info is invoked. to [AMDGPU] Verify dom tree only when -verify-dom-info is passed..Jun 19 2023, 4:07 AM
pravinjagtap edited the summary of this revision. (Show Details)
pravinjagtap added reviewers: foad, ruiling, arsenm, b-sumner, jhuber6, Restricted Project, yassingh.
foad added a comment.Jun 19 2023, 4:08 AM

If -verify-dom-info is used then the normal analysis verification should catch this after this pass has run, as mentioned here: https://reviews.llvm.org/D147408#inline-1471284

So I do not think you need any explicit calls to DominatorTree::verify

If -verify-dom-info is used then the normal analysis verification should catch this after this pass has run, as mentioned here: https://reviews.llvm.org/D147408#inline-1471284

So I do not think you need any explicit calls to DominatorTree::verify

Unfortunately No. The -verify-dom-info is not catching the un-updated dom tree.

If -verify-dom-info is used then the normal analysis verification should catch this after this pass has run, as mentioned here: https://reviews.llvm.org/D147408#inline-1471284

So I do not think you need any explicit calls to DominatorTree::verify

Unfortunately No. The -verify-dom-info is not catching the un-updated dom tree.

Is this just the analysis was dropped because nothing after it was using it problem? If you run the pass twice with -passes do you see the error?

If -verify-dom-info is used then the normal analysis verification should catch this after this pass has run, as mentioned here: https://reviews.llvm.org/D147408#inline-1471284

So I do not think you need any explicit calls to DominatorTree::verify

Unfortunately No. The -verify-dom-info is not catching the un-updated dom tree.

Is this just the analysis was dropped because nothing after it was using it problem? If you run the pass twice with -passes do you see the error?

Understood why dom-tree verifier was not catching the un-updated DT. After IR transformations in AtomicOptimizer Analyses results are invalidated (when IR is transformed) and verifier re-computes the dom-tree freshly.

Removed the asserts and added dom-tree verification test

Why aren't we preserving dom-tree if were are updating it?

Why aren't we preserving dom-tree if were are updating it?

It looks like it is reported as preserved in the old PM, but not the new

llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp
150

This should be fixed to report the dominator tree is updated

arsenm accepted this revision.Jun 20 2023, 6:06 AM

LGTM. Please fix the missing new PM preserves dominator tree separately

This revision is now accepted and ready to land.Jun 20 2023, 6:06 AM
pravinjagtap retitled this revision from [AMDGPU] Verify dom tree only when -verify-dom-info is passed. to [AMDGPU] Use verify<domtree> instead of intra-pass asserts..Jun 20 2023, 6:41 AM
pravinjagtap edited the summary of this revision. (Show Details)
This revision was landed with ongoing or failed builds.Jun 20 2023, 6:53 AM
This revision was automatically updated to reflect the committed changes.