Cortex-M backend replaces channels-first dw conv with channels-last dw conv without handling the changed layout, fails at runtime
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 38/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
🐛 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
- Langage dominant
- Python
- Étoiles
- 5.1k
- Forks
- 1.2k
- Merge moyen
- 1 j 23 h
- PR mergées (30 j)
- 713
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de pytorch/executorch
-
Portable remainder kernel: wrong sign for integers and float64 rounded to floatPeut-être pris @JakeStevens l’a pris il y a 3 jours. Ouvertebug module: kernels triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
pytorch/executorch#23682 · 2 personnes assignées ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement triaged
Difficulté 2/5 Une demi-journée Accessibilité débutants 68/100
pytorch/executorch#21640 ·
Les mainteneurs répondent en général sous 1 jour
-
[muse-glimmer] interpolate_pos_emb returns corrupted bf16 values on CPU and can segfaultPeut-être pris @JakeStevens l’a pris il y a 1 jour. Ouvertebug module: examples triaged
pytorch/executorch#23797 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
macOS Python wheel _portable_lib has non-relocatable libtorch rpathPeut-être pris @JacobSzwejbka l’a pris il y a 1 jour. Ouverte
pytorch/executorch#23742 · 1 commentaire · 2 personnes assignées ·
Les mainteneurs répondent en général sous 1 jour
-
Feedback about ToolsOuverteinvalid module: doc
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
pytorch/executorch#23706 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de pytorch/executorch
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
huggingface/sentence-transformers#4186 ·
Les mainteneurs répondent en général sous 5 jours
-
documentation good first issue
Difficulté 2/5 Une demi-journée Accessibilité débutants 72/100
sujithputta02/Esapay#13 ·
-
bot-triaged module: correctness (silent) module: mps module: NaNs and Infs triage review
Difficulté 2/5 Une demi-journée Accessibilité débutants 62/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
README: CI link/badge checkOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
SCIInstitute/SCIRun#2842 ·
Les mainteneurs répondent en général sous 3 jours