LLM inference in C/C++
C++ ggml
sycl: fix classification of iGPUs (#26105)
KyleHagy272700b36094
diff --git a/ggml/src/ggml-sycl/common.hpp b/ggml/src/ggml-sycl/common.hppindex 160331191d..619933e0fd 100644--- a/ggml/src/ggml-sycl/common.hpp+++ b/ggml/src/ggml-sycl/common.hpp@@ -235,6 +235,7 @@ struct sycl_device_info {int max_wg_per_cu; // max work groups per compute unit - refer to// cudaOccupancyMaxActiveBlocksPerMultiprocessorbool vmm; // virtual memory support+ bool l0_device_type_valid;bool l0_discrete_gpu; // Level Zero backend and not an integrated GPUsize_t vmm_granularity; // granularity of virtual memorysize_t total_vram;diff --git a/ggml/src/ggml-sycl/ggml-sycl.cpp b/ggml/src/ggml-sycl/ggml-sycl.cppindex 07ddfda887..d91e41f957 100644--- a/ggml/src/ggml-sycl/ggml-sycl.cpp+++ b/ggml/src/ggml-sycl/ggml-sycl.cpp@@ -167,7 +167,10 @@ static ggml_sycl_device_info ggml_sycl_init() {ze_device_properties_t props = {};props.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES;ze_result_t r = zeDeviceGetProperties(ze_dev, &props);- info.devices[i].l0_discrete_gpu = r == ZE_RESULT_SUCCESS && !(props.flags & ZE_DEVICE_PROPERTY_FLAG_INTEGRATED);+ if (r == ZE_RESULT_SUCCESS) {+ info.devices[i].l0_device_type_valid = true;+ info.devices[i].l0_discrete_gpu = !(props.flags & ZE_DEVICE_PROPERTY_FLAG_INTEGRATED);+ }}#endif}@@ -5606,7 +5609,11 @@ static void ggml_backend_sycl_device_get_memory(ggml_backend_dev_t dev, size_t *}static enum ggml_backend_dev_type ggml_backend_sycl_device_get_type(ggml_backend_dev_t dev) {- GGML_UNUSED(dev);+ ggml_backend_sycl_device_context * ctx = (ggml_backend_sycl_device_context *)dev->context;+ const sycl_device_info & info = ggml_sycl_info().devices[ctx->device];+ if (info.l0_device_type_valid && !info.l0_discrete_gpu) {+ return GGML_BACKEND_DEVICE_TYPE_IGPU;+ }return GGML_BACKEND_DEVICE_TYPE_GPU;}