[Mlir-commits] [mlir] [mlir][gpu] Expose some utility functions from `gpu-to-binary` infra (PR #172205)

Fabian Mora llvmlistbot at llvm.org
Sun Dec 14 04:16:17 PST 2025


================
@@ -330,76 +326,79 @@ SerializeGPUModuleBase::assembleIsa(StringRef isa) {
   std::unique_ptr<llvm::MCTargetAsmParser> tap(
       target->createMCAsmParser(*sti, *parser, *mcii, mcOptions));
 
-  if (!tap) {
-    emitError(loc, "assembler initialization error");
-    return std::nullopt;
-  }
+  if (!tap)
+    return emitError() << "assembler initialization error";
 
   parser->setTargetParser(*tap);
   parser->Run(false);
   return std::move(result);
 }
 
-std::optional<SmallVector<char, 0>>
-SerializeGPUModuleBase::compileToBinary(const std::string &serializedISA) {
-  // Assemble the ISA.
-  std::optional<SmallVector<char, 0>> isaBinary = assembleIsa(serializedISA);
-
-  if (!isaBinary) {
-    getOperation().emitError() << "failed during ISA assembling";
-    return std::nullopt;
-  }
-
+FailureOr<SmallVector<char, 0>>
+mlir::ROCDL::linkObjectCode(ArrayRef<char> objectCode, StringRef toolkitPath,
+                            function_ref<InFlightDiagnostic()> emitError) {
----------------
fabianmcg wrote:

Not blocking here as well, but if you have time. Could you consider adding LLD support guarded by IFDEF and cmake flags?

That allows avoiding looking up the tools in ROCm.

See https://github.com/iree-org/aster/blob/main/lib/Target/Binary/CompileAsm.cpp#L154 for reference.

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


More information about the Mlir-commits mailing list