Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#23,553 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
cpp, python, pytorch

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

🐛 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.

Lenguaje dominante
Python
Estrellas
5.1k
Forks
1.2k
Merge medio
2 d 51 min
PR fusionados (30 d)
712

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de pytorch/executorch

Todos los issues de pytorch/executorch

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.