Repository: ollama
Issue: ollama/ollama:rocm not detecting AMD GPU being passed in
Labels: bug

### What is the issue?

# Overview
I've been trying to add ollama/openwebui to my home lab and I've run across an issue I cannot figure out. ROCM has finally been released last month for my linux distro and I've got it installed and can run (on gpu) ollama on my host machine. When I try to transition to docker however, I am unable to get it to work. I will provide what I have but please ask any clarifying questions.
## Components
Host: Debian 6.1.124-1
CPU: I7-12700K
GPU: Radeon 6900 XT

# Docker compose file
```
services:
  ollama:
    image: ollama/ollama:rocm
    container_name: ollama
    hostname: ollama
    privileged: true
    volumes:
      - ollama:/root/.ollama
    environment:
      HSA_OVERRIDE_GFX_VERSION: 10.3.0
      AMD_SERIALIZE_KERNEL: 3
      HIP_VISIBLE_DEVICES: 0
      OLLAMA_DEBUG: 1
      AMD_LOG_LEVEL: 3
    # ports:
    #   - :11434
    restart: unless-stopped
    networks:
      - npm
    devices:
      - /dev/kfd
      - /dev/dri
    group_add:
      - 105
      - 44
    security_opt:
      - seccomp:unconfined
```

# Logs & Outputs
No errors that I can really tell. Here are the logs on startup in docker
```
2025-01-17 20:40:33 2025/01/18 01:40:33 routes.go:1187: INFO server config env="map[CUDA_VISIBLE_DEVICES: GPU_DEVICE_ORDINAL: HIP_VISIBLE_DEVICES:0 HSA_OVERRIDE_GFX_VERSION:10.3.0 HTTPS_PROXY: HTTP_PROXY: NO_PROXY: OLLAMA_DEBUG:true OLLAMA_FLASH_ATTENTION:false OLLAMA_GPU_OVERHEAD:0 OLLAMA_HOST:http://0.0.0.0:11434 OLLAMA_INTEL_GPU:false OLLAMA_KEEP_ALIVE:5m0s OLLAMA_KV_CACHE_TYPE: OLLAMA_LLM_LIBRARY: OLLAMA_LOAD_TIMEOUT:5m0s OLLAMA_MAX_LOADED_MODELS:0 OLLAMA_MAX_QUEUE:512 OLLAMA_MODELS:/root/.ollama/models OLLAMA_MULTIUSER_CACHE:false OLLAMA_NOHISTORY:false OLLAMA_NOPRUNE:false OLLAMA_NUM_PARALLEL:0 OLLAMA_ORIGINS:[http://localhost https://localhost http://localhost:* https://localhost:* http://127.0.0.1 https://127.0.0.1 http://127.0.0.1:* https://127.0.0.1:* http://0.0.0.0 https://0.0.0.0 http://0.0.0.0:* https://0.0.0.0:* app://* file://* tauri://* vscode-webview://*] OLLAMA_SCHED_SPREAD:false ROCR_VISIBLE_DEVICES: http_proxy: https_proxy: no_proxy:]"
2025-01-17 20:40:33 time=2025-01-18T01:40:33.654Z level=INFO source=images.go:432 msg="total blobs: 0"
2025-01-17 20:40:33 time=2025-01-18T01:40:33.655Z level=INFO source=images.go:439 msg="total unused blobs removed: 0"
2025-01-17 20:40:33 time=2025-01-18T01:40:33.655Z level=INFO source=routes.go:1238 msg="Listening on [::]:11434 (version 0.5.7-0-ga420a45-dirty)"
2025-01-17 20:40:33 time=2025-01-18T01:40:33.655Z level=DEBUG source=common.go:80 msg="runners located" dir=/usr/lib/ollama/runners
2025-01-17 20:40:33 time=2025-01-18T01:40:33.655Z level=DEBUG source=common.go:124 msg="availableServers : found" file=/usr/lib/ollama/runners/cpu_avx/ollama_llama_server
2025-01-17 20:40:33 time=2025-01-18T01:40:33.655Z level=DEBUG source=common.go:124 msg="availableServers : found" file=/usr/lib/ollama/runners/cpu_avx2/ollama_llama_server
2025-01-17 20:40:33 time=2025-01-18T01:40:33.655Z level=DEBUG source=common.go:124 msg="availableServers : found" file=/usr/lib/ollama/runners/rocm_avx/ollama_llama_server
2025-01-17 20:40:33 time=2025-01-18T01:40:33.655Z level=INFO source=routes.go:1267 msg="Dynamic LLM libraries" runners="[cpu cpu_avx cpu_avx2 rocm_avx]"
2025-01-17 20:40:33 time=2025-01-18T01:40:33.655Z level=DEBUG source=routes.go:1268 msg="Override detection logic by setting OLLAMA_LLM_LIBRARY"
2025-01-17 20:40:33 time=2025-01-18T01:40:33.655Z level=DEBUG source=sched.go:105 msg="starting llm scheduler"
2025-01-17 20:40:33 time=2025-01-18T01:40:33.656Z level=INFO source=gpu.go:226 msg="looking for compatible GPUs"
2025-01-17 20:40:33 time=2025-01-18T01:40:33.656Z level=DEBUG source=gpu.go:99 msg="searching for GPU discovery libraries for NVIDIA"
2025-01-17 20:40:33 time=2025-01-18T01:40:33.656Z level=DEBUG source=gpu.go:517 msg="Searching for GPU library" name=libcuda.so*
2025-01-17 20:40:33 time=2025-01-18T01:40:33.656Z level=DEBUG source=gpu.go:543 msg="gpu library search" globs="[/usr/lib/ollama/libcuda.so* /usr/lib/ollama/libcuda.so* /libcuda.so* /usr/local/cuda*/targets/*/lib/libcuda.so* /usr/lib/*-linux-gnu/nvidia/current/libcuda.so* /usr/lib/*-linux-gnu/libcuda.so* /usr/lib/wsl/lib/libcuda.so* /usr/lib/wsl/drivers/*/libcuda.so* /opt/cuda/lib*/libcuda.so* /usr/local/cuda/lib*/libcuda.so* /usr/lib*/libcuda.so* /usr/local/lib*/libcuda.so*]"
2025-01-17 20:40:33 time=2025-01-18T01:40:33.657Z level=DEBUG source=gpu.go:576 msg="discovered GPU libraries" paths=[]
2025-01-17 20:40:33 time=2025-01-18T01:40:33.657Z level=DEBUG source=gpu.go:517 msg="Searching for GPU library" name=libcudart.so*
2025-01-17 20:40:33 time=2025-01-18T01:40:33.657Z level=DEBUG source=gpu.go:543 msg="gpu library search" globs="[/usr/lib/ollama/libcudart.so* /usr/lib/ollama/libcudart.so* /libcudart.so* /usr/lib/ollama/libcudart.so* /usr/lib/ollama/libcudart.so* /usr/local/cuda/lib64/libcudart.so* /usr/lib/x86_64-linux-gnu/nvidia/current/libcudart.so* /usr/lib/x86_64-linux-gnu/libcudart.so* /usr/lib/wsl/lib/libcudart.so* /usr/lib/wsl/drivers/*/libcudart.so* /opt/cuda/lib64/libcudart.so* /usr/local/cuda*/targets/aarch64-linux/lib/libcudart.so* /usr/lib/aarch64-linux-gnu/nvidia/current/libcudart.so* /usr/lib/aarch64-linux-gnu/libcudart.so* /usr/local/cuda/lib*/libcudart.so* /usr/lib*/libcudart.so* /usr/local/lib*/libcudart.so*]"
2025-01-17 20:40:33 time=2025-01-18T01:40:33.657Z level=DEBUG source=gpu.go:576 msg="discovered GPU libraries" paths=[]
2025-01-17 20:40:33 time=2025-01-18T01:40:33.657Z level=DEBUG source=amd_linux.go:421 msg="amdgpu driver not detected /sys/module/amdgpu"
2025-01-17 20:40:33 time=2025-01-18T01:40:33.657Z level=INFO source=gpu.go:392 msg="no compatible GPUs were discovered"
2025-01-17 20:40:33 time=2025-01-18T01:40:33.657Z level=INFO source=types.go:131 msg="inference compute" id=0 library=cpu variant=avx2 compute="" driver=0.0 name="" total="50.7 GiB" available="35.1 GiB"
```


```ls -ld /sys/module/amdgpu``` is display ```drwxr-xr-x 7 root root 0 Jan 17 12:23 /sys/module/amdgpu```

### OS

Linux, Docker

### GPU

AMD

### CPU

Intel

### Ollama version

0.5.7-0-ga420a45-dirty