sycl: report zero devices instead of aborting when the host has none (#27291)
Prevents crash when not even performing SYCL compute, for instance when trying to run `llama-quantize`.
This commit is contained in:
@@ -109,7 +109,14 @@ int g_ggml_sycl_enable_host_pinned_mem = 1;
|
|||||||
static ggml_sycl_device_info ggml_sycl_init() {
|
static ggml_sycl_device_info ggml_sycl_init() {
|
||||||
ggml_sycl_device_info info = {};
|
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) {
|
if (info.device_count == 0) {
|
||||||
GGML_LOG_ERROR("%s: failed to initialize: %s\n", GGML_SYCL_NAME, __func__);
|
GGML_LOG_ERROR("%s: failed to initialize: %s\n", GGML_SYCL_NAME, __func__);
|
||||||
return info;
|
return info;
|
||||||
|
|||||||
Reference in New Issue
Block a user