]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : update stubs for systems without mmap and mlock (#1266)
authorxloem <redacted>
Mon, 1 May 2023 12:58:51 +0000 (08:58 -0400)
committerGitHub <redacted>
Mon, 1 May 2023 12:58:51 +0000 (15:58 +0300)
Co-authored-by: John Doe <redacted>
llama-util.h

index 5f9f70ecc2030473093d9b88159c8ecbc6c6b314..d531588d5801933edd5df6fdefdbbbc7595f9b31 100644 (file)
@@ -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) {}