From af2308ea38bc17304cd42028caa96d919b134f1e Mon Sep 17 00:00:00 2001 From: Xariann <130084241+Xarianne@users.noreply.github.com> Date: Mon, 27 Jul 2026 07:31:37 +0100 Subject: [PATCH] fix(rocm): add MIOpen stability env vars to docker-compose.rocm.yml (#865) Add three environment variables to prevent miopenStatusUnknownError and system stuttering during inference on RDNA4 GPUs: - MIOPEN_USER_DB_PATH: redirect MIOpen kernel cache to writable, persistent dir - MIOPEN_CUSTOM_CACHE_DIR: same, for custom operator cache - MIOPEN_FIND_MODE=FAST: use heuristic kernel selection instead of exhaustive benchmarking, which fails on RDNA4 with ptr: 0 size: 0 workspace warnings MIOPEN_FIND_MODE=FAST does not affect output quality. All MIOpen kernel variants produce the same numerical result; fast mode selects a known-good kernel using heuristics instead of benchmarking every variant on the GPU. Tested on RX 9070 (gfx1201) with ROCm 7.2 and PyTorch 2.12.1+rocm7.2. Hardware note: tested on Ryzen 7 9800X3D + RX 9070 with Gigabyte B650M DS3H motherboard. The exhaustive benchmarking failures may be related to IOMMU behavior on this platform. This system was affected by an IOMMU bug patched upstream in kernel 6.19.10, which may be a contributing factor. May not affect all RDNA4 systems. MIOPEN_FIND_MODE=FAST is a safe default regardless. Depends on PR #862 which fixes the broken ROCm Docker build. --- docker-compose.rocm.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docker-compose.rocm.yml b/docker-compose.rocm.yml index 63a562e2..17680bbe 100644 --- a/docker-compose.rocm.yml +++ b/docker-compose.rocm.yml @@ -34,3 +34,15 @@ services: # Tune the ROCm memory allocator - PYTORCH_HIP_ALLOC_CONF=garbage_collection_threshold:0.8,max_split_size_mb:512 + + # Redirect MIOpen kernel cache to a writable, persistent directory. + # Without this, MIOpen may fail to write its cache and throw + # miopenStatusUnknownError on fresh containers. + - MIOPEN_USER_DB_PATH=/app/data/cache/miopen_db + - MIOPEN_CUSTOM_CACHE_DIR=/app/data/cache/miopen_cache + + # Use fast heuristics for kernel selection instead of exhaustive + # benchmarking. On RDNA4, exhaustive mode tries kernels that fail to + # allocate workspace memory (ptr: 0 size: 0), causing system stuttering + # on every generation even when the cache is present. + - MIOPEN_FIND_MODE=FAST