whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

"Illegal instruction: 4" error on macOS-latest runner

Open chidiwilliams opened this issue 1 year ago • 2 comments

Running the binary on the Mac build:

            - name: Test
              run: |
                bash models/download-ggml-model.sh tiny
                ./main -m models/ggml-tiny.bin -f samples/jfk.wav

...raises the following error:

4062 Illegal instruction: 4  ./main -m models/ggml-tiny.bin -f samples/jfk.wav

PR: https://github.com/chidiwilliams/whisper.cpp/pull/1 Logs: https://github.com/chidiwilliams/whisper.cpp/actions/runs/3821890423/jobs/6501486479

I haven't yet been able to track down what line/function the error comes from, but I am fairly certain it was introduced by https://github.com/ggerganov/whisper.cpp/commit/ac521a566ea6a79ba968c30101140db9f65d187b.

chidiwilliams avatar Jan 02 '23 10:01 chidiwilliams

Thanks for reporting this.

I haven't yet been able to track down what line/function the error comes from, but I am fairly certain it was introduced by https://github.com/ggerganov/whisper.cpp/commit/ac521a566ea6a79ba968c30101140db9f65d187b.

I agree it's possible, but would be nice if we can confirm that.

It might be useful to add cat /proc/cpuinfo before building the project to see some information about the CPUs that the MacOS Github runner is using. Also, I just added some extra prints to the Makefile in 0be6a1afd9d6e7848ffc5917c2a66a3cd4eba53e - might give us some extra clue.

ggerganov avatar Jan 02 '23 11:01 ggerganov

From Makefile:

I whisper.cpp build info: 
I UNAME_S:  Darwin
I UNAME_P:  i3[8](https://github.com/chidiwilliams/whisper.cpp/actions/runs/3822437596/jobs/6502581233#step:4:9)6
I UNAME_M:  x86_64
I CFLAGS:   -I.              -O3 -std=c11   -fPIC -pthread -mfma -mf16c -mavx -DGGML_USE_ACCELERATE
I CXXFLAGS: -I. -I./examples -O3 -std=c++11 -fPIC -pthread
I LDFLAGS:   -framework Accelerate
I CC:       cc Apple clang version 14.0.0 (clang-1400.0.2[9](https://github.com/chidiwilliams/whisper.cpp/actions/runs/3822437596/jobs/6502581233#step:4:10).[10](https://github.com/chidiwilliams/whisper.cpp/actions/runs/3822437596/jobs/6502581233#step:4:11)2)
I CXX:      c++ Apple clang version [14](https://github.com/chidiwilliams/whisper.cpp/actions/runs/3822437596/jobs/6502581233#step:4:15).0.0 (clang-1400.0.29.102)

CPU:

> sysctl -a machdep.cpu
machdep.cpu.tsc_ccc.numerator: 0
machdep.cpu.tsc_ccc.denominator: 0
machdep.cpu.mwait.linesize_min: [6](https://github.com/chidiwilliams/whisper.cpp/actions/runs/3822437596/jobs/6502581233#step:5:7)4
machdep.cpu.mwait.linesize_max: 4096
machdep.cpu.mwait.extensions: 3
machdep.cpu.mwait.sub_Cstates: 16
machdep.cpu.thermal.sensor: 0
machdep.cpu.thermal.dynamic_acceleration: 0
machdep.cpu.thermal.invariant_APIC_timer: 1
machdep.cpu.thermal.thresholds: 0
machdep.cpu.thermal.ACNT_MCNT: 0
machdep.cpu.thermal.core_power_limits: 0
machdep.cpu.thermal.fine_grain_clock_mod: 0
machdep.cpu.thermal.package_thermal_intr: 0
machdep.cpu.thermal.hardware_feedback: 0
machdep.cpu.thermal.energy_policy: 0
machdep.cpu.xsave.extended_state: [7](https://github.com/chidiwilliams/whisper.cpp/actions/runs/3822437596/jobs/6502581233#step:5:8) [8](https://github.com/chidiwilliams/whisper.cpp/actions/runs/3822437596/jobs/6502581233#step:5:9)32 832 0
machdep.cpu.xsave.extended_state1: 0 0 0 0
machdep.cpu.arch_perf.version: 1
machdep.cpu.arch_perf.number: 8
machdep.cpu.arch_perf.width: 48
machdep.cpu.arch_perf.events_number: 7
machdep.cpu.arch_perf.events: 255
machdep.cpu.arch_perf.fixed_number: 0
machdep.cpu.arch_perf.fixed_width: 0
machdep.cpu.cache.linesize: 64
machdep.cpu.cache.L2_associativity: 8
machdep.cpu.cache.size: 256
machdep.cpu.tlb.inst.small: 128
machdep.cpu.tlb.inst.large: 8
machdep.cpu.tlb.data.small: 64
machdep.cpu.tlb.shared: 512
machdep.cpu.address_bits.physical: 43
machdep.cpu.address_bits.virtual: 48
machdep.cpu.max_basic: 13
machdep.cpu.max_ext: 2147483656
machdep.cpu.vendor: GenuineIntel
machdep.cpu.brand_string: Intel(R) Xeon(R) CPU E5-1650 v2 @ 3.50GHz
machdep.cpu.family: 6
machdep.cpu.model: 58
machdep.cpu.extmodel: 3
machdep.cpu.extfamily: 0
machdep.cpu.stepping: [9](https://github.com/chidiwilliams/whisper.cpp/actions/runs/3822437596/jobs/6502581233#step:5:10)
machdep.cpu.feature_bits: 18427078393948011519
machdep.cpu.leaf7_feature_bits: 643 0
machdep.cpu.leaf7_feature_bits_edx: 3154117632
machdep.cpu.extfeature_bits: 4967[10](https://github.com/chidiwilliams/whisper.cpp/actions/runs/3822437596/jobs/6502581233#step:5:11)6816
machdep.cpu.signature: 1983[13](https://github.com/chidiwilliams/whisper.cpp/actions/runs/3822437596/jobs/6502581233#step:5:14)
machdep.cpu.brand: 0
machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH MMX FXSR SSE SSE2 SS HTT SSE3 PCLMULQDQ MON VMX SSSE3 CX[16](https://github.com/chidiwilliams/whisper.cpp/actions/runs/3822437596/jobs/6502581233#step:5:17) SSE4.1 SSE4.2 x2APIC POPCNT AES VMM PCID XSAVE OSXSAVE TSCTMR AVX1.0 RDRAND F16C
machdep.cpu.leaf7_features: RDWRFSGS TSC_THREAD_OFFSET SMEP ERMS MDCLEAR IBRS STIBP L1DF ACAPMSR SSBD
machdep.cpu.extfeatures: SYSCALL XD EM64T LAHF RDTSCP TSCI
machdep.cpu.logical_per_package: 4
machdep.cpu.cores_per_package: 4
machdep.cpu.microcode_version: 1070
machdep.cpu.processor_flag: 0
machdep.cpu.core_count: 3
machdep.cpu.thread_count: 3

chidiwilliams avatar Jan 02 '23 12:01 chidiwilliams

The CPU does not support FMA. I believe this should be fixed now thanks to 322f4e6c4ea8f8b3526bb6cebce0113cd157fe62

ggerganov avatar Jan 06 '23 17:01 ggerganov

Works, thanks.

chidiwilliams avatar Jan 08 '23 15:01 chidiwilliams