Prepare Windows HIP/ROCm builds for distribution releases - #153
Conversation
- Add -NoNativeCpu: keep ggml CPU kernels off the build machine's native ISA. A distribution binary built with the default (native) can crash with 'illegal instruction' on older CPUs. - Add -DeploymentBuild: forward AUDIOCPP_DEPLOYMENT_BUILD so model_specs are compiled into the binary for self-contained packages. - Add -BuildDir: allow side-by-side build trees (e.g. ROCm 6.4 and 7.1). - Clear stale GPU_BUILD_TARGETS/AMDGPU_TARGETS cache entries (-U): hip-config-amd.cmake caches GPU_BUILD_TARGETS, so a previous configure's arch list silently overrode a new -GpuTargets value. - Force -DGGML_OPENMP=OFF: ggml probes for OpenMP on its own and, in a vcvars environment, finds LLVM libomp, adding a libomp140.x86_64.dll runtime dependency to otherwise-clean HIP binaries.
ROCm clang (GNU driver) targets x86_64-pc-windows-msvc and rejects
-fPIC ('unsupported option'), which breaks every Windows HIP build at
the sentencepiece protobuf-lite sources. PIC is meaningless on Windows,
so skip the flag on WIN32.
Documents how to build and package Windows HIP binaries that run on end user machines without a ROCm SDK installation: - Dual release tracks: ROCm 6.4 (8 arches incl. gfx1102) and ROCm 7.1 (7 arches; 7.1 hipBLASLt ships no gfx1102 kernels). - Runtime DLL bundling, including the hipblaslt kernel library (fatal to omit: it is the default GEMM path and the only one covering gfx1103) and the bundled HIP runtime (Adrenalin 26.5.1+ drivers no longer ship the ROCm 6 runtime, so relying on the driver is not viable for either track). - Kernel library filtering per architecture with measured sizes. - Build environment requirements: MSVC 14.44 toolset (14.51 breaks ROCm clang), -NoNativeCpu, GGML_OPENMP off, dumpbin dependency verification checklist. Also documents the -NoNativeCpu option in HIP.md. Both tracks were verified locally with side-by-side builds.
|
@IIIIIllllIIIIIlllll A big yes to ROCm prebuilts! Would you be willing to set up a repo and publish the ROCm prebuilts there? Since I don't have a ROCm machine, I can't validate the correctness of the prebuilts myself. I can direct users to your repo for the downloads. |
No problem |
|
@IIIIIllllIIIIIlllll Merged and thank you! |
|
@0xShug0 Since we'll be maintaining releases on both sides, I'd like to keep things aligned: Versioning — should the HIP packages follow your release tags/versioning scheme, or is an independent suffix like -hip fine with you? Thanks! Releases: https://github.com/IIIIIllllIIIIIlllll/audio.cpp/releases |
|
@IIIIIllllIIIIIlllll For versioning, please align it with the audio.cpp Windows release so the versions are easy to match. I'll create a tag for each release, and you can pin your release to that tag in the release notes. There are no other requirements for the wording in the release notes :) README: Feel free to submit a PR. Mentioning "community-maintained" as the WebUI would be great. |
* Harden Windows HIP build script for distribution builds
- Add -NoNativeCpu: keep ggml CPU kernels off the build machine's native
ISA. A distribution binary built with the default (native) can crash
with 'illegal instruction' on older CPUs.
- Add -DeploymentBuild: forward AUDIOCPP_DEPLOYMENT_BUILD so model_specs
are compiled into the binary for self-contained packages.
- Add -BuildDir: allow side-by-side build trees (e.g. ROCm 6.4 and 7.1).
- Clear stale GPU_BUILD_TARGETS/AMDGPU_TARGETS cache entries (-U):
hip-config-amd.cmake caches GPU_BUILD_TARGETS, so a previous
configure's arch list silently overrode a new -GpuTargets value.
- Force -DGGML_OPENMP=OFF: ggml probes for OpenMP on its own and, in a
vcvars environment, finds LLVM libomp, adding a libomp140.x86_64.dll
runtime dependency to otherwise-clean HIP binaries.
* Fix sentencepiece -fPIC build failure with Windows clang
ROCm clang (GNU driver) targets x86_64-pc-windows-msvc and rejects
-fPIC ('unsupported option'), which breaks every Windows HIP build at
the sentencepiece protobuf-lite sources. PIC is meaningless on Windows,
so skip the flag on WIN32.
* Add Windows HIP/ROCm distribution guide
Documents how to build and package Windows HIP binaries that run on end
user machines without a ROCm SDK installation:
- Dual release tracks: ROCm 6.4 (8 arches incl. gfx1102) and ROCm 7.1
(7 arches; 7.1 hipBLASLt ships no gfx1102 kernels).
- Runtime DLL bundling, including the hipblaslt kernel library (fatal
to omit: it is the default GEMM path and the only one covering
gfx1103) and the bundled HIP runtime (Adrenalin 26.5.1+ drivers no
longer ship the ROCm 6 runtime, so relying on the driver is not
viable for either track).
- Kernel library filtering per architecture with measured sizes.
- Build environment requirements: MSVC 14.44 toolset (14.51 breaks
ROCm clang), -NoNativeCpu, GGML_OPENMP off, dumpbin dependency
verification checklist.
Also documents the -NoNativeCpu option in HIP.md. Both tracks were
verified locally with side-by-side builds.
* Polish sentencepiece Windows HIP CMake hunk
---------
Co-authored-by: 0xShug0 <231717474+0xShug0@users.noreply.github.com>
Hello! It's time to prepare prebuilt packages for the ROCm builds — everything new in this PR is listed below. One thing I'd like to confirm: do you have plans to publish ROCm release packages? Thanks!
Groundwork for prebuilt Windows HIP/ROCm packages
Goal: ship Windows prebuilt packages that run on AMD GPUs without a ROCm SDK installation on end-user machines. Both release tracks were verified locally with side-by-side builds.
Changes
scripts/build_windows_hip.ps1 — distribution-ready options: -NoNativeCpu (don't bake build-machine ISA into CPU kernels), -DeploymentBuild (embed model_specs/), -BuildDir (side-by-side ROCm version builds); fix -GpuTargets being silently ignored on re-configure (stale GPU_BUILD_TARGETS cache); -DGGML_OPENMP=OFF to prevent an accidental libomp140.x86_64.dll dependency.
external/sentencepiece — fix -fPIC breaking Windows HIP builds (ROCm clang rejects it for x86_64-pc-windows-msvc).
docs/build/windows-hip-distribution.md — packaging guide: dual tracks (ROCm 6.4 = 8 arches incl. gfx1102; ROCm 7.1 = 7 arches), DLL + kernel library checklists (incl. hipblaslt/library, fatal to omit), bundled HIP runtime rationale (Adrenalin 26.5.1 dropped the ROCm 6 runtime), measured sizes, filtering scripts.
Verification
ROCm 6.4: 8 arches × 145 .cu; dumpbin clean (amdhip64_6 + hipblas + hipblaslt + CRT only); TTS inference confirmed on gfx1103 (780M).
ROCm 7.1: 7 arches, same checks passed; new DLL naming confirmed (amdhip64_7, libhipblas, libhipblaslt).