From: xloem Date: Mon, 1 May 2023 12:58:51 +0000 (-0400) Subject: llama : update stubs for systems without mmap and mlock (#1266) X-Git-Tag: gguf-v0.4.0~828 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=ea3a0ad6b6b5ca4693b94acd4cb32e2803f66fae;p=pkg%2Fggml%2Fsources%2Fllama.cpp llama : update stubs for systems without mmap and mlock (#1266) Co-authored-by: John Doe --- diff --git a/llama-util.h b/llama-util.h index 5f9f70ec..d531588d 100644 --- a/llama-util.h +++ b/llama-util.h @@ -243,7 +243,8 @@ struct llama_mmap { #else static constexpr bool SUPPORTED = false; - llama_mmap(struct llama_file *) { + llama_mmap(struct llama_file *, bool prefetch = true) { + (void)prefetch; throw std::string("mmap not supported"); } #endif @@ -382,8 +383,13 @@ struct llama_mlock { #else static constexpr bool SUPPORTED = false; - void raw_lock(const void * addr, size_t size) { + size_t lock_granularity() { + return (size_t) 65536; + } + + bool raw_lock(const void * addr, size_t size) { fprintf(stderr, "warning: mlock not supported on this system\n"); + return false; } void raw_unlock(const void * addr, size_t size) {}