This is an archive of the discontinued LLVM Phabricator instance.

[llvm][Uniformity] a phi with an undef argument is not always divergent
ClosedPublic

Authored by sameerds on Feb 17 2023, 3:47 AM.

Details

Summary

The uniformity analysis treated an undef argument to phi to be distinct from any
other argument, equivalent to calling PHINode::hasConstantValue() instead of
PHINode::hasConstantOrUndefValue(). Such a phi was reported as divergent. This
is different from the older divergence analysis which treats such a phi as
uniform. Fixed uniformity analysis to match the older behaviour.

Diff Detail

Event Timeline

sameerds created this revision.Feb 17 2023, 3:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2023, 3:47 AM
sameerds requested review of this revision.Feb 17 2023, 3:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2023, 3:47 AM
sameerds added a subscriber: gandhi21299.
foad added a comment.Feb 17 2023, 3:58 AM

I like this but I will leave it to the other reviewers to approve, since I know they have expressed doubts in the past.

llvm/include/llvm/ADT/GenericSSAContext.h
62 ↗(On Diff #498311)

Commit this file separately?

ruiling accepted this revision.Feb 19 2023, 10:27 PM

Although I wanted the optimization for the undef case to be bring back in a more defined way, I think it is acceptable to match with existing divergence analysis. This would help with the transition to uniform analysis, so LGTM. Please also address Jay's suggestion. Could you also add some FIXME around the code like: optimally reporting uniform with undef input should be done in more defined way. In general CFG, it might be broken?

This revision is now accepted and ready to land.Feb 19 2023, 10:27 PM
This revision was landed with ongoing or failed builds.Feb 20 2023, 12:57 AM
This revision was automatically updated to reflect the committed changes.