-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metal uses Intel HD instead of AMD GPU on Intel iMac5k #2407
Comments
I've searched the issue logs, and can't find any reference to anyone else using an Metal on an Intel Mac. Hello! :) I have access to an Intel Mac Pro (2019) with an AMD Radeon Pro Vega II 32 GB gpu. Running a Llama2 model with -ngl doesn't fail, it produces nonsense tokens. Without -ngl, I get the expected happy stories about llamas in my garden... @furu00 Does the Intel HD graphics metal that -ngl defaults to on your intel iMac actual generate useful output v cpu mode? |
Does your Mac have correct output?
There were no such problems with the first versions of ggml-metal. On iOS everything works fine. I think this problem appears only on Intel. |
FWIW: I've added this debug code: diff --git a/ggml-metal.m b/ggml-metal.m
index e929c4b..de4de24 100644
--- a/ggml-metal.m
+++ b/ggml-metal.m
@@ -119,7 +119,14 @@ struct ggml_metal_context * ggml_metal_init(int n_cb) {
struct ggml_metal_context * ctx = malloc(sizeof(struct ggml_metal_context));
ctx->n_cb = MIN(n_cb, GGML_METAL_MAX_BUFFERS);
+ NSArray *devices = MTLCopyAllDevices();
+ id <MTLDevice> device;
+ for (device in devices) {
+ NSString *s = [device name];
+ printf("found device: %s\n", [s cStringUsingEncoding:NSISOLatin1StringEncoding]);
+ }
ctx->device = MTLCreateSystemDefaultDevice();
+ printf("using device: %s\n", [[ctx->device name] cStringUsingEncoding:NSISOLatin1StringEncoding]);
ctx->queue = [ctx->device newCommandQueue];
ctx->n_buffers = 0;
ctx->concur_list_len = 0; With this I get the following output from the metal build on my Intel MacBook Pro 16-inch (2019) on macOS Ventura 13.5.1:
I.e. Does the AMD Radeon Pro 5500M (8 GB VRAM; supports Metal 3) run out of memory? |
Update: The following + // GGML_METAL_ADD_KERNEL(mul_mm_f16_f32);
+ // GGML_METAL_ADD_KERNEL(mul_mm_q4_0_f32);
+ // GGML_METAL_ADD_KERNEL(mul_mm_q8_0_f32);
+ // GGML_METAL_ADD_KERNEL(mul_mm_q4_1_f32);
+ // GGML_METAL_ADD_KERNEL(mul_mm_q2_K_f32);
+ // GGML_METAL_ADD_KERNEL(mul_mm_q3_K_f32);
+ // GGML_METAL_ADD_KERNEL(mul_mm_q4_K_f32);
+ // GGML_METAL_ADD_KERNEL(mul_mm_q5_K_f32);
+ // GGML_METAL_ADD_KERNEL(mul_mm_q6_K_f32); |
This issue was closed because it has been inactive for 14 days since being marked as stale. |
Expected Behavior
Utilizing Metal on a 2019 imac5k with a Radeon Pro Vega 48
Current Behavior
All runs fine, but metal uses the Intel HD graphics internal card instead of the Vega GPU
Solution
You are using "ctx->device = MTLCreateSystemDefaultDevice();" in ggml-metal.m
You need to use "MTLCopyAllDevices" to get an array.
https://developer.apple.com/documentation/metal/gpu_devices_and_work_submission/multi-gpu_systems/finding_multiple_gpus_on_an_intel-based_mac
Environment and Context
Please provide detailed information about your computer setup. This is important in case the issue is not reproducible except for under certain specific conditions.
Mac os: 13.4.1
Chipset Model: Radeon Pro Vega 48
Type: GPU
Bus: PCIe
PCIe Lane Width: x16
VRAM (Total): 8 GB
Vendor: AMD (0x1002)
Device ID: 0x6869
Revision ID: 0x0000
EFI Driver Version: 01.01.072
Metal Support: Metal 3
Model Name: iMac
Model Identifier: iMac19,1
Processor Name: 6-Core Intel Core i5
Processor Speed: 3,7 GHz
Number of Processors: 1
Total Number of Cores: 6
L2 Cache (per Core): 256 KB
L3 Cache: 9 MB
Memory: 24 GB
The text was updated successfully, but these errors were encountered: