Skip to content

OpenCL support via CLBlast does not build on MacOS 13.3 Intel #888

@homocomputeris

Description

@homocomputeris

Cannot build with OpenCL support on MacOS Intel.
Related to #863

System

13.3.1 (a) (22E772610a)
22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:17 PST 2023; root:xnu-8796.101.5~3/RELEASE_X86_64 x86_64

Make

Install clblast from brew

user@pc ~/Documents/Code/whisper.cpp (git)-[master] % git pull
Already up to date.

user@pc ~/Documents/Code/whisper.cpp (git)-[master] % brew install clblast
==> Downloading https://formulae.brew.sh/api/formula.jws.json
#=#=#                                                                            
==> Downloading https://formulae.brew.sh/api/cask.jws.json
#=#=#                                                                            
==> Fetching clblast
==> Downloading https://ghcr.io/v2/homebrew/core/clblast/blobs/sha256:1129b3155dca
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/2a2c4fcfd2e4834fe27efd3802df3b4b6cf67522658c4c114e78d01e26f20a06--clblast--1.5.3_1.ventura.bottle.tar.gz
==> Pouring clblast--1.5.3_1.ventura.bottle.tar.gz
🍺  /usr/local/Cellar/clblast/1.5.3_1: 41 files, 11.6MB
==> Running `brew cleanup clblast`...
brew install clblast  5.00s user 1.86s system 74% cpu 9.202 total

Build

user@pc ~/Documents/Code/whisper.cpp (git)-[master] % make clean
sysctl: unknown oid 'hw.optional.arm64'
I whisper.cpp build info: 
I UNAME_S:  Darwin
I UNAME_P:  i386
I UNAME_M:  x86_64
I CFLAGS:   -I.              -O3 -DNDEBUG -std=c11   -fPIC -pthread -mf16c -mfma -mavx -mavx2 -DGGML_USE_ACCELERATE
I CXXFLAGS: -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread
I LDFLAGS:   -framework Accelerate
I CC:       Apple clang version 14.0.3 (clang-1403.0.22.14.1)
I CXX:      Apple clang version 14.0.3 (clang-1403.0.22.14.1)

rm -f *.o main stream command talk talk-llama bench quantize libwhisper.a libwhisper.so

user@pc ~/Documents/Code/whisper.cpp (git)-[master] % WHISPER_CLBLAST=1 make -j
sysctl: unknown oid 'hw.optional.arm64'
I whisper.cpp build info: 
I UNAME_S:  Darwin
I UNAME_P:  i386
I UNAME_M:  x86_64
I CFLAGS:   -I.              -O3 -DNDEBUG -std=c11   -fPIC -pthread -mf16c -mfma -mavx -mavx2 -DGGML_USE_ACCELERATE -DGGML_USE_CLBLAST
I CXXFLAGS: -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread
I LDFLAGS:   -framework Accelerate -lclblast -lOpenCL
I CC:       Apple clang version 14.0.3 (clang-1403.0.22.14.1)
I CXX:      Apple clang version 14.0.3 (clang-1403.0.22.14.1)

cc  -I.              -O3 -DNDEBUG -std=c11   -fPIC -pthread -mf16c -mfma -mavx -mavx2 -DGGML_USE_ACCELERATE -DGGML_USE_CLBLAST   -c ggml.c -o ggml.o
cc -I.              -O3 -DNDEBUG -std=c11   -fPIC -pthread -mf16c -mfma -mavx -mavx2 -DGGML_USE_ACCELERATE -DGGML_USE_CLBLAST -c ggml-opencl.c -o ggml-opencl.o
c++ -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread -c whisper.cpp -o whisper.o
ggml.c:4406:9: error: call to undeclared function 'ggml_cl_init'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        ggml_cl_init();
        ^
