Python bindings: Module path gives device-tagged unplanned outputs host memory
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 领域
- backend, mobile-dev
调研方向
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 itscudaPointerGetAttributescheck 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 argumentand "Allocation not found" fromcuMemcpyDtoDAsync_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 小时
- 30 天内合并 PR
- 632
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pytorch/executorch 的其他 Issue
-
Portable remainder kernel: wrong sign for integers and float64 rounded to float可能已有人在做 @usmanmateen 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
pytorch/executorch#23682 ·
维护者通常 1 天内回复
-
enhancement triaged
难度 2/5 半天 新手友好度 68/100
pytorch/executorch#21640 ·
维护者通常 1 天内回复
-
Portable floor_divide returns non-whole numbers for floats and wrong values for a zero divisor可能已有人在做 @usmanmateen 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 52/100
pytorch/executorch#23684 ·
维护者通常 1 天内回复
-
torch.var_mean and torch.std_mean fail in to_edge: aten.var_mean.correction is not core ATen and has no core decomposition可能已有人在做 @usmanmateen 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 58/100
pytorch/executorch#23680 ·
维护者通常 1 天内回复
-
Prompts of max_seq_len tokens fail to prefill: export_llm bounds the KV-cache token input at max_seq_len - 1 but publishes get_max_seq_len = max_seq_len可能已有人在做 @alpharomercoma 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 20/100
pytorch/executorch#23678 ·
维护者通常 1 天内回复
查看 pytorch/executorch 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
vllm-project/vllm#61131 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
kubernetes-client/python#2735 ·
维护者通常 1 天内回复
-
desktop help wanted test
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
docs pydanty:is-working
难度 2/5 1-3 小时 新手友好度 68/100
pydantic/pydantic-ai#10113 ·
维护者通常 1 天内回复
-
Tutorial unit test leaks sample data into tutorial doctest可能已有人在做 @Gambit-Checkmate 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100