-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
log: refine log function for Android #2071
base: master
Are you sure you want to change the base?
Conversation
WHISPER_ATTRIBUTE_FORMAT(2, 3) | ||
static void whisper_log_internal (ggml_log_level level, const char * format, ...); | ||
WHISPER_ATTRIBUTE_FORMAT(5, 6) | ||
static void whisper_log_internal (ggml_log_level level, const char * file, const char * func, int line, const char * format, ...); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add these three parameters at such a low level?
int len = vsnprintf(buffer, 1024, format, args); | ||
if (len < 1024) { | ||
int len_prefix = snprintf(buffer, 1024, "[%s, %d]: ", func, line); // param file not used in this file | ||
int len = vsnprintf(buffer + len_prefix, 1024 - len_prefix, format, args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if snprintf
fails due to an output error then this will write to an address before the buffer's start.
The macros |
are defined by Android NDK, not self-defined macro. so it will not bring side-effect to existing codes.
this PR is prepare for submit Qualcomm's QNN backend to upstream whisper.cpp from "PoC: Add Qualcomm mobile SoC native backend for GGML,zhouwg/kantv#121 ".
the first step is for whisper.cpp, then llama.cpp, because llama.cpp is much more complicated then whisper.cpp