sycl: report zero devices instead of aborting when the host has none (llama/27291)
Prevents crash when not even performing SYCL compute, for instance when trying to run `llama-quantize`.
This commit is contained in:
parent
8442c74f56
commit
689ad69f03
|
|
@ -109,7 +109,14 @@ int g_ggml_sycl_enable_host_pinned_mem = 1;
|
|||
static ggml_sycl_device_info ggml_sycl_init() {
|
||||
ggml_sycl_device_info info = {};
|
||||
|
||||
info.device_count = dpct::dev_mgr::instance().device_count();
|
||||
// Do not hard crash when there exists no SYCL devices.
|
||||
// We want to allow the user to use non-SYCL tools when SYCL is compiled (such as llama-quantize)
|
||||
try {
|
||||
info.device_count = dpct::dev_mgr::instance().device_count();
|
||||
} catch (sycl::exception const &exc) {
|
||||
GGML_LOG_INFO("%s: no SYCL device available: %s\n", __func__, exc.what());
|
||||
info.device_count = 0;
|
||||
}
|
||||
if (info.device_count == 0) {
|
||||
GGML_LOG_ERROR("%s: failed to initialize: %s\n", GGML_SYCL_NAME, __func__);
|
||||
return info;
|
||||
|
|
|
|||
Loading…
Reference in New Issue