Qualcomm AI Engine Direct: a delegated mutable buffer starts from leftover memory

オープン
#24,749 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python

調査の方向性

Start by reading the QNN partitioner logic that decides whether mutable buffers are delegated, including the int64 special case, and trace how delegated buffers are initialized before their first run. Reproduce the counter example with the QNN SDK 2.51 x86 simulator and compare delegated results with CPU results. Done means delegated buffers begin with the registered value across dtypes, and the int64 special case can be removed.

索引モデルが issue の本文から書いたものです。

説明

module: qnn partner: qualcomm

When the QNN partitioner delegates a mutable buffer (the default,
skip_mutable_buffer=False), the buffer lives in memory that the QNN delegate
owns. Nothing sets that memory before the first run, so the buffer starts from
whatever the memory held. The result is wrong with no error.

Example: a counter that should start at zero.

class Int32Counter(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.register_buffer("count", torch.zeros(2, dtype=torch.int32))

    def forward(self, x):
        self.count.add_(x.argmax(-1).to(torch.int32))
        return x * 2, self.count + 0

With x = [[0.1, 0.9, 0.2], [0.7, 0.1, 0.3]] the first run should return
count = [1, 0]. Lowered for HTP float16 and run on the QNN SDK 2.51 x86
simulator, it returns values like [-1486893823, 32716], different on every
run.

Int64 buffers already stay on CPU for this reason, and the same counter with
an int64 buffer comes out right. Buffers of other dtypes,
including float buffers such as KV caches, are still delegated.

Expected: a delegated buffer starts from the same value as a CPU one, so the
int64 special case in the partitioner can go.

cc @cccclai @winskuo-quic @shewu-quic @haowhsu-quic @DannyYuyang-quic @qti-horodnic @cbilgin @abhinaykukkadapu @psiddh

主要言語
Python
スター
5.2k
フォーク
1.2k
平均マージ
1日 23時間
マージ済み PR(30日)
696

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pytorch/executorch のほかの issue

pytorch/executorch の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。