Skip to content

Instantly share code, notes, and snippets.

@birep
birep / fix_strix_cwsr.c
Created October 1, 2026 00:16
Fix for hipStreamCreate OOM on Strix Halo + ROCm
/*
* Fix for gfx1151 (Strix Halo) ROCm "out of memory" abort on hipStreamCreate:
*
* Issue: amdkfd enforces ctx_save_restore_area_size >= topo cwsr_size (0x124c000 / 19.2 MB).
* hsakmt hardcodes 0xd4c000 (13.9 MB), causing AMDKFD_IOC_CREATE_QUEUE to return -EINVAL,
* which ROCr surfaces to HIP as hipErrorOutOfMemory.
*
* Solution: Intercept mmap/ioctl to expand CWSR buffer sizes to match kernel requirements.
*
* Build: gcc -shared -fPIC -O3 fix_strix_cwsr.c -o libfix_strix_cwsr.so -ldl
@birep
birep / libfix_strix_cwsr.so
Created September 30, 2026 21:48
Fix for gfx1151 (Strix Halo) ROCm "out of memory" abort on hipStreamCreate
/*
* Fix for gfx1151 (Strix Halo) ROCm "out of memory" abort on hipStreamCreate:
*
* Issue: amdkfd enforces ctx_save_restore_area_size >= topo cwsr_size (0x124c000 / 19.2 MB).
* hsakmt hardcodes 0xd4c000 (13.9 MB), causing AMDKFD_IOC_CREATE_QUEUE to return -EINVAL,
* which ROCr surfaces to HIP as hipErrorOutOfMemory.
*
* Solution: Intercept mmap/ioctl to expand CWSR buffer sizes to match kernel requirements.
*
* Build: gcc -shared -fPIC -O3 fix_strix_cwsr.c -o libfix_strix_cwsr.so -ldl