Memref to bare pointer conversion when lowering to GPU code

Hello all,

Is there a way to convert memrefs to bare pointers when generating GPU code?

I am using this pipeline, but it lowers memrefs into the base pointers and auxiliary data.


For CPU, I wrote a custom pass that calls populate* functions with LowerToLLVMOptions.useBarePtrCallConv set to true.
I wonder whether this approach would work for GPU as well.

Thanks in advance,

To elaborate a bit, the MLIR function whose parallel loop is to be outlined takes memref as arguments:

func @f(%arg0: memref<1024xi64>) {
    scf.parallel .. { // goal: outline this as a GPU kernel
      // iterates over %arg0
    } {mapping = [{bound = #map, map = #map, processor = 0 : i64}]}

@f is exposed to the outer world and its signature must be the one with memrefs lowered to bare pointers.

A custom pass should with appropriate patterns should work.