Fix ROCm CPU performance, update the ROCm toolchain, and bundle Windows ARM64 CUDA libraries - #233
Conversation
…ws ARM64 CUDA libraries
|
Reached Codex review convergence at oobabooga#6. |
|
@codex review |
|
@codex security review |
|
@codex review |
|
tested the windows rocm leg locally (the part listed as not verified) on windows 11, ryzen 5 2600, rx 6500 xt (gfx1034), rocm the diagnosis is right, but the windows build fails configure now reports (same error at 783, 800 and 801) rocm's clang has never compiled the x86 simd files before, because the cpu backend used to be generic. on windows, clang takes msvc's fix (tested): add a cast on the 4 lines. with the pr's flags unchanged, all 14 variants then build clean: _mm_prefetch((const char *)(&x[ib] + sizeof(block_q4_0)), _MM_HINT_T0);( with the fix, everything else checks out
speed, shipped zip vs pr (t/s)
greedy output is coherent on both builds. i didn't test the arm64 cuda leg (no hardware). |
|
Thanks @LeoBorcherding, reproduced with the workflow's Windows steps on a Ryzen AI MAX+ 395 (gfx1151) with ROCm 10.2.0a20260924. The Fix: 62c131b adds Same machine, shipped zip vs this branch:
With Upstream builds only |
Summary
Three fixes to the prebuilt bundles, each measured or traced on real artifacts:
The ROCm flags, ROCm index and libraries, and ARM64 toolkit follow upstream or lemonade-sdk; the dependency checks and shipping the ARM64 CUDA DLLs inside the bundle are new.
1. ROCm CPU backend
-DCMAKE_SYSTEM_NAMEtogether with-DCMAKE_CROSSCOMPILING=ONleavesCMAKE_SYSTEM_PROCESSORempty. ggml then reportsGGML_SYSTEM_ARCH: UNKNOWNand buildsggml-cpuwith-DGGML_CPU_GENERICin every ROCm leg's nightly logs.llama.cpp enables
--fitby default, so this affects MoE models whose expert weights overflow VRAM onto the CPU.Measured on a Ryzen AI MAX+ 395 (gfx1151, Linux). Source is upstream b11139, the ROCm toolchain is the same, and arms were run interleaved:
With every layer on the GPU the two builds are identical (8B generation 42.4 vs 42.5 t/s). The published Windows gfx1151 zip shows the same loss on its CPU path (30B-A3B CPU-only generation 24.5 t/s vs 41.2 t/s for our windows-x64-cpu zip on the same machine).
The fix drops both flags and enables
GGML_BACKEND_DLandGGML_CPU_ALL_VARIANTS, matching upstream's Linux ROCm release. Dropping the flags alone restores generation speed but imposes an AVX2 baseline, breaking pre-AVX2 CPUs. Runtime variant selection preserves compatibility and improves CPU prompt speed (153 t/s with AVX2 vs 230 t/s with zen4).BACKEND_DLmakesggml-hipa loadable module alongsideggml-cpu-*. Studio's existing ROCm health-check globs match this layout.2. ROCm toolchain refresh
rocm.nightlies.amd.com/tarball-multi-archhas not published anything after 10.1.0a20260822 for any of the 14 target and OS combinations. AMD now publishes tonightly.repo.amd.com/rocm/core/tarball(10.2.0a20260924 at the time of writing, same file naming). lemonade-sdk moved in lemonade-sdk/llamacpp-rocm#141.In 10.2,
libhipblasltdepends on a newlibtensilelite-host, which on Linux in turn needs the unversionedllvm/lib/libomp.so.rocblasimportslibhipblaslt, so the whole HIP backend depends on them. I built bundles with the copy list from this workflow and ran them in a cleanubuntu:24.04container on gfx1151:libtensilelite-host.so.1not foundlibomp.sonot foundOn Windows, the shipped gfx1151 zip with the 10.2 DLLs from the current list exits with
0xC0000135(DLL not found) and runs oncelibtensilelite-host.dllis added. This matches lemonade-sdk/llamacpp-rocm#146.Changes:
libtensilelite-host.so*andllvm/lib/libomp.so; Windows copieslibtensilelite-host.dll.lddwithLD_LIBRARY_PATHunset and rejects missing dependencies or paths outside the bundle, except glibc, libstdc++ and libgcc_s. This prevents runner-installed libraries from hiding omissions.pefileto reject imports of DLLs present in TheRock'sbindirectory but absent from the bundle.The refresh itself does not change speed: on gfx1151, 10.1.0a20260822, 10.2.0a20260924 and the stable 10.0.0 release are within 1.5% of each other on Qwen3-8B and Qwen3-30B-A3B.
3. Windows ARM64 CUDA runtime
app-...-windows-arm64-cuda13-portable.zipshipsggml-cuda.dll, which importscublas64_13.dll, but the zip contains no CUDA runtime DLLs.package_bundle.pyleaves the runtime out on purpose because the installer pairs x64 bundles with the user's PyTorch. download.pytorch.org has no win_arm64 wheels for cu128, cu129, cu130 or cu132, and Studio only pairs a runtime archive with upstreamllama-assets. So on a Windows ARM64 machine without a CUDA toolkit, the CUDA backend cannot load and ggml runs on the CPU.Changes:
cudart64_13.dll,cublas64_13.dllandcublasLt64_13.dllfrombin\arm64are copied into the bundle input.package_bundle.pykeeps them whenBUNDLE_CUDA_RUNTIME=1. Only this leg sets it, so every other bundle is unchanged.Not changed
Verification
run:blocks from this branch inubuntu:22.04:libtensilelite-host, and rejects either it orlibomp.soresolving from a system library directory. A plainnot foundcheck misses the latter case.libggml-hip.soand thealderlakeCPU variant on an Intel host.package_bundle.pyrun locally on a Windows-layout input with and withoutBUNDLE_CUDA_RUNTIME=1: the zip gains exactly the three runtime DLLs, and is unchanged without the flag.actionlint,check_workflow_scalars.py,check_workflow_triggers.pyandcheck_workflow_outputs.pypass.Not verified: