This is an archive of the discontinued LLVM Phabricator instance.

Add loop pragma for Loop Distribution
AbandonedPublic

Authored by anemet on Apr 21 2016, 10:20 PM.

Details

Summary

This is similar to other loop pragmas like 'vectorize'. Currently it
only has state values: distribute(enable) and distribute(disable). When
one of these is specified the corresponding loop metadata is generated:

!{!"llvm.loop.distribute.enable", i1 true/false}

As a result, loop distribution will be attempted on the loop even if
Loop Distribution in not enabled globally. Analogously, with 'disable'
distribution can be turned off for an individual loop even when the pass
is otherwise enabled.

There are some slight differences compared to the existing loop pragmas.

  1. There is no 'assume_safety' variant which makes its handling slightly

different from 'vectorize'/'interleave'.

  1. Unlike the existing loop pragmas, it does not have a corresponding

numeric pragma like 'vectorize' -> 'vectorize_width'. So for the
consistency checks in CheckForIncompatibleAttributes we don't need to
check it against other pragmas. We just need to check for duplicates of
the same pragma.

Diff Detail

Event Timeline

anemet updated this revision to Diff 54611.Apr 21 2016, 10:20 PM
anemet retitled this revision from to Add loop pragma for Loop Distribution.
anemet updated this object.
anemet added reviewers: aaron.ballman, rsmith.
anemet added subscribers: hfinkel, llvm-commits.
anemet abandoned this revision.Apr 21 2016, 10:22 PM

Oops, this should have gone to cfe-commits.

aaron.ballman added inline comments.Apr 28 2016, 5:54 AM
docs/LanguageExtensions.rst
2162

It would be nice to use a more compelling example than an empty for loop. Also, it would be helpful if the user understood why they wouldn't use this pragma for every loop (or why it doesn't happen by default).

aaron.ballman edited edge metadata.Apr 28 2016, 5:57 AM
aaron.ballman added a subscriber: aaron.ballman.

Ah, I didn't see this was abandoned (funny that Phab doesn't warn you
about commenting on abandoned revisions).

~Aaron