Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Python bindings: Module path gives device-tagged unplanned outputs host memory

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp, python, pytorch

調査の方向性

Read extension/pybindings/pybindings.cpp, especially PyModule::allocate_output_tensors, and compare its behavior with the Method path fixed in #23547. Investigate how output tensors can own device buffers while preserving the ownership behavior described in the issue. Done means unplanned device-tagged outputs through the Module path use appropriate device memory and repeated calls remain safe while callers retain prior results.

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

説明

🐛 Describe the bug

PyModule::allocate_output_tensors in extension/pybindings/pybindings.cpp (the _load_for_executorch / Module path) backs every unplanned tensor output with std::vector<uint8_t>(nbytes) through make_tensor_ptr, whatever device the program tagged the output with.

So a program exported device resident (skip_d2h_for_method_outputs=True with alloc_graph_output=False) fails through this path the same way the Method path did before #23547:

  • The CUDA backend rejects the host buffer with InvalidArgument (0x12), because its cudaPointerGetAttributes check finds no CUDA allocation.
  • A delegate without that check writes into the host buffer. The CUDA tensor returned over it then fails to clone on a GPU that cannot read pageable host memory, with CUDA error: invalid argument and "Allocation not found" from cuMemcpyDtoDAsync_v2.

#23547 fixes the Method path (PyMethod::allocate_output_storages). This path needs the same choice, with one more requirement: make_tensor_ptr takes ownership of the host bytes, so a device buffer has to be owned by the tensor the same way, or the next call writes through a result the caller still holds.

Reported by @Gasoonjia in review of #23547. Part of #23101.

Versions

ExecuTorch main at 1802bcf030.

主要言語
Python
スター
5.1k
フォーク
1.2k
平均マージ
2日 9時間
マージ済み PR(30日)
632

環境構築

はじめの一歩

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

pytorch/executorch のほかの issue

pytorch/executorch の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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