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

Segmentation fault - Illegal instruction

Open rbarreiros opened this issue 9 months ago • 1 comments

Hello,

I'm having a weird problem, I'm using Visual Studio 2022 community edition, on windows 10, and I'm getting a seg fault on different places (both in whisper.dll) running the examples.

bench.exe throws an illegal exception on

Unhandled exception at 0x00007FFEDA3B25E7 (whisper.dll) in bench.exe: 0xC000001D: Illegal Instruction.

on ggml.c, line 1696 on ggml_vec_dot_f16

        sum[j] = GGML_F16_VEC_FMA(sum[j], ax[j], ay[j]);

Stack Trace

>	whisper.dll!ggml_vec_dot_f16(int n, float * s, unsigned __int64 bs, unsigned short * x, unsigned __int64 bx, unsigned short * y, unsigned __int64 by, int nrc) Line 1696	C
 	whisper.dll!ggml_compute_forward_mul_mat(const ggml_compute_params * params, ggml_tensor * dst) Line 12063	C
 	whisper.dll!ggml_compute_forward(ggml_compute_params * params, ggml_tensor * tensor) Line 17420	C
 	whisper.dll!ggml_graph_compute_thread(void * data) Line 19586	C
 	kernel32.dll!00007fff821c7344()	Unknown
 	ntdll.dll!00007fff828e26b1()	Unknown

Locals:


 | Name | Value | Type -- | -- | -- | --
 | ax | 0x0000003109bff000 {{m256_f32=0x0000003109bff000 {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, ...} }, ...} | __m256[4]
 | ay | 0x0000003109bff0a0 {{m256_f32=0x0000003109bff0a0 {0.0348205566, 0.0622253418, 0.0681152344, -0.0391235352, ...} }, ...} | __m256[4]
 | bs | 0 | unsigned __int64
 | bx | 0 | unsigned __int64
 | by | 0 | unsigned __int64
 | i | 0 | int
 | j | 0 | int
 | n | 240 | int
 | np | 224 | const int
 | nrc | 1 | int
 | s | 0x0000003109bff3d0 {-107374176.} | float *
 | sum | 0x0000003109bfef60 {{m256_f32=0x0000003109bfef60 {0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, ...} }, ...} | __m256[4]
 | sumf | 0.0000000000000000 | double
 | x | 0x000001c167b424c0 {0} | unsigned short *
 | y | 0x000001c156ebb080 {10357} | unsigned short *

On command.exe (using SDL2 2.30.3 for VC (I tried bench.exe without SDL2, same result)

Unhandled exception at 0x00007FFEDED8C828 (whisper.dll) in command.exe: 0xC000001D: Illegal Instruction.

on regex standard header, void _Mark(_Elem _Ch)

template <class _Elem>
void _Mark(_Elem _Ch) { // mark character _Ch
    static_assert(is_unsigned_v<_Elem>, "_Elem must be unsigned");
    unsigned int _Wide = _Ch;
    _Chrs[_Wide >> _Bmp_shift] |= (1 << (_Wide & _Bmp_mask)); <--------------- seg fault
}

Stack Trace

>	whisper.dll!std::_Bitmap::_Mark<unsigned int>(unsigned int _Ch) Line 1315	C++
 	whisper.dll!std::_Builder<char const *,char,std::regex_traits<char>>::_Add_elts(std::_Node_class<char,std::regex_traits<char>> * _Node, short _Cl, bool _Negate) Line 2953	C++
 	whisper.dll!std::_Builder<char const *,char,std::regex_traits<char>>::_Add_named_class(short _Cl, bool _Negate) Line 2961	C++
 	whisper.dll!std::_Parser<char const *,char,std::regex_traits<char>>::_Do_ex_class(std::_Meta_type _End_arg) Line 4009	C++
 	whisper.dll!std::_Parser<char const *,char,std::regex_traits<char>>::_ClassAtom() Line 4081	C++
 	whisper.dll!std::_Parser<char const *,char,std::regex_traits<char>>::_ClassRanges() Line 4100	C++
 	whisper.dll!std::_Parser<char const *,char,std::regex_traits<char>>::_CharacterClass() Line 4152	C++
 	whisper.dll!std::_Parser<char const *,char,std::regex_traits<char>>::_Alternative() Line 4436	C++
 	whisper.dll!std::_Parser<char const *,char,std::regex_traits<char>>::_Disjunction() Line 4484	C++
 	whisper.dll!std::_Parser<char const *,char,std::regex_traits<char>>::_Compile() Line 4563	C++
 	whisper.dll!std::basic_regex<char,std::regex_traits<char>>::_Reset<char const *>(const char * _First, const char * _Last, std::regex_constants::syntax_option_type _Flags) Line 2037	C++
 	whisper.dll!std::basic_regex<char,std::regex_traits<char>>::basic_regex<char,std::regex_traits<char>><std::char_traits<char>,std::allocator<char>>(const std::string & _Str, std::regex_constants::syntax_option_type _Flags) Line 1853	C++
 	whisper.dll!tokenize(const whisper_vocab & vocab, const std::string & text) Line 3152	C++
 	whisper.dll!whisper_tokenize(whisper_context * ctx, const char * text, int * tokens, int n_max_tokens) Line 3827	C++
 	whisper.dll!whisper_full_with_state(whisper_context * ctx, whisper_state * state, whisper_full_params params, const float * samples, int n_samples) Line 5440	C++
 	whisper.dll!whisper_full(whisper_context * ctx, whisper_full_params params, const float * samples, int n_samples) Line 6195	C++
 	command.exe!transcribe(whisper_context * ctx, const whisper_params & params, const std::vector<float,std::allocator<float>> & pcmf32, const std::string & grammar_rule, float & logprob_min, float & logprob_sum, int & n_tokens, __int64 & t_ms) Line 194	C++
 	command.exe!process_general_transcription(whisper_context * ctx, audio_async & audio, const whisper_params & params) Line 604	C++
 	command.exe!SDL_main(int argc, char * * argv) Line 772	C++
 	command.exe!main_getcmdline() Line 80	C
 	command.exe!invoke_main() Line 79	C++
 	command.exe!__scrt_common_main_seh() Line 288	C++
 	command.exe!__scrt_common_main() Line 331	C++
 	command.exe!mainCRTStartup(void * __formal) Line 17	C++
 	kernel32.dll!00007fff821c7344()	Unknown
 	ntdll.dll!00007fff828e26b1()	Unknown

Locals

  | Name | Value | Type -- | -- | -- | --
  | this | 0x0000018e91d74cf0 {_Chrs=0x0000018e91d74cf0 "" } | std::_Bitmap *
  | _Ch | 65 | unsigned int
  | _Wide | 65 | unsigned int

Completely oblivious to what's going on, I'm positive they're related, but I can't figure out why. This is a fresh git clone, only used SDL2 for command.exe, bench.exe was tested without SDL2 complete clean rebuild, same result.... Any idea on what's the issue, or how can I better debug this ?

rbarreiros avatar May 20 '24 11:05 rbarreiros