ggml.c:4406:9: note: did you mean 'ggml_init'?
ggml.c:4357:23: note: 'ggml_init' declared here
struct ggml_context * ggml_init(struct ggml_init_params params) {
                      ^
ggml.c:8319:17: error: call to undeclared function 'ggml_cl_sgemm_wrapper'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                ^
ggml.c:8319:39: error: use of undeclared identifier 'GGML_BLAS_ORDER_ROW_MAJOR'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                      ^
ggml.c:8319:66: error: use of undeclared identifier 'GGML_BLAS_OP_N'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                                                 ^
ggml.c:8319:82: error: use of undeclared identifier 'GGML_BLAS_OP_T'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                                                                 ^
ggml.c:8509:17: error: call to undeclared function 'ggml_cl_sgemm_wrapper'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                ^
ggml.c:8509:39: error: use of undeclared identifier 'GGML_BLAS_ORDER_ROW_MAJOR'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                      ^
ggml.c:8509:66: error: use of undeclared identifier 'GGML_BLAS_OP_N'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                                                 ^
ggml.c:8509:82: error: use of undeclared identifier 'GGML_BLAS_OP_T'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                                                                 ^
ggml.c:8733:17: error: call to undeclared function 'ggml_cl_sgemm_wrapper'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                ^
ggml.c:8733:39: error: use of undeclared identifier 'GGML_BLAS_ORDER_ROW_MAJOR'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                      ^
ggml.c:8733:66: error: use of undeclared identifier 'GGML_BLAS_OP_N'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                                                 ^
ggml.c:8733:82: error: use of undeclared identifier 'GGML_BLAS_OP_T'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                                                                 ^
13 errors generated.
make: *** [ggml.o] Error 1
make: *** Waiting for unfinished jobs....
WHISPER_CLBLAST=1 make -j  11.38s user 1.25s system 118% cpu 10.646 total
2 user@pc ~/Documents/Code/whisper.cpp (git)-[master] % 

CMake

user@pc ~/Documents/Code/whisper.cpp (git)-[master] % mkdir build ; cd build

user@pc ~/Documents/Code/whisper.cpp/build (git)-[master] %  cmake -DWHISPER_CLBLAST=ON  ..
130 user@pc ~/Documents/Code/whisper.cpp/build (git)-[master] %  brew install cmake
==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################################################## 100.0%
Warning: Treating cmake as a formula. For the cask, use homebrew/cask/cmake
==> Fetching cmake
==> Downloading https://ghcr.io/v2/homebrew/core/cmake/manifests/3.26.3
######################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/cmake/blobs/sha256:18311d1301859a355497a7f02d45d1988083ae1ee7a
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:18311d1301859a355497a7f02d
######################################################################################################## 100.0%
==> Pouring cmake--3.26.3.ventura.bottle.tar.gz
==> Caveats
To install the CMake documentation, run:
  brew install cmake-docs

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/cmake
==> Summary
🍺  /usr/local/Cellar/cmake/3.26.3: 3,188 files, 49.8MB
==> Running `brew cleanup cmake`...
brew install cmake  4.62s user 3.76s system 61% cpu 13.585 total

user@pc ~/Documents/Code/whisper.cpp/build (git)-[master] %  cmake -DWHISPER_CLBLAST=ON  ..
-- The C compiler identification is AppleClang 14.0.3.14030022
-- The CXX compiler identification is AppleClang 14.0.3.14030022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - 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: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/local/bin/git (found version "2.40.1") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Accelerate framework found
-- CLBlast found
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- x86 detected
-- Configuring done (1.3s)
-- Generating done (0.1s)
-- Build files have been written to: /Users/user/Documents/Code/whisper.cpp/build

user@pc ~/Documents/Code/whisper.cpp/build (git)-[master] %  make clean                    

user@pc ~/Documents/Code/whisper.cpp/build (git)-[master] %  make -j
[ 23%] Building CXX object CMakeFiles/whisper.dir/whisper.cpp.o
[ 23%] Building C object CMakeFiles/whisper.dir/ggml-opencl.c.o
[ 23%] Building C object CMakeFiles/whisper.dir/ggml.c.o
/Users/user/Documents/Code/whisper.cpp/ggml.c:4406:9: error: call to undeclared function 'ggml_cl_init'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        ggml_cl_init();
        ^
/Users/user/Documents/Code/whisper.cpp/ggml.c:4406:9: note: did you mean 'ggml_init'?
/Users/user/Documents/Code/whisper.cpp/ggml.c:4357:23: note: 'ggml_init' declared here
struct ggml_context * ggml_init(struct ggml_init_params params) {
                      ^
/Users/user/Documents/Code/whisper.cpp/ggml.c:8319:17: error: call to undeclared function 'ggml_cl_sgemm_wrapper'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                ^
/Users/user/Documents/Code/whisper.cpp/ggml.c:8319:39: error: use of undeclared identifier 'GGML_BLAS_ORDER_ROW_MAJOR'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                      ^
/Users/user/Documents/Code/whisper.cpp/ggml.c:8319:66: error: use of undeclared identifier 'GGML_BLAS_OP_N'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                                                 ^
/Users/user/Documents/Code/whisper.cpp/ggml.c:8319:82: error: use of undeclared identifier 'GGML_BLAS_OP_T'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                                                                 ^
/Users/user/Documents/Code/whisper.cpp/ggml.c:8509:17: error: call to undeclared function 'ggml_cl_sgemm_wrapper'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                ^
/Users/user/Documents/Code/whisper.cpp/ggml.c:8509:39: error: use of undeclared identifier 'GGML_BLAS_ORDER_ROW_MAJOR'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                      ^
/Users/user/Documents/Code/whisper.cpp/ggml.c:8509:66: error: use of undeclared identifier 'GGML_BLAS_OP_N'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                                                 ^
/Users/user/Documents/Code/whisper.cpp/ggml.c:8509:82: error: use of undeclared identifier 'GGML_BLAS_OP_T'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                                                                 ^
/Users/user/Documents/Code/whisper.cpp/ggml.c:8733:17: error: call to undeclared function 'ggml_cl_sgemm_wrapper'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                ^
/Users/user/Documents/Code/whisper.cpp/ggml.c:8733:39: error: use of undeclared identifier 'GGML_BLAS_ORDER_ROW_MAJOR'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                      ^
/Users/user/Documents/Code/whisper.cpp/ggml.c:8733:66: error: use of undeclared identifier 'GGML_BLAS_OP_N'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                                                 ^
/Users/user/Documents/Code/whisper.cpp/ggml.c:8733:82: error: use of undeclared identifier 'GGML_BLAS_OP_T'
                ggml_cl_sgemm_wrapper(GGML_BLAS_ORDER_ROW_MAJOR, GGML_BLAS_OP_N, GGML_BLAS_OP_T,
                                                                                 ^
13 errors generated.
make[2]: *** [CMakeFiles/whisper.dir/ggml.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/whisper.dir/all] Error 2
make: *** [all] Error 2
make -j  7.66s user 0.47s system 116% cpu 6.979 total

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions