This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] In libomptarget, assume alignment at powers of two
ClosedPublic

Authored by jdenny on Apr 28 2023, 3:18 PM.

Details

Summary

This patch fixes a bug introduced by D142586, which landed as
434992c96ed1. The fix was to only look for alignments that are powers
of 2. See the new test case for details.

Diff Detail

Event Timeline

jdenny created this revision.Apr 28 2023, 3:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2023, 3:18 PM
jdenny requested review of this revision.Apr 28 2023, 3:18 PM
jdoerfert accepted this revision.May 1 2023, 1:31 PM

Add this to the commit message as it is the important part:
The fix was to only look for alignments that are powers of 2.

LGTM

This revision is now accepted and ready to land.May 1 2023, 1:31 PM
jhuber6 added inline comments.May 1 2023, 1:32 PM
openmp/libomptarget/src/omptarget.cpp
112

Shouldn't this just be looking for the first non zero bit? Like __builtin_ffsl or similar?

jdenny updated this revision to Diff 518586.May 1 2023, 3:50 PM
jdenny edited the summary of this revision. (Show Details)

Address reviewer comments:

  • Extend commit log.
  • Use __builtin_ffsl.
jdenny marked an inline comment as done.May 1 2023, 3:52 PM
jdenny added inline comments.
openmp/libomptarget/src/omptarget.cpp
112

That does seem like it would be more efficient. I've not used it before, but it behaves in my CI. Does the new code look reasonable to you?

jdenny marked an inline comment as done.May 1 2023, 3:53 PM
jhuber6 accepted this revision.May 1 2023, 3:59 PM

LG since you confirmed it works, thanks for the patch.

This revision was automatically updated to reflect the committed changes.
jdenny added a comment.May 2 2023, 6:48 AM

Thanks for the reviews.