ggerganov / whisper.cpp

Port of OpenAI's Whisper model in C/C++
MIT License
33.17k stars 3.34k forks source link

Cmake: Unable to build on Windows with -DWHISPER_HIPBLAS=ON #2202

Open newfla opened 1 month ago

newfla commented 1 month ago

Hi, I'm strugling with windows building using rocm/hipblas feature. Windows SDK version 10.0.19041.0 Rocm 5.7 for Windows Is this a known problem? Do you think some configuration might be missing in CMkelists.txt? My impression is that it's not using hipcc to compile the sources

Logs:

cmake -B build -DWHISPER_HIPBLAS=ON

```Shell PS C:\Users\newfl\Downloads\code\whisper.cpp> cmake -B build -DWHISPER_HIPBLAS=ON -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22631. CMake Warning at CMakeLists.txt:385 (message): Only LLVM is supported for HIP, hint: CC=/opt/rocm/llvm/bin/clang CMake Warning at CMakeLists.txt:388 (message): Only LLVM is supported for HIP, hint: CXX=/opt/rocm/llvm/bin/clang++ CMake Deprecation Warning at C:/Program Files/AMD/ROCm/5.7/lib/cmake/hip/hip-config.cmake:20 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions. Call Stack (most recent call first): CMakeLists.txt:391 (find_package) perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LC_ALL = (unset), (possibly more locale environment variables) LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the system default locale ("Italian_Italy.1252"). perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LC_ALL = (unset), (possibly more locale environment variables) LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the system default locale ("Italian_Italy.1252"). CMake Deprecation Warning at C:/Program Files/AMD/ROCm/5.7/lib/cmake/hip/hip-config-amd.cmake:21 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions. Call Stack (most recent call first): C:/Program Files/AMD/ROCm/5.7/lib/cmake/hip/hip-config.cmake:150 (include) CMakeLists.txt:391 (find_package) -- hip::amdhip64 is SHARED_LIBRARY CMake Deprecation Warning at C:/Program Files/AMD/ROCm/5.7/lib/cmake/hip/hip-config.cmake:20 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions. Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.29/Modules/CMakeFindDependencyMacro.cmake:76 (find_package) C:/Program Files/AMD/ROCm/5.7/lib/cmake/hipblas/hipblas-config.cmake:90 (find_dependency) CMakeLists.txt:392 (find_package) CMake Deprecation Warning at C:/Program Files/AMD/ROCm/5.7/lib/cmake/hip/hip-config-amd.cmake:21 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument value or use a ... suffix to tell CMake that the project does not need compatibility with older versions. Call Stack (most recent call first): C:/Program Files/AMD/ROCm/5.7/lib/cmake/hip/hip-config.cmake:150 (include) C:/Program Files/CMake/share/cmake-3.29/Modules/CMakeFindDependencyMacro.cmake:76 (find_package) C:/Program Files/AMD/ROCm/5.7/lib/cmake/hipblas/hipblas-config.cmake:90 (find_dependency) CMakeLists.txt:392 (find_package) -- hip::amdhip64 is SHARED_LIBRARY -- HIP and hipBLAS found -- CMAKE_SYSTEM_PROCESSOR: AMD64 -- x86 detected -- Configuring done (0.5s) -- Generating done (0.5s) -- Build files have been written to: C:/Users/newfl/Downloads/code/whisper.cpp/build ```

cmake --build build -j --config Release

```Shell PS C:\Users\newfl\Downloads\code\whisper.cpp> cmake --build build -j --config Release Microsoft (R) Build Engine versione 16.11.2+f32259642 per .NET Framework Copyright (C) Microsoft Corporation. Tutti i diritti sono riservati. 1>Checking Build System Building Custom Rule C:/Users/newfl/Downloads/code/whisper.cpp/CMakeLists.txt cl : warning della riga di comando D9002 : l'opzione sconosciuta '-x' verrà ignorata hip c1 : fatal error C1083: Non è possibile aprire il file origine: 'hip': No such file or directory [C:\Users\newfl\Downloads\code\whisper.cpp\build\whisper.vcxproj] ggml.c ggml-alloc.c ggml-backend.c ggml-quants.c Generazione del codice in corso... ```

