[Mlir-commits] [mlir] [mlir][VectorOps] Support string literals in `vector.print` (PR #68695)

Benjamin Maxwell llvmlistbot at llvm.org
Thu Oct 19 10:45:16 PDT 2023


MacDue wrote:

> Apologies for nitpicking... but, printCString belongs to the group of memref prints, defined in RunnerUtils.h. The group of methods that constitute the "small set of primitives" that are easy to port to other platforms live in CRunnerUtils.h, and are grouped together here:
> 
> //===----------------------------------------------------------------------===// // Small runtime support library for vector.print lowering during codegen. //===----------------------------------------------------------------------===// extern "C" MLIR_CRUNNERUTILS_EXPORT void printI64(int64_t i); extern "C" MLIR_CRUNNERUTILS_EXPORT void printU64(uint64_t u); extern "C" MLIR_CRUNNERUTILS_EXPORT void printF32(float f); extern "C" MLIR_CRUNNERUTILS_EXPORT void printF64(double d); extern "C" MLIR_CRUNNERUTILS_EXPORT void printOpen(); extern "C" MLIR_CRUNNERUTILS_EXPORT void printClose(); extern "C" MLIR_CRUNNERUTILS_EXPORT void printComma(); extern "C" MLIR_CRUNNERUTILS_EXPORT void printNewline();
> 
> It feels like we need to add a printString(char*s) to this set (and then also the implementation at the top of CRunnerUtils.cpp).
> 
> In the big picture, I realize this may seem like too much nitpicking, but it it is much closer to the design philosophy of the vector.print support when I first added it (enabling the first actual running end-to-end MLIR tests ;-)

No worries! I've added printString to CRunnerUtils and switched to that. I've also weakly defined in implementation in RunnerUtils since this is shared with cf.assert and several tests there link RunnerUtils, but not CRunnerUtils, so it's easier if linking either gives you printString().

https://github.com/llvm/llvm-project/pull/68695


More information about the Mlir-commits mailing list