[GH-ISSUE #9588] Ollama always choses iGPU for computations in hybrind discrete+iGPU rocm setups #68310

Open
opened 2026-05-04 13:12:25 -05:00 by GiteaMirror · 8 comments
Owner

Originally created by @pshirshov on GitHub (Mar 7, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/9588

Originally assigned to: @dhiltgen on GitHub.

What is the issue?

I have two discrete AMD GPUs and my CPU (Ryzen 9900x) also has an iGPU. Out of curiosity, I've tried to enable it and see how ollama behaves.

I'm running ollama with the following environment variables:

        OLLAMA_NEW_ENGINE = "0";
        OLLAMA_CONTEXT_LENGTH = "16384";
        OLLAMA_FLASH_ATTENTION = "1";
        OLLAMA_SCHED_SPREAD = "1";

It seems like ollama spreads the model across the discrete GPUs and loads nothing into the iGPU VRAM.
Also it always chooses iGPU for computations.
Two big GPUs do nothing while the poor iGPU has to to all the heavy lifting.

Relevant log output

============================================= ROCm System Management Interface =============================================
======================================================= Concise Info =======================================================
Device  Node  IDs              Temp    Power   Partitions          SCLK    MCLK     Fan     Perf  PwrCap       VRAM%  GPU%
              (DID,     GUID)  (Edge)  (Avg)   (Mem, Compute, ID)
============================================================================================================================
0       1     0x7448,   54057  72.0°C  100.0W  N/A, N/A, 0         232Mhz  1124Mhz  21.96%  auto  241.0W       22%    9%
1       2     0x744c,   56753  38.0°C  38.0W   N/A, N/A, 0         0Mhz    456Mhz   0%      auto  303.0W       30%    0%
2       3     0x13c0,   20150  52.0°C  0.023W  N/A, N/A, 0         None    3200Mhz  0%      auto  Unsupported  0%     100%
============================================================================================================================
=================================================== End of ROCm SMI Log ====================================================

OS

Linux

GPU

AMD

CPU

AMD

Ollama version

0.5.12

Originally created by @pshirshov on GitHub (Mar 7, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/9588 Originally assigned to: @dhiltgen on GitHub. ### What is the issue? I have two discrete AMD GPUs and my CPU (Ryzen 9900x) also has an iGPU. Out of curiosity, I've tried to enable it and see how ollama behaves. I'm running ollama with the following environment variables: ``` OLLAMA_NEW_ENGINE = "0"; OLLAMA_CONTEXT_LENGTH = "16384"; OLLAMA_FLASH_ATTENTION = "1"; OLLAMA_SCHED_SPREAD = "1"; ``` It seems like ollama spreads the model across the discrete GPUs and loads nothing into the iGPU VRAM. Also it always chooses iGPU for computations. Two big GPUs do nothing while the poor iGPU has to to all the heavy lifting. ### Relevant log output ```shell ============================================= ROCm System Management Interface ============================================= ======================================================= Concise Info ======================================================= Device Node IDs Temp Power Partitions SCLK MCLK Fan Perf PwrCap VRAM% GPU% (DID, GUID) (Edge) (Avg) (Mem, Compute, ID) ============================================================================================================================ 0 1 0x7448, 54057 72.0°C 100.0W N/A, N/A, 0 232Mhz 1124Mhz 21.96% auto 241.0W 22% 9% 1 2 0x744c, 56753 38.0°C 38.0W N/A, N/A, 0 0Mhz 456Mhz 0% auto 303.0W 30% 0% 2 3 0x13c0, 20150 52.0°C 0.023W N/A, N/A, 0 None 3200Mhz 0% auto Unsupported 0% 100% ============================================================================================================================ =================================================== End of ROCm SMI Log ==================================================== ``` ### OS Linux ### GPU AMD ### CPU AMD ### Ollama version 0.5.12
GiteaMirror added the amdbuggpu labels 2026-05-04 13:12:26 -05:00
Author
Owner

@pshirshov commented on GitHub (Mar 7, 2025):

Upd: I'm wrong that the iGPU VRAM is not used. It is, but rocm-smi always reports 0. So, the only actual problem is that the big GPUs are never used for computations for some reason.

<!-- gh-comment-id:2707702887 --> @pshirshov commented on GitHub (Mar 7, 2025): Upd: I'm wrong that the iGPU VRAM is not used. It is, but rocm-smi always reports 0. So, the only actual problem is that the big GPUs are never used for computations for some reason.
Author
Owner

@dhiltgen commented on GitHub (Mar 14, 2025):

Please share server logs with OLLAMA_DEBUG=1 set so we can see what's going wrong with GPU selection.

<!-- gh-comment-id:2725929724 --> @dhiltgen commented on GitHub (Mar 14, 2025): Please share server logs with OLLAMA_DEBUG=1 set so we can see what's going wrong with GPU selection.
Author
Owner

@pshirshov commented on GitHub (Mar 20, 2025):

Sorry about the delay. Will try to do it tomorrow.

<!-- gh-comment-id:2741353676 --> @pshirshov commented on GitHub (Mar 20, 2025): Sorry about the delay. Will try to do it tomorrow.
Author
Owner

@pshirshov commented on GitHub (Mar 24, 2025):

ollama-log.txt

<!-- gh-comment-id:2748295051 --> @pshirshov commented on GitHub (Mar 24, 2025): [ollama-log.txt](https://github.com/user-attachments/files/19431294/ollama-log.txt)
Author
Owner

@dhiltgen commented on GitHub (Apr 9, 2025):

@pshirshov the attached logs don't have OLLAMA_DEBUG set so it's a little difficult to see exactly what's going on.

It appears your iGPU has 16G available, and since you're setting HSA_OVERRIDE_GFX_VERSION I believe we're bypassing some of the iGPU detection logic and including it.

I believe if you set ROCR_VISIBLE_DEVICES=GPU-7361774224453804,GPU-158d2b5a9a762b35 that should just run on the discrete GPUs. If that doesn't work, you can try HIP_VISIBLE_DEVICES=0,1

<!-- gh-comment-id:2790904119 --> @dhiltgen commented on GitHub (Apr 9, 2025): @pshirshov the attached logs don't have OLLAMA_DEBUG set so it's a little difficult to see exactly what's going on. It appears your iGPU has 16G available, and since you're setting HSA_OVERRIDE_GFX_VERSION I believe we're bypassing some of the iGPU detection logic and including it. I believe if you set `ROCR_VISIBLE_DEVICES=GPU-7361774224453804,GPU-158d2b5a9a762b35` that should just run on the discrete GPUs. If that doesn't work, you can try `HIP_VISIBLE_DEVICES=0,1`
Author
Owner

@pshirshov commented on GitHub (Apr 20, 2025):

Of course, if I exclude my iGPU everything works fine, but this way I have less VRAM available. I'm just wondering if it's possible to fix/improve scheduling in order to make multi-GPU setups with iGPUs more efficient than they are now. Currently such setups work but they are practically useless.

I'll provide the extended log shortly.

<!-- gh-comment-id:2817267229 --> @pshirshov commented on GitHub (Apr 20, 2025): Of course, if I exclude my iGPU everything works fine, but this way I have less VRAM available. I'm just wondering if it's possible to fix/improve scheduling in order to make multi-GPU setups with iGPUs more efficient than they are now. Currently such setups work but they are practically useless. I'll provide the extended log shortly.
Author
Owner

@pshirshov commented on GitHub (Apr 20, 2025):

ollama-log.txt

<!-- gh-comment-id:2817272396 --> @pshirshov commented on GitHub (Apr 20, 2025): [ollama-log.txt](https://github.com/user-attachments/files/19826415/ollama-log.txt)
Author
Owner

@pshirshov commented on GitHub (Apr 20, 2025):

I guess my interpretation is wrong. Looking at the log lines about layer assignments, I may guess that discrete GPUs just finish their work quiet fast and then do nothing while iGPU computes several last layers. Probably, there is no easy improvement.

<!-- gh-comment-id:2817273368 --> @pshirshov commented on GitHub (Apr 20, 2025): I guess my interpretation is wrong. Looking at the log lines about layer assignments, I may guess that discrete GPUs just finish their work quiet fast and then do nothing while iGPU computes several last layers. Probably, there is no easy improvement.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#68310