This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][AMDGPU] Add 'uniform-work-group' attribute to OpenMP kernels
ClosedPublic

Authored by jhuber6 on Oct 6 2022, 9:21 AM.

Details

Summary

The cl-uniform-work-group attribute asserts that the global work-size
be a multiple of the work-group specified work group size. This should
allow optimizations. It is already present by default in the AMD
compiler and for HIP kernels so it should be safe to allow this for
OpenMP kernels by default.

Diff Detail

Event Timeline

jhuber6 created this revision.Oct 6 2022, 9:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 6 2022, 9:21 AM
jhuber6 requested review of this revision.Oct 6 2022, 9:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 6 2022, 9:21 AM
arsenm added inline comments.Oct 6 2022, 9:24 AM
clang/lib/CodeGen/TargetInfo.cpp
9424–9432

Can we move this whole thing out of amdgpu code and into language code?

jhuber6 added inline comments.Oct 6 2022, 9:29 AM
clang/lib/CodeGen/TargetInfo.cpp
9424–9432

Do you mean moving this into each language's respective code generation / sema? This seemed like the most straightforward place to put it as it's where we attach other target specific attributes.

arsenm added inline comments.Oct 6 2022, 9:30 AM
clang/lib/CodeGen/TargetInfo.cpp
9424–9432

But it's not actually a target specific attribute, it's a language property

jhuber6 added inline comments.Oct 6 2022, 9:35 AM
clang/lib/CodeGen/TargetInfo.cpp
9424–9432

Sure, I just figured this was the easier option since it already existed here for HIP. Which file do you suggest this go in? Should we just do this specifically in HIP / OpenMP codegen?

arsenm added inline comments.Oct 6 2022, 10:34 AM
clang/lib/CodeGen/TargetInfo.cpp
9424–9432

Putting it here is a fine first step, it's just always bothered me that it's here. I don't know clang enough to know where it belongs. OpenCL defined this in the first place and changed the default behavior in CL2.0

jdoerfert accepted this revision.Oct 6 2022, 2:18 PM

LG, add a TODO to move the code.

This revision is now accepted and ready to land.Oct 6 2022, 2:18 PM