ulatekh commented 1 month ago

Only LLVM is supported for HIP

Seems pretty obvious.

newfla commented 1 month ago

Is there a way to compile under windows enabling rocm? What I don't understand is why cmake ignores the CMAKE_C_COMPILER/CMAKE_CXX_COMPILER settings. 🤔

thewh1teagle commented 3 days ago

I tried also to compile with Rocm enabled using clang but it failed with other error

  1. I downloaded sdk from docs.amd.com

  2. Build in Powershell

    $env:ROCM_PATH = "C:\Program Files\Amd\ROCm\6.1"
    cmake -B build -DCMAKE_C_COMPILER="clang.exe" -DCMAKE_CXX_COMPILER="clang++.exe" -DAMDGPU_TARGETS="gfx" -DGGML_HIPBLAS=ON 
    cmake --build build -j16 
log ```console PS C:\Users\User\Documents\code\whisper.cpp> cmake -B build -DCMAKE_C_COMPILER="clang.exe" -DCMAKE_CXX_COMPILER="clang++.exe" -DAMDGPU_TARGETS="gfx" -DGGML_HIPBLAS=ON -- Building for: Visual Studio 17 2022 -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631. -- The C compiler identification is MSVC 19.39.33523.0 -- The CXX compiler identification is MSVC 19.39.33523.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.44.0.windows.1") -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - not found -- Found Threads: TRUE -- Found OpenMP_C: -openmp (found version "2.0") -- Found OpenMP_CXX: -openmp (found version "2.0") -- Found OpenMP: TRUE (found version "2.0") -- OpenMP found perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LC_ALL = (unset), (possibly more locale environment variables) LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the system default locale ("English_United States.1252"). perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LC_ALL = (unset), (possibly more locale environment variables) LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the system default locale ("English_United States.1252"). -- HIP and hipBLAS found -- ccache found, compilation results will be cached. Disable with GGML_CCACHE=OFF. -- CMAKE_SYSTEM_PROCESSOR: AMD64 -- CMAKE_GENERATOR_PLATFORM: -- x86 detected -- Performing Test HAS_AVX_1 -- Performing Test HAS_AVX_1 - Success -- Performing Test HAS_AVX2_1 -- Performing Test HAS_AVX2_1 - Success -- Performing Test HAS_FMA_1 -- Performing Test HAS_FMA_1 - Success -- Performing Test HAS_AVX512_1 -- Performing Test HAS_AVX512_1 - Failed -- Performing Test HAS_AVX512_2 -- Performing Test HAS_AVX512_2 - Failed -- Configuring done (15.4s) -- Generating done (0.2s) -- Build files have been written to: C:/Users/User/Documents/code/whisper.cpp/build PS C:\Users\User\Documents\code\whisper.cpp> cmake --build build -j16 MSBuild version 17.9.8+b34f75857 for .NET Framework 1>Checking Build System Building Custom Rule C:/Users/User/Documents/code/whisper.cpp/ggml/src/CMakeLists.txt cl : command line warning D9002: ignoring unknown option '-x' [C:\Users\User\Documents\code\whisper.cpp\build\ggml\src\ggml.vcxproj] cl : command line warning D9002: ignoring unknown option '--offload-arch=gfx' [C:\Users\User\Documents\code\whisper.cpp\build\ggml\src\ggml.vcxproj] hip ggml.c /hip(1,1): error C1083: Cannot open source file: 'hip': No such file or directory [C:\Users\User\Documents\code\whisper.cpp\build\ggml\src\ggml.vcxproj] (compiling source file '/hip') ggml-alloc.c ggml-backend.c ggml-quants.c Generating Code... ```