This is an archive of the discontinued LLVM Phabricator instance.

[mlir][GPU] Allow specifying alignment of memory attributions

Authored by krzysz00 on Apr 21 2023, 2:48 PM.



Add support for argument attributes on workgroup and private
attributions for GPU functions. These arguments are outside the range
of getNumArguments() and get printed separately, so the default
mechanism for function argument attributes can't be used on them.

Having done this, check for the llvm.align attribute on workgroup or
private attributions in a gpu.func and pass it through to the
relevant allocation op (creating a global or alloca). This allows
people creating kernels that use multiple workgroup buffers to set an

(This could, in the future, be a GPU dialect alignment attribute,
but I've taken the simpler route of using the LLVM version instead for
simplicity and because I don't know how this might impact backends
like Vulkan)

Diff Detail

Event Timeline

krzysz00 created this revision.Apr 21 2023, 2:48 PM
krzysz00 requested review of this revision.Apr 21 2023, 2:48 PM
nirvedhmeshram accepted this revision.May 3 2023, 10:44 AM
This revision is now accepted and ready to land.May 3 2023, 10:44 AM
This revision was landed with ongoing or failed builds.May 3 2023, 2:51 PM
This revision was automatically updated to reflect the committed changes.