Metal cache admission can exceed the configured cache limit
Los mantenedores suelen responder en 3 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- cpp
- Área
- backend, performance
Línea de trabajo
Start by locating MetalAllocator::free() and the cache limit checks described in the issue. Reproduce the oversized and mixed allocation cases with the allocator tests, then inspect the linked pull request #4842 for the two-file fix and regression coverage. Done means freed buffers respect the configured limit, including zero, and the reported reuse cases are covered.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
MetalAllocator::free() checks the current cache size before admitting the incoming buffer, without including that buffer's length. This can exceed set_cache_limit() as soon as a live allocation is released.
On Apple M1 Max, using current main 9f806b3606eaa9f7c807238f6bd465185cd94d6d:
- Set the cache limit to 1 MiB and clear it.
- Allocate and release a 2 MiB buffer:
get_cache_memory()reports 2,097,152 bytes. - Clear it, hold a 512 KiB allocation while allocating/releasing a 768 KiB allocation, then release the 512 KiB allocation: the cache reaches 1,310,720 bytes with a 1,048,576-byte limit.
No later allocation is made before inspecting each overshoot. The checks use allocator::malloc directly, so shader execution and asynchronous command completion are not involved in the reproduction.
Expected: an incoming buffer larger than the allowance should not enter the cache. A smaller incoming buffer should be admitted only after enough older cached bytes are released. Zero should continue to disable reuse. This concerns the freed-buffer cache, not a limit on active allocations or total process memory.
I have a small two-file fix and regression test covering oversized admission, mixed shapes, recent-shape reuse and zero allowance.
- Lenguaje dominante
- C++
- Estrellas
- 29.1k
- Forks
- 2.4k
- Merge medio
- 3 d 20 h
- PR fusionados (30 d)
- 103
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ml-explore/mlx
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
ml-explore/mlx#4832 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
[BUG] `mx.expand_dims` docs: the Args section names `axes`, but the parameter is `axis`Posiblemente ocupada @Redempt1onzzZZ la tomó hace 3 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
ml-explore/mlx#4829 ·
Los mantenedores suelen responder en 3 días
-
[BUG] `mx.qqmm` docs: the Args section names `global_scale`, but the parameter is `global_scale_x`Posiblemente ocupada @XXXXRT666 la tomó hace 5 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
ml-explore/mlx#4815 ·
Los mantenedores suelen responder en 3 días
-
[BUG] FP4 quantization on CPU rounds ties toward zero while Metal rounds to evenQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
ml-explore/mlx#4753 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 43/100
ml-explore/mlx#4843 ·
Los mantenedores suelen responder en 3 días
Todos los issues de ml-explore/mlx
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
arvidn/libtorrent#9126 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Sunrisepeak/mcpp-language-server#80 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
#2754 make deepseek api not workAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
xiaoyifang/goldendict-ng#3148 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
triton-inference-server/server#9069 ·
Los mantenedores suelen responder en 1 día