Repository: ggml-org/llama.cpp
Pull request: llama-model-loader: print warning when using overrides with mmap

## Overview

When using `mmap` which is enabled by default, tensor overrides don't get pinned memory. This PR skips the downgrade for overriden tensors. 

## Additional information

Before 

| model                          |       size |     params | backend    | ngl | n_ubatch | mmap |            test |                  t/s |
| ------------------------------ | ---------: | ---------: | ---------- | --: | -------: | ---: | --------------: | -------------------: |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |      128 |    0 |          pp2048 |        543.68 ± 4.84 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |      256 |    0 |          pp2048 |       973.01 ± 10.10 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |      512 |    0 |          pp2048 |      1700.75 ± 22.03 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |     1024 |    0 |          pp2048 |      2827.85 ± 18.51 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |     2048 |    0 |          pp2048 |      4097.78 ± 75.23 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |      128 |    1 |          pp2048 |        298.28 ± 4.26 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |      256 |    1 |          pp2048 |        546.08 ± 4.33 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |      512 |    1 |          pp2048 |        979.02 ± 4.78 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |     1024 |    1 |          pp2048 |      1708.17 ± 27.07 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |     2048 |    1 |          pp2048 |      2756.34 ± 36.39 |

After

| model                          |       size |     params | backend    | ngl | n_ubatch | mmap |            test |                  t/s |
| ------------------------------ | ---------: | ---------: | ---------- | --: | -------: | ---: | --------------: | -------------------: |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |      128 |    0 |          pp2048 |        539.51 ± 7.29 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |      256 |    0 |          pp2048 |       977.11 ± 10.41 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |      512 |    0 |          pp2048 |      1713.08 ± 16.35 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |     1024 |    0 |          pp2048 |      2838.30 ± 23.96 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |     2048 |    0 |          pp2048 |      4123.53 ± 36.17 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |      128 |    1 |          pp2048 |        548.10 ± 1.81 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |      256 |    1 |          pp2048 |       972.36 ± 26.46 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |      512 |    1 |          pp2048 |      1737.46 ± 10.71 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |     1024 |    1 |          pp2048 |      2814.28 ± 29.08 |
| gpt-oss 20B MXFP4 MoE          |  11.27 GiB |    20.91 B | CUDA       |  99 |     2048 |    1 |          pp2048 |      4114.94 ± 54.93 |


# Requirements

<!-- IMPORTANT: Please do NOT delete this section, otherwise your PR may be rejected -->

- I have read and agree with the [contributing guidelines](https://github.com/ggml-org/llama.cpp/blob/master/CONTRIBUTING.md)
- AI usage disclosure: YES, asked it to implement the fix after identifying the reason



Changed files:
filename: src/llama-model-loader.cpp
patch: @@ -1158,6 +1158,12 @@ struct ggml_tensor * llama_model_loader::create_tensor(
                     if (overrides->buft == ggml_backend_cpu_buffer_type()) {
                         // when overriding to a CPU buffer, consider the extra buffer types
                         buft = select_weight_buft(hparams, t_meta, op, buft_list_cpu);
+                        if (use_mmap) {
+                            static std::once_flag once;
+                            std::call_once(once, [] {
+                                LLAMA_LOG_WARN("llama_model_loader: tensor overrides to CPU are used with mmap enabled - consider using --no-mmap for better performance\n");
+                            });
+                        }
                     } else {
                         buft = overrides->buft;
                     }