ggml : minor
This commit is contained in:
parent
e0eba91bea
commit
b6434356ed
2 changed files with 6 additions and 11 deletions
12
ggml-metal.m
12
ggml-metal.m
|
@ -122,15 +122,15 @@ static NSString * const msl_library_source = @"see metal.metal";
|
||||||
@end
|
@end
|
||||||
|
|
||||||
ggml_log_callback ggml_metal_log_callback = NULL;
|
ggml_log_callback ggml_metal_log_callback = NULL;
|
||||||
void *ggml_metal_log_user_data = NULL;
|
void * ggml_metal_log_user_data = NULL;
|
||||||
|
|
||||||
void ggml_metal_log_set_callback(ggml_log_callback log_callback, void * user_data) {
|
void ggml_metal_log_set_callback(ggml_log_callback log_callback, void * user_data) {
|
||||||
ggml_metal_log_callback = log_callback;
|
ggml_metal_log_callback = log_callback;
|
||||||
ggml_metal_log_user_data = user_data;
|
ggml_metal_log_user_data = user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ggml_metal_log(enum ggml_log_level level, const char* format, ...){
|
static void ggml_metal_log(enum ggml_log_level level, const char* format, ...){
|
||||||
if ( ggml_metal_log_callback != NULL ) {
|
if (ggml_metal_log_callback != NULL) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
|
@ -208,7 +208,7 @@ struct ggml_metal_context * ggml_metal_init(int n_cb) {
|
||||||
|
|
||||||
//NSString * path = [[NSBundle mainBundle] pathForResource:@"../../examples/metal/metal" ofType:@"metal"];
|
//NSString * path = [[NSBundle mainBundle] pathForResource:@"../../examples/metal/metal" ofType:@"metal"];
|
||||||
NSBundle * bundle = [NSBundle bundleForClass:[GGMLMetalClass class]];
|
NSBundle * bundle = [NSBundle bundleForClass:[GGMLMetalClass class]];
|
||||||
NSString * path = [bundle pathForResource:@"ggml-metal" ofType:@"metal"];
|
NSString * path = [bundle pathForResource:@"ggml-metal" ofType:@"metal"];
|
||||||
GGML_METAL_LOG_INFO("%s: loading '%s'\n", __func__, [path UTF8String]);
|
GGML_METAL_LOG_INFO("%s: loading '%s'\n", __func__, [path UTF8String]);
|
||||||
|
|
||||||
NSString * src = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error];
|
NSString * src = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error];
|
||||||
|
@ -518,7 +518,7 @@ bool ggml_metal_add_buffer(
|
||||||
ctx->device.recommendedMaxWorkingSetSize / 1024.0 / 1024.0);
|
ctx->device.recommendedMaxWorkingSetSize / 1024.0 / 1024.0);
|
||||||
|
|
||||||
if (ctx->device.currentAllocatedSize > ctx->device.recommendedMaxWorkingSetSize) {
|
if (ctx->device.currentAllocatedSize > ctx->device.recommendedMaxWorkingSetSize) {
|
||||||
GGML_METAL_LOG_WARN("%s: warning: current allocated size is greater than the recommended max working set size\n", __func__);
|
GGML_METAL_LOG_WARN(", warning: current allocated size is greater than the recommended max working set size\n", __func__);
|
||||||
} else {
|
} else {
|
||||||
GGML_METAL_LOG_INFO("\n");
|
GGML_METAL_LOG_INFO("\n");
|
||||||
}
|
}
|
||||||
|
@ -1039,7 +1039,7 @@ void ggml_metal_graph_compute(
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
GGML_METAL_LOG_ERROR("Asserting on type %d\n",(int)src0t);
|
GGML_METAL_LOG_ERROR("Asserting on type %d\n", (int)src0t);
|
||||||
GGML_ASSERT(false && "not implemented");
|
GGML_ASSERT(false && "not implemented");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
5
ggml.h
5
ggml.h
|
@ -1688,11 +1688,6 @@ extern "C" {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (*ggml_opt_callback)(void * data, float * sched);
|
typedef void (*ggml_opt_callback)(void * data, float * sched);
|
||||||
// Signature for logging events
|
|
||||||
// Note that text includes the new line character at the end for most events.
|
|
||||||
// If your logging mechanism cannot handle that, check if the last character is '\n' and strip it
|
|
||||||
// if it exists.
|
|
||||||
// It might not exist for progress report where '.' is output repeatedly.
|
|
||||||
typedef void (*ggml_log_callback)(enum ggml_log_level level, const char * text, void * user_data);
|
typedef void (*ggml_log_callback)(enum ggml_log_level level, const char * text, void * user_data);
|
||||||
|
|
||||||
// optimization parameters
|
// optimization parameters
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue