diff --git a/src/llama-mmap.cpp b/src/llama-mmap.cpp index a615eb6ef9..31dc0aa442 100644 --- a/src/llama-mmap.cpp +++ b/src/llama-mmap.cpp @@ -457,14 +457,7 @@ llama_mmap_random_mode llama_mmap_random_mode_get() { } bool llama_mmap_random_prefetch_enabled() { - // on with the feature, so the batched readahead that pays for the random hints cannot be - // left off by accident. separate only so the two halves can be measured apart. - static const bool enabled = []() { - const char * env = getenv("LLAMA_MMAP_RANDOM_PREFETCH"); - return env == nullptr ? true : strcmp(env, "0") != 0; - }(); - - return llama_mmap_random_mode_get() != LLAMA_MMAP_RANDOM_OFF && enabled; + return llama_mmap_random_mode_get() != LLAMA_MMAP_RANDOM_OFF; } static size_t llama_mmap_page_size() { diff --git a/src/llama-mmap.h b/src/llama-mmap.h index 07a1f6f685..b0963dd391 100644 --- a/src/llama-mmap.h +++ b/src/llama-mmap.h @@ -87,7 +87,9 @@ enum llama_mmap_random_mode { llama_mmap_random_mode llama_mmap_random_mode_get(); -// whether batched readahead ahead of a sparse gather is enabled (LLAMA_MMAP_RANDOM_PREFETCH) +// batched readahead ahead of a sparse gather. not separately switchable: MADV_RANDOM suppresses +// the kernel's own readahead, so without this the gather takes a synchronous fault per row and +// runs 2.6x slower than leaving the mapping alone bool llama_mmap_random_prefetch_enabled(); struct llama_mlock {