I2_S produces incorrect output on aarch64
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 25/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- cpp
研究方向
從釘選的 3rdparty/llama.cpp 子模組開始,重點查看 quants.c、ggml-cpu-i2s.c、ggml_gemm_i2_i8_s 和 ggml_vec_dot_i2_i8_s。在 aarch64 上使用列出的 llama-cli 命令重現,然後將 perplexity 和 GEMV/GEMM 核心輸出與 x86 進行比較。跨架構的輸出和 perplexity 相符即表示完成。
由索引模型根據 Issue 內容生成。
描述
I2_S inference is broken on aarch64. The model loads and runs, but output is nonsense — it does not crash, so it looks like a bad model rather than a broken kernel.
On an Orange Pi 5 Plus (RK3588, Debian 12, GCC 12.2) with microsoft/BitNet-b1.58-2B-4T's official ggml-model-i2_s.gguf:
$ llama-cli -m ggml-model-i2_s.gguf -p "The capital of France is" -n 12 --temp 0
> The capital of France is ????????????????
[ Prompt: 0.7 t/s | Generation: 0.7 t/s ]
The same file on x86-64 gives The capital of France is Paris. at ~40 t/s. Model md5 verified identical on both machines.
Three separate bugs, all in 3rdparty/llama.cpp code paths that x86 never compiles:
QK_I2_Sis 128 under AVX2 but 64 under__ARM_NEON, in bothquants.candggml-cpu-i2s.c. It is the on-disk block size, so it must match the file format on every architecture.- The scalar
vec_dotfallback decodes the block-interleaved weight layout sequentially. ggml_gemm_i2_i8_s's ACT_PARALLEL branch invertsggml_vec_dot_i2_i8_s'snrcsemantics, corrupting prefill.
There is also no NEON path for I2_S at all — aarch64 unpacks one 2-bit weight at a time.
Fixes in https://github.com/isHuangXin/llama.cpp/pull/2, against the pinned 3rdparty/llama.cpp submodule. After them, perplexity on aarch64 matches x86 to 0.161% (74.0952 vs 73.9758, same model and corpus), and kernel output is bit-identical for both GEMV and GEMM.
This may be the same root cause as #55.
- 主要語言
- C++
- 星號
- 40.3k
- 分支
- 3.7k
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/BitNet 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 86/100
-
i2_s SIGSEGVs at n_ubatch >= 32: BLAS backend dequantises by a row stride 4x the real packed row未關閉
難度 2/5 1-3 小時 新手友好度 76/100
-
難度 2/5 1-3 小時 新手友好度 86/100
-
難度 1/5 1 小時以內 新手友好度 92/100
-
難度 2/5 1-3 小時 新手友好度 76/100
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 92/100
espressif/esp-matter#1867 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 92/100
isce-framework/isce3#387 ·
-
upstream update
難度 2/5 1-3 小時 新手友好度 68/100
conan-io/conan-center-index#31055 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