aboutsummaryrefslogtreecommitdiff
path: root/llama-util.h
diff options
context:
space:
mode:
authorJohannes Gäßler <johannesg@5d6.de>2023-08-07 10:09:40 +0200
committerGitHub <noreply@github.com>2023-08-07 10:09:40 +0200
commit3d9a55181603e85a26378a850a14068034e5002d (patch)
tree7053da3c2538ae03ba6ca3c36b84f7b3252df721 /llama-util.h
parentf6f9896ac3d2ff207e18f87dab85d126ceef5236 (diff)
Fixed mmap prefetch for GPU offloading (#2529)
Diffstat (limited to 'llama-util.h')
-rw-r--r--llama-util.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/llama-util.h b/llama-util.h
index 3fc03ce..6e9e39d 100644
--- a/llama-util.h
+++ b/llama-util.h
@@ -219,7 +219,7 @@ struct llama_mmap {
// prefetch/readahead impairs performance on NUMA systems
if (numa) { prefetch = 0; }
#ifdef __linux__
- if (prefetch) { flags |= MAP_POPULATE; }
+ if (prefetch >= file->size) { flags |= MAP_POPULATE; }
#endif
addr = mmap(NULL, file->size, PROT_READ, flags, fd, 0);
if (addr == MAP_FAILED) {