Page-size check prevents mmap for blob-aligned checkpoints
- Lenguaje dominante
- C++
- Estrellas
- 7k
- Forks
- 660
- Merge medio
- 20 h 43 min
- PR fusionados (30 d)
- 33
Descripción
## Problem
`ChooseMode` disables mmap when the checkpoint size is not divisible by the system page size, even if the file is padded to the blob format's 256-byte alignment.
For example, the 4B checkpoint is 5,401,208,832 bytes: divisible by 256, but with a 2,048-byte remainder on a 4,096-byte page system. It therefore falls back to copying the weights into allocated memory instead of using file-backed mappings.
## Proposed fix
Relax the file-length alignment requirement from the base page size to `kBlobAlign` (256 bytes).
The OS accepts partial-page mappings, but inference kernels can read multiple vectors ahead. Retain the blob-alignment guard and fall back to ordinary reads for lengths that do not meet it. Arbitrary-length mmap support would require separate handling of those reads.
Covered by #1032.
Guía de contribución
Línea de trabajo
Comienza en ChooseMode e inspecciona la comprobación de longitud del checkpoint que compara con el tamaño de página del sistema; después, sigue las rutas alternativas de mmap y de lectura ordinaria. La tarea estará terminada cuando las longitudes alineadas con blobs, como el checkpoint de 4B, puedan usar mapeos respaldados por archivos, mientras que las longitudes que no sean divisibles por kBlobAlign sigan usando lecturas ordinarias.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cpp
- Área
- machine-learning, performance
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Activo
- Claridad
- Bien especificado
- Aptitud para principiantes
- 75/100