[Mlir-commits] [mlir] [mlir][gpu] Extend `mgpumoduleLoadJIT` API to add assemblySize parameter (PR #189429)

Fabian Mora llvmlistbot at llvm.org
Fri Apr 3 09:47:27 PDT 2026


================
@@ -520,10 +520,21 @@ extern "C" ze_module_handle_t mgpuModuleLoad(const void *data,
   return catchAll([&]() { return loadModule(data, gpuBlobSize); });
 }
 
-extern "C" ze_module_handle_t mgpuModuleLoadJIT(void *data, int optLevel) {
+extern "C" ze_module_handle_t mgpuModuleLoadJIT(void *data, int optLevel,
+                                                size_t assemblySize) {
+  // Account for extra null terminator added in embedBinaryImpl.
+  // A null terminator is added during embedding binary for assembly format to
+  // support JIT paths that expect null-terminated strings. However, for SPIR-V
+  // binary format, the null terminator is not expected. So we need to subtract
+  // the null terminator when loading SPIR-V binary.
+  assert((assemblySize == 0 ||
+          reinterpret_cast<char *>(data)[assemblySize - 1] == 0) &&
+         "Expected null terminator at the end of the assembly string.");
+  auto actualAssemblySize = assemblySize - 1;
----------------
fabianmcg wrote:

NIT, don't use auto

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


More information about the Mlir-commits mailing list