GGUF dequant transient: numpy-fallback (IQ) types over-reserve device memory ~4x
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- numpy, python, pytorch
調査の方向性
Start in the function that computes peak_ggml_linear_dequant_transient_bytes and its _DEQUANT_INTERMEDIATE_BYTES_PER_ELEMENT table, then read GGMLTensor.get_dequantized_tensor to confirm the host fallback through gguf.quants.dequantize. Change the default for types that are neither torch-compatible nor in DEQUANTIZE_FUNCTIONS to 0 intermediates, and check the IQ4_XS and IQ4_NL estimates against the measured ratios in the issue. Done when those types report no device intermediates and the existing estimate tests still pass.
索引モデルが issue の本文から書いたものです。
説明
Follow-up from #9709 (review at 59c851290a).
peak_ggml_linear_dequant_transient_bytes gives every quantization type missing from _DEQUANT_INTERMEDIATE_BYTES_PER_ELEMENT the worst-case 8 B/element of device intermediates. Those types (the IQ family) are exactly the ones without a GPU kernel: GGMLTensor.get_dequantized_tensor decodes them through gguf.quants.dequantize on the host and then calls .to(device, dtype=compute_dtype), which casts on the CPU before the copy. On the device, the only allocation is the result.
Measured on a W7900 (torch 2.13 + ROCm 7.2), 3072×12288 weight, bf16 compute dtype:
| Type | Device intermediates | Estimate / (peak + packed) |
|---|---|---|
| IQ4_XS | 0.00 B/el | 4.16 |
| IQ4_NL | 0.00 B/el | 4.12 |
The nodes that add the term to an activation estimate (FLUX.2, Krea-2, Z-Image, Ideogram 4) therefore over-reserve by 8 B per element of the largest layer. By the FLUX.2 dev numbers in #9709, that is roughly 2.5 GiB, which is the kind of over-reservation #9709 replaced the flat bound to avoid.
Suggested fix: use 0 intermediates for any type that is neither torch-compatible nor in DEQUANTIZE_FUNCTIONS, since every such type takes the host fallback. The fallback's real cost is host RAM (the float32 numpy decode), which nothing reserves. That could be tracked separately.
- 主要言語
- TypeScript
- スター
- 28.8k
- フォーク
- 3.1k
- 平均マージ
- 3日 2時間
- マージ済み PR(30日)
- 150
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
invoke-ai/InvokeAI のほかの issue
-
[enhancement]: Bump PyPatchMatch to latest対応中かも @dunkeroni が 8 日前に担当しました。 オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
invoke-ai/InvokeAI#9826 · リアクション 2 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 2 日以内に返信
-
extract_audio_pcm detects "no audio stream" by matching ffmpeg's stderr text, so a wording change turns silent clips into hard errors対応中かも @wunianze666-netizen が 11 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 2 日以内に返信
invoke-ai/InvokeAI の issue をすべて見る
似ている issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
source-cooperative/docs.source.coop#41 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Nimblesite/SharpLsp#468 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
solidjs-community/solid-primitives#1082 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信