Metal cache admission can exceed the configured cache limit
Maintainer thường phản hồi trong vòng 3 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- cpp
- Lĩnh vực
- backend, performance
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C++
- Star
- 29.1k
- Fork
- 2.4k
- Merge trung bình
- 3 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 103
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ml-explore/mlx
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ml-explore/mlx#4832 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[BUG] `mx.expand_dims` docs: the Args section names `axes`, but the parameter is `axis`Có thể đã có người làm @Redempt1onzzZZ đã nhận 3 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
ml-explore/mlx#4829 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[BUG] `mx.qqmm` docs: the Args section names `global_scale`, but the parameter is `global_scale_x`Có thể đã có người làm @XXXXRT666 đã nhận 5 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
ml-explore/mlx#4815 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[BUG] FP4 quantization on CPU rounds ties toward zero while Metal rounds to evenCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
ml-explore/mlx#4753 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 43/100
ml-explore/mlx#4843 ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của ml-explore/mlx
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
arvidn/libtorrent#9126 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Sunrisepeak/mcpp-language-server#80 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
#2754 make deepseek api not workĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
xiaoyifang/goldendict-ng#3148 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
triton-inference-server/server#9069 ·
Maintainer thường phản hồi trong vòng 1 ngày