Cortex-M backend replaces channels-first dw conv with channels-last dw conv without handling the changed layout, fails at runtime
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
- 38/100
Línea de trabajo
Start with the fake implementation quantized_depthwise_conv2d_meta in backends/cortex_m/ops/operators.py, which accepts channels-first input, and with the runtime check that raises 'input and output must be channels_last' in backends/cortex_m/ops/op_quantized_depthwise_conv2d.cpp. Run the attached test_depthwise_conv_layout.py repro to confirm the failure. Done means the pass either skips the replacement for channels-first input or inserts a layout conversion, and the repro runs without error.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🐛 Describe the bug
A depthwise conv is replaced with a channels-last Cortex-M kernel without verifying that the input is channel-last. The fake implementation quantized_depthwise_conv2d_meta in backends/cortex_m/ops/operators.py happily takes a channels-first, computes output shape and returns a channel-last tensor. This doesn't work in the runtime kernel however, and the operator fails with
input and output must be channels_last
from backends/cortex_m/ops/op_quantized_depthwise_conv2d.cpp.
Two examples: one minimal, and one showing how this can show up naturally in a model.
(Note that the meandim example needs adding aten::mean.out and dim_order_ops::_to_dim_order_copy.out to the test runner, in backends/cortex_m/test/build_test_runner.sh)
class ChannelsFirstDepthwiseConv(torch.nn.Module):
def __init__(self):
super().__init__()
self.conv = torch.nn.Conv2d(2, 2, 3, padding=1, groups=2, bias=False)
def forward(self, x):
return self.conv(x.contiguous())
class MeanPoolDepthwiseConv(torch.nn.Module):
def __init__(self):
super().__init__()
self.conv = torch.nn.Conv2d(2, 2, 3, padding=1, groups=2, bias=False)
def forward(self, x):
# Average pooling over height naturally creates channels-first storage.
x = x.mean(dim=2, keepdim=True)
return self.conv(x)
as a test:
Proposed fix:
- Don't replace the operator that can't be handled
- Or, add a layout conversion before it when replacing.
Additionally, it could be a good idea to check input layout in fake implementations if there are constraints on it.
Versions
Not relevant, this is a backend lowering issue in the executorch python code. Present on upstream 40d17e193e54b4d773e8da7a64a1e7a68a661e2e
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani @psiddh @AdrianLundell
- Lenguaje dominante
- Python
- Estrellas
- 5.1k
- Forks
- 1.2k
- Merge medio
- 2 d 14 min
- PR fusionados (30 d)
- 704
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pytorch/executorch
-
Portable remainder kernel: wrong sign for integers and float64 rounded to floatPosiblemente ocupada @JakeStevens la tomó hace 4 días. Abiertobug module: kernels triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
pytorch/executorch#23682 · 2 asignados ·
Los mantenedores suelen responder en 1 día
-
enhancement triaged
Dificultad 2/5 Medio día Aptitud para principiantes 68/100
pytorch/executorch#21640 ·
Los mantenedores suelen responder en 1 día
-
[QNN] 16a4w_block stride-2 conv + ReLU fails HTP graph prepare on SM8850 (Relu16bParamsPlaceholder)Posiblemente ocupada @psiddh la tomó hoy. Abiertobug module: qnn partner: qualcomm
pytorch/executorch#23922 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 40/100
pytorch/executorch#23913 ·
Los mantenedores suelen responder en 1 día
-
[muse-glimmer] interpolate_pos_emb returns corrupted bf16 values on CPU and can segfaultPosiblemente ocupada @JakeStevens la tomó hace 2 días. Abiertobug module: examples triaged
pytorch/executorch#23797 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de pytorch/executorch
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
omegaup/omegaup#10353 · 1 comentario ·
Los mantenedores suelen responder en 5 días
-
bot-triaged module: LrScheduler module: optimizer triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
documentation glm5 llm-model
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
vllm-project/vllm-ascend#19062 ·
Los mantenedores suelen responder en 1 día
-
Author Page: shuai-zhao-llmAbiertoauthor-page correction
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
acl-org/acl-anthology#10496 · 1 comentario ·
Los mantenedores suelen responder en 1 día