Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Page-size check prevents mmap for blob-aligned checkpoints

未关闭 适合新手
#1,031 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
75/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp

调研方向

从 ChooseMode 开始,检查将 checkpoint 长度与系统页面大小进行比较的长度检查,然后跟踪 mmap 和普通读取的回退路径。完成的标准是:与 blob 对齐的长度(例如 4B checkpoint)可以使用文件支持的映射,而不能被 kBlobAlign 整除的长度仍使用普通读取。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
C++
星标
7k
派生
660
平均合并
1 天 3 小时
30 天内合并 PR
35

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

google/gemma.cpp 的其他 Issue

查看 google/gemma.cpp 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。