]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
ggml: auto apply iGPU flag CUDA/HIP if integrated device (#23007)
authorfl0rianr <redacted>
Thu, 28 May 2026 13:01:14 +0000 (15:01 +0200)
committerGitHub <redacted>
Thu, 28 May 2026 13:01:14 +0000 (15:01 +0200)
ggml/src/ggml-cuda/ggml-cuda.cu

index dc3e8fd6265f42a21668e029a7acf6414c116fa5..18aaa098398230ffe93d7720c1fb9535599f03cd 100644 (file)
@@ -4994,8 +4994,14 @@ static void ggml_backend_cuda_device_get_memory(ggml_backend_dev_t dev, size_t *
 }
 
 static enum ggml_backend_dev_type ggml_backend_cuda_device_get_type(ggml_backend_dev_t dev) {
-    GGML_UNUSED(dev);
-    return GGML_BACKEND_DEVICE_TYPE_GPU;
+    ggml_backend_cuda_device_context * ctx = (ggml_backend_cuda_device_context *) dev->context;
+
+    cudaDeviceProp prop;
+    CUDA_CHECK(cudaGetDeviceProperties(&prop, ctx->device));
+
+    return prop.integrated
+        ? GGML_BACKEND_DEVICE_TYPE_IGPU
+        : GGML_BACKEND_DEVICE_TYPE_GPU;
 }
 
 static void ggml_backend_cuda_device_get_props(ggml_backend_dev_t dev, ggml_backend_dev_props * props) {