How to use GPU functions?

In the file memref.cpp, I used the function ‘_mlir_ciface_main_graph’ which was defined in When I complied with the instruction"g++ --std=c++11 -O3 memref.cpp ./ -o lenet-2.noentry -I $ONNX_MLIR_INCLUDE", the following errors occured :
“./ undefined reference to mgpuModuleLoad' ./ undefined reference to mgpuStreamSynchronize’
./ undefined reference to mgpuLaunchKernel' ./ undefined reference to mgpuStreamCreate’
./ undefined reference to mgpuModuleUnload' ./ undefined reference to mgpuStreamDestroy’
./ undefined reference to mgpuMemAlloc' ./ undefined reference to mgpuModuleGetFunction’
collect2: error: ld returned 1 exit status”
I checked the file lenet-2.llvmnoentry.mlir, which generated, and found several GPU functions (like llvm.func @mgpuStreamCreate() → !llvm.ptr) in it. They were not defined in lenet-2.llvmnoentry.mlir, so how can I use them?

We don’t know what memref.cpp or contain, so it is hard to tell. The missing functions are provided by MLIR’s platform-agnostic GPU runtime, implemented by mlir/lib/ExecutionEngine/[Cuda,Rocm]RuntimeWrappers.cpp that are typically built as or, respectively, when the corresponding backend is enabled. If you don’t already link those into some library and don’t provide your own implementation, I suppose you can link the libraries built by MLIR.

Thank you for your help!