Where is printMemref defined?

I would like to know where printMemref is defined.Then recompile the printMemref function under the risc-v architecture.Because I need to execute on spike.If anyone can help me, I would be grateful.

func.func private @printMemrefI8(memref<*xi8>)

git grep is a convenient tool to figure out this kind of things:

 % git grep printMemrefI8 mlir
mlir/include/mlir/ExecutionEngine/RunnerUtils.h:_mlir_ciface_printMemrefI8(UnrankedMemRefType<int8_t> *m);
mlir/lib/ExecutionEngine/RunnerUtils.cpp:extern "C" void _mlir_ciface_printMemrefI8(UnrankedMemRefType<int8_t> *M) {
mlir/test/mlir-cpu-runner/unranked-memref.mlir:    call @printMemrefI8(%U4) : (memref<*xi8>) -> ()
mlir/test/mlir-cpu-runner/unranked-memref.mlir:func.func private @printMemrefI8(memref<*xi8>) attributes { llvm.emit_c_interface }

You may note that the runtime defines a “_mlir_ciface_printMemrefI8” symbol, this is all explained here: LLVM IR Target - MLIR

(Note in the test above the attributes { llvm.emit_c_interface } that goes with this)


Is there any other way to print memref?I want to see if the instructions I added are executed correctly.I found that riscv64-unknown-linux-gnu-gcc linking libmlir_runner_utils.a will report an error, but dynamic linking, spike is not supported.

Sorry.I may have figured out what’s wrong.