[Mlir-commits] [mlir] [MLIR][NVVM] Add binaryCallback (PR #170853)

Mehdi Amini llvmlistbot at llvm.org
Wed Dec 10 03:27:24 PST 2025


================
@@ -521,6 +524,15 @@ NVPTXSerializer::compileToBinary(const std::string &ptxCode) {
                                                 /*ErrMsg=*/&message))
     return emitLogError("`fatbinary`");
 
+  if (binaryCallback) {
+    llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> logBuffer =
+        llvm::MemoryBuffer::getFile(logFile->first);
+    if (logBuffer && !(*logBuffer)->getBuffer().empty()) {
+      StringRef logRef = (*logBuffer)->getBuffer();
+      binaryCallback(logRef);
----------------
joker-eph wrote:

> I’m not entirely sure that’s feasible, since MLIR doesn’t control ptxas diagnostics. ptxas emits warnings, errors, and informational messages, which we need to parse meaningfully and then map to the appropriate MLIR diagnostics (e.g., emitError, emitWarning, emitRemark, etc.).

We don't need to parse it, it can just be a remark out-of-band.

If there is an error, then MLIR should already emit an error, and conveying this diagnostic shouldn't happen through a callback like this anyway.


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


More information about the Mlir-commits mailing list