Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Ollama on RX 9060 XT in WSL: ROCm Setup Guide

· 5 min read · Home Tech

In this article
  1. Why WSL and ROCm for Ollama?
  2. Requirements for RX 9060 XT and ROCm
  3. Step-by-Step ROCm Setup in WSL
  4. Common Issues and Fixes
  5. Performance Considerations
  6. Alternatives to ROCm in WSL
  7. Frequently Asked Questions

Yes, you can run Ollama with an AMD Radeon RX 9060 XT inside Windows Subsystem for Linux (WSL) using ROCm, but you need a specific setup: install the ROCm driver inside WSL, not on Windows, and configure Ollama to use the GPU via the HIP backend. This guide walks through the exact steps and requirements.

Why WSL and ROCm for Ollama?

Ollama is a popular tool for running large language models locally. It supports GPU acceleration through CUDA (NVIDIA) and ROCm (AMD). On Windows, Ollama runs natively, but many users prefer WSL for better Linux compatibility, especially when using ROCm, because AMD's ROCm stack is primarily developed for Linux. WSL2 provides a real Linux kernel, so ROCm can work inside it, letting you leverage the RX 9060 XT's compute power for faster inference.

Requirements for RX 9060 XT and ROCm

Before you begin, check that your system meets these prerequisites:

  • Windows 11 with WSL2 enabled (Windows 10 also works but may need manual setup).
  • AMD Radeon RX 9060 XT with at least 8GB VRAM (16GB recommended for larger models).
  • AMD ROCm version 6.2 or newer – the RX 9060 XT is based on RDNA4, which requires recent ROCm releases for full support.
  • WSL kernel updated (run wsl --update in PowerShell).
  • Ubuntu 22.04 or 24.04 as your WSL distribution.

ROCm officially supports a list of GPUs, and the RX 9060 XT is included in recent versions. If your exact model isn't listed, you may need to set the environment variable HSA_OVERRIDE_GFX_VERSION to force compatibility, but this is risky and not recommended unless you know what you're doing.

Step-by-Step ROCm Setup in WSL

  1. Enable WSL and install a distribution – Open PowerShell as Administrator and run wsl --install. Reboot if prompted. Then install Ubuntu from the Microsoft Store or via wsl --install -d Ubuntu.
  2. Update WSL kernel – Run wsl --update to ensure you have the latest kernel with GPU paravirtualization support.
  3. Add ROCm repository – Inside your WSL terminal, add the AMD ROCm apt repository. The exact commands depend on your Ubuntu version, but generally you'll add the key and repo, then update.
  4. Install ROCm runtime – Install the rocm meta-package or the specific rocm-hip-runtime and rocm-smi-lib. This installs the HIP runtime and device libraries needed by Ollama.
  5. Verify GPU detection – Run rocm-smi or rocminfo. You should see your RX 9060 XT listed. If not, check that WSL is using GPU passthrough (enable in Windows Settings > System > About > Windows Specifications > “Enable GPU acceleration in WSL”).
  6. Install Ollama – Use the official install script: curl -fsSL https://ollama.com/install.sh | sh. This installs the Linux version, which includes ROCm support.
  7. Test with a small model – Run ollama run llama3.2 (or any small model). Ollama should automatically detect the GPU and use it. Check with ollama ps to see if the model is loaded on the GPU.

Common Issues and Fixes

  • GPU not detected – Ensure you have the latest Windows GPU driver installed (from AMD's website, not just Windows Update). Also, run wsl --update and restart WSL.
  • ROCm installation fails – Make sure you're using a supported Ubuntu version. If you're on 24.04, some older ROCm packages may not work; use the ROCm 6.3+ repository.
  • Ollama uses CPU instead of GPU – Check if the HIP_VISIBLE_DEVICES environment variable is set incorrectly. Unset it or set it to 0 to force the first GPU. Also, verify that Ollama's logs show ROCm initialization.
  • Out of memory errors – The RX 9060 XT has limited VRAM. Use smaller models or quantized versions (e.g., Q4_K_M) to fit within memory.

Performance Considerations

The RX 9060 XT is a mid-range card, so expect decent but not flagship performance. For example, a 7B parameter model like Llama 3 will run at around 20-40 tokens per second, depending on quantization and prompt length. Larger 13B models will be slower and may require 16GB VRAM to run comfortably. You can monitor VRAM usage with rocm-smi while Ollama is running.

One important note: ROCm in WSL does not support all features that native Linux does, such as multi-GPU or some advanced kernels. For most Ollama use cases, this is not an issue.

Alternatives to ROCm in WSL

If ROCm setup proves too troublesome, consider these alternatives:

  • Ollama on Windows natively – Ollama has a Windows version that uses DirectML for AMD GPUs. It's easier to install but may be slower than ROCm.
  • Use a Linux dual-boot – Running Ollama on a native Linux partition gives the best ROCm performance and compatibility.
  • Use a cloud GPU – If local performance isn't critical, services like RunPod or Lambda Labs offer AMD GPU instances with pre-configured ROCm.

Frequently Asked Questions

Do I need to install AMD drivers on Windows for WSL to work?

Yes, you need the latest AMD Adrenalin driver on Windows, because WSL uses the Windows driver for GPU passthrough. The ROCm stack inside WSL then uses that driver to communicate with the GPU.

Can I use an RX 9060 XT with ROCm 5.x?

No, ROCm 5.x does not support RDNA4 GPUs. You must use ROCm 6.2 or later, which includes support for the RX 9060 XT.

Why does Ollama say “no GPU” even after ROCm is installed?

This usually happens when the HIP runtime isn't found. Check that the LD_LIBRARY_PATH includes /opt/rocm/lib, and that you've installed the rocm-hip-runtime package. Also, verify with rocminfo that the GPU is visible.

Is it safe to set HSA_OVERRIDE_GFX_VERSION?

It's a workaround for unsupported GPUs, but it can cause crashes or incorrect results. Only use it if you're certain the GPU architecture matches (e.g., gfx1201 for RX 9060 XT). Otherwise, stick to supported versions.

Will Ollama automatically use the GPU after setup?

Yes, Ollama automatically detects and uses the GPU if ROCm is properly installed and the GPU is visible. You can verify with ollama ps to see if the model is loaded on the GPU (it will show “100% GPU” usage).