This is an archive of the discontinued LLVM Phabricator instance.

[mlir][GPUToLLVM] Add support for emitting opaque pointers
ClosedPublic

Authored by zero9178 on Feb 20 2023, 11:00 PM.

Details

Summary

Part of https://discourse.llvm.org/t/rfc-switching-the-llvm-dialect-and-dialect-lowerings-to-opaque-pointers/68179

This patch adds the new pass option use-opaque-pointers to the GPU to LLVM lowerings (including ROCD and NVVM) and adapts the code to support using opaque pointers in addition to typed pointers.
The required changes mostly boil down to avoiding getElementType and specifying base types in GEP and Alloca.

In the future opaque pointers will be the only supported model, hence tests have been ported to using opaque pointers by default. Additional regression tests for typed-pointers have been added to avoid breaking existing clients.

Note: This does not yet port the GpuToVulkan passes.

Diff Detail

Event Timeline

zero9178 created this revision.Feb 20 2023, 11:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 20 2023, 11:00 PM
zero9178 requested review of this revision.Feb 20 2023, 11:00 PM
gysit accepted this revision.Feb 21 2023, 12:19 AM

Thanks, LGTM!

mlir/test/Conversion/GPUCommon/lower-memory-space-attrs-typed-pointers.mlir
16

ultra nit: missing newline.

mlir/test/Conversion/GPUToNVVM/typed-pointers.mlir
40

ultra nit: missing newline

This revision is now accepted and ready to land.Feb 21 2023, 12:19 AM
zero9178 updated this revision to Diff 499084.Feb 21 2023, 2:01 AM

Address review comments

krzysz00 accepted this revision.Feb 21 2023, 9:35 AM

AMD changes look good to me