Skip to content

Commit bd3af9a

Browse files
etiottoCopilot
andauthored
When module doesn't contain any kernels, emit additional diagnostic. (#5180)
This PR adds diagnostic information when a module doesn't contain any kernels during function creation. The change helps developers identify compilation issues by providing a specific error message suggesting to tune the 'num_warps' parameter when no kernels are found in the module --------- Signed-off-by: Ettore Tiotto <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 9d21bf9 commit bd3af9a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

third_party/intel/backend/include/sycl_functions.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ create_function(ze_module_handle_t module, ze_kernel_flags_t flag,
193193
if (getBoolEnv("MLIR_ENABLE_DUMP")) {
194194
std::cout << "create kernel:" << func_name << std::endl;
195195
}
196+
197+
uint32_t count = 0;
198+
[[maybe_unused]] auto ret = zeModuleGetKernelNames(module, &count, nullptr);
199+
assert(ret == ZE_RESULT_SUCCESS);
200+
if (count == 0) {
201+
std::cerr
202+
<< "Module doesn't contain any kernels. Please attempt to tune the "
203+
"'num_warps' parameter."
204+
<< std::endl;
205+
return std::make_tuple(nullptr, ZE_RESULT_ERROR_INVALID_KERNEL_NAME);
206+
}
207+
196208
ZE_CHECK(zeKernelCreate(module, &kernel_description, &kernel));
197209
return std::make_tuple(kernel, ZE_RESULT_SUCCESS);
198210
}

0 commit comments

Comments
 (0)