Skip to content

Commit 9648436

Browse files
Fixed mmap prefetch for GPU offloading
1 parent 86c3219 commit 9648436

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llama-util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ struct llama_mmap {
219219
// prefetch/readahead impairs performance on NUMA systems
220220
if (numa) { prefetch = 0; }
221221
#ifdef __linux__
222-
if (prefetch) { flags |= MAP_POPULATE; }
222+
if (prefetch >= file->size) { flags |= MAP_POPULATE; }
223223
#endif
224224
addr = mmap(NULL, file->size, PROT_READ, flags, fd, 0);
225225
if (addr == MAP_FAILED) {

0 commit comments

Comments
 (0)