This is an archive of the discontinued LLVM Phabricator instance.

Add support for bare pointer calling convention in gpu-to-llvm
ClosedPublic

Authored by bondhugula on Jun 8 2023, 3:35 PM.

Details

Summary

Add support for the bare pointer calling convention in the gpu-to-llvm
pass. This wasn't being exposed and is needed when GPU-compiled MLIR is
to be called with this convention.

Diff Detail

Event Timeline

bondhugula created this revision.Jun 8 2023, 3:35 PM
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
bondhugula requested review of this revision.Jun 8 2023, 3:35 PM

Can you add a test for this?

mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
720

options.useBarePtrCallConv = hostBarePtrCallConv; ?

bondhugula updated this revision to Diff 530136.Jun 9 2023, 8:14 PM
bondhugula marked an inline comment as done.

Address review comment.

Can you add a test for this?

Do we really need a test for this? bare pointer lowering for memrefs has its own tests. This pass is just a user, just like gpu-to-nvvm and gpu-to-rocdl, and it's expected to work. I can add a test though if something new is exercised or we want to anyway to test to ensure the functionality is there.

mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
720

Thanks, done.

I wasn’t sure if the lowering is expected to after the signature of a gpu.func for example?

krzysz00 accepted this revision.Jun 12 2023, 9:35 AM

Seems reasonable to me, surprised that this didn't break before (did something break?), approved.

This revision is now accepted and ready to land.Jun 12 2023, 9:35 AM

I wasn’t sure if the lowering is expected to after the signature of a gpu.func for example?

The gpu-to-llvm pass is applied to lower host-side IR: typically, builtin.module(gpu-to-llvm). gpu.func aren't even processed by it. The other revision I have is the one that adds that option for gpu-to-nvvm which is the one that lowers the signature for gpu.func. We need both of these changes.
https://reviews.llvm.org/D152480

bondhugula added a comment.EditedJun 17 2023, 10:09 AM

Seems reasonable to me, surprised that this didn't break before (did something break?), approved.

gpu-to-nvvm never provided that option - the other revision I have adds it to gpu-to-nvvm (https://reviews.llvm.org/D152480). If we used the bare ptr lowering here and not in gpu-to-nvvm or vice versa, things would break. That said, I can update an integration test case there to use the bare ptr lowering that will exercise both of these changes.