If there were some notify-mechanism, let the caller know something wrong and stop calling, things may better.
AddressSanitizer:DEADLYSIGNAL
=================================================================
AddressSanitizerAddressSanitizer:DEADLYSIGNAL
:DEADLYSIGNAL
==12302==ERROR: AddressSanitizer: SEGV on unknown address 0x7f8f73625100 (pc 0x5559a8b6b1cf bp 0x7f8f997679f0 sp 0x7f8f997679a0 T30)
==12302==The signal is caused by a WRITE memory access.
AddressSanitizer:DEADLYSIGNAL
#0 0x5559a8b6b1ce in gcpp::N_AVX2::Attention<gcpp::ConfigGemma2B, 16ul>(unsigned long, unsigned long, unsigned long, gcpp::Activations<gcpp::ConfigGemma2B, 16ul>&, gcpp::CompressedLayer<gcpp::ConfigGemma2B> const*, gcpp::KVCache&, hwy::ThreadPool&)::{lambda(unsigned long, unsigned long)#1}::operator()(unsigned long, unsigned long) const (/path/to/gemma.qt/gemma+0x541ce)
#1 0x5559a8b44ffa in hwy::ParallelFor::WorkerRun(unsigned long, unsigned long, hwy::PoolMem&) gemma.cpp/build/_deps/highway-src/hwy/contrib/thread_pool/thread_pool.h:525
#2 0x5559a8b451ef in hwy::ThreadPool::ThreadFunc(unsigned long, unsigned long, hwy::PoolMem*) gemma.cpp/build/_deps/highway-src/hwy/contrib/thread_pool/thread_pool.h:585
#3 0x5559a8b4d238 in void std::__invoke_impl<void, void (*)(unsigned long, unsigned long, hwy::PoolMem*), unsigned long, unsigned long, hwy::PoolMem*>(std::__invoke_other, void (*&&)(unsigned long, unsigned long, hwy::PoolMem*), unsigned long&&, unsigned long&&, hwy::PoolMem*&&) (/path/to/gemma.qt/gemma+0x36238)
#4 0x5559a8b4d115 in std::__invoke_result<void (*)(unsigned long, unsigned long, hwy::PoolMem*), unsigned long, unsigned long, hwy::PoolMem*>::type std::__invoke<void (*)(unsigned long, unsigned long, hwy::PoolMem*), unsigned long, unsigned long, hwy::PoolMem*>(void (*&&)(unsigned long, unsigned long, hwy::PoolMem*), unsigned long&&, unsigned long&&, hwy::PoolMem*&&) (/path/to/gemma.qt/gemma+0x36115)
#5 0x5559a8b4cff4 in void std::thread::_Invoker<std::tuple<void (*)(unsigned long, unsigned long, hwy::PoolMem*), unsigned long, unsigned long, hwy::PoolMem*> >::_M_invoke<0ul, 1ul, 2ul, 3ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) (/path/to/gemma.qt/gemma+0x35ff4)
#6 0x5559a8b4cf73 in std::thread::_Invoker<std::tuple<void (*)(unsigned long, unsigned long, hwy::PoolMem*), unsigned long, unsigned long, hwy::PoolMem*> >::operator()() (/path/to/gemma.qt/gemma+0x35f73)
#7 0x5559a8b4cf53 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned long, unsigned long, hwy::PoolMem*), unsigned long, unsigned long, hwy::PoolMem*> > >::_M_run() (/path/to/gemma.qt/gemma+0x35f53)
#8 0x7f8fb8cc4df3 (/lib/x86_64-linux-gnu/libstdc++.so.6+0xd6df3)
#9 0x7f8fb8dd8608 in start_thread /build/glibc-wuryBv/glibc-2.31/nptl/pthread_create.c:477
#10 0x7f8fb89a5352 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x11f352)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/path/to/gemma.qt/gemma+0x541ce) in gcpp::N_AVX2::Attention<gcpp::ConfigGemma2B, 16ul>(unsigned long, unsigned long, unsigned long, gcpp::Activations<gcpp::ConfigGemma2B, 16ul>&, gcpp::CompressedLayer<gcpp::ConfigGemma2B> const*, gcpp::KVCache&, hwy::ThreadPool&)::{lambda(unsigned long, unsigned long)#1}::operator()(unsigned long, unsigned long) const
Thread T30 (worker003) created by T26 (GemmaThread) here:
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer: nested bug in the same thread, aborting.
I am running a program to summarize a couple of texts, once a part.
(Factly, I am parse a c++ source file that has many functions, function by function.)
When the conversation is too long , the #98 occurs, and Gemma stop to call
Transformer().But, the caller do not know this. It keeping calling
GenerateGemma()who will callPrefill()andAttention().Finally lead to
Memory Access Error.If there were some notify-mechanism, let the caller know something wrong and stop calling, things may better.