Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel 'aten::_upsample_bilinear2d_aa.out' not found. #7031

Open
My-captain opened this issue Nov 22, 2024 · 2 comments
Open

kernel 'aten::_upsample_bilinear2d_aa.out' not found. #7031

My-captain opened this issue Nov 22, 2024 · 2 comments
Labels
module: kernels Issues related to kernel libraries, e.g. portable kernels and optimized kernels

Comments

@My-captain
Copy link

🐛 Describe the bug

I`m trying to deploy a image preprocessing program using executroch
Success to export the pte file.
But crash when executor_runner the pte file.
Anyone can help me?

My python3 code

import torch
from torchvision.transforms.functional import resize


class ImgPreprocessor(torch.nn.Module):
    def __init__(self):
        super(ImgPreprocessor, self).__init__()
        self.patch_size = 14


    def reshape_by_patch(self, image):
        # CHW
        patch_size = self.patch_size
        patches = torch.nn.functional.unfold(
            image,
            (patch_size, patch_size),
            stride=(patch_size, patch_size)
        )

        patches = patches.reshape(image.size(0), patch_size, patch_size, -1)
        patches = patches.permute(0, 1, 3, 2).reshape(image.size(0), patch_size, -1)
        return patches

    def forward(self, image: torch.Tensor, mean: torch.FloatTensor, std: torch.FloatTensor) -> torch.FloatTensor:
        # H * W * C
        # width, height = 1920, 1080
        # C H W
        image = image.permute(2, 0, 1)
        refine_img = resize(image, [952, 1680])
        mean = mean.reshape(3, 1, 1)
        std = std.reshape(3, 1, 1)

        patches = []
        width, height = refine_img.shape[2], refine_img.shape[1]
        grid_x = int(width / 4)
        grid_y = int(height / 2)
        for i in range(0, height, grid_y):
            rows = []
            for j in range(0, width, grid_x):
                rows.append(refine_img[:,i:i + grid_y, j:j+grid_x])
            patches.append(rows)

        thumb_img = resize(image, [336, 602])
        slice_imgs = [thumb_img]
        slice_imgs.extend(patches[0])
        slice_imgs.extend(patches[1])

        image_patches = [img.float()/255 for img in slice_imgs]
        image_patches = [img.sub(mean).div(std) for img in image_patches]
        image_patches = [self.reshape_by_patch(img) for img in image_patches]
        pixel_values = [i.flatten(end_dim=1).permute(1, 0) for i in image_patches]
        pixel_values = torch.nn.utils.rnn.pad_sequence(pixel_values, batch_first=True, padding_value=0.0)
        pixel_values = pixel_values.permute(0, 2, 1).reshape(9, 3, 14, 14448)
        return pixel_values

# ImgPreprocessor().forward(torch.ones([1080, 1920, 3]))


from executorch.exir import to_edge
# 1. torch.export: Defines the program with the ATen operator set.
aten_dialect = torch.export.export(ImgPreprocessor(), (torch.ones([1080, 1920, 3]),torch.FloatTensor([0.5, 0.5, 0.5]),torch.FloatTensor([0.5, 0.5, 0.5])))

# 2. to_edge: Make optimizations for Edge devices
edge_program = to_edge(aten_dialect)

# 3. to_executorch: Convert the graph to an ExecuTorch program
executorch_program = edge_program.to_executorch()

# 4. Save the compiled .pte program
with open("minicpmv_preprocessor.pte", "wb") as file:
    file.write(executorch_program.buffer)

error Message

./cmake-out/executor_runner --model_path /home/zliu/workspace/py_minicpmv/execu_torch/minicpmv_preprocessor.pte
I 00:00:00.008654 executorch:executor_runner.cpp:82] Model file /home/zliu/workspace/py_minicpmv/execu_torch/minicpmv_preprocessor.pte is loaded.
I 00:00:00.008673 executorch:executor_runner.cpp:91] Using method forward
I 00:00:00.008679 executorch:executor_runner.cpp:138] Setting up planned buffer 0, size 169127520.
E 00:00:00.084998 executorch:operator_registry.cpp:185] kernel 'aten::_upsample_bilinear2d_aa.out' not found.
E 00:00:00.085011 executorch:operator_registry.cpp:186] dtype: 6 | dim order: [
E 00:00:00.085013 executorch:operator_registry.cpp:186] 0,
E 00:00:00.085014 executorch:operator_registry.cpp:186] 1,
E 00:00:00.085016 executorch:operator_registry.cpp:186] 2,
E 00:00:00.085017 executorch:operator_registry.cpp:186] 3,
E 00:00:00.085019 executorch:operator_registry.cpp:186] ]
E 00:00:00.085021 executorch:operator_registry.cpp:186] dtype: 6 | dim order: [
E 00:00:00.085023 executorch:operator_registry.cpp:186] 0,
E 00:00:00.085024 executorch:operator_registry.cpp:186] 1,
E 00:00:00.085026 executorch:operator_registry.cpp:186] 2,
E 00:00:00.085028 executorch:operator_registry.cpp:186] 3,
E 00:00:00.085030 executorch:operator_registry.cpp:186] ]
E 00:00:00.085030 executorch:operator_registry.cpp:186] dtype: 6 | dim order: [
E 00:00:00.085032 executorch:operator_registry.cpp:186] 0,
E 00:00:00.085033 executorch:operator_registry.cpp:186] 1,
E 00:00:00.085034 executorch:operator_registry.cpp:186] 2,
E 00:00:00.085035 executorch:operator_registry.cpp:186] 3,
E 00:00:00.085036 executorch:operator_registry.cpp:186] ]
E 00:00:00.085038 executorch:method.cpp:554] Missing operator: [2] aten::_upsample_bilinear2d_aa.out
E 00:00:00.085068 executorch:operator_registry.cpp:185] kernel 'aten::_upsample_bilinear2d_aa.out' not found.
E 00:00:00.085070 executorch:operator_registry.cpp:186] dtype: 6 | dim order: [
E 00:00:00.085071 executorch:operator_registry.cpp:186] 0,
E 00:00:00.085073 executorch:operator_registry.cpp:186] 1,
E 00:00:00.085075 executorch:operator_registry.cpp:186] 2,
E 00:00:00.085077 executorch:operator_registry.cpp:186] 3,
E 00:00:00.085078 executorch:operator_registry.cpp:186] ]
E 00:00:00.085080 executorch:operator_registry.cpp:186] dtype: 6 | dim order: [
E 00:00:00.085082 executorch:operator_registry.cpp:186] 0,
E 00:00:00.085083 executorch:operator_registry.cpp:186] 1,
E 00:00:00.085084 executorch:operator_registry.cpp:186] 2,
E 00:00:00.085086 executorch:operator_registry.cpp:186] 3,
E 00:00:00.085088 executorch:operator_registry.cpp:186] ]
E 00:00:00.085090 executorch:operator_registry.cpp:186] dtype: 6 | dim order: [
E 00:00:00.085091 executorch:operator_registry.cpp:186] 0,
E 00:00:00.085093 executorch:operator_registry.cpp:186] 1,
E 00:00:00.085095 executorch:operator_registry.cpp:186] 2,
E 00:00:00.085097 executorch:operator_registry.cpp:186] 3,
E 00:00:00.085099 executorch:operator_registry.cpp:186] ]
E 00:00:00.085100 executorch:method.cpp:554] Missing operator: [2] aten::_upsample_bilinear2d_aa.out
E 00:00:00.085480 executorch:method.cpp:763] There are 2 instructions don't have corresponding operator registered. See logs for details
F 00:00:00.085492 executorch:executor_runner.cpp:156] In function main(), assert failed (method.ok()): Loading of method forward failed with status 0x14
Aborted (core dumped)

Versions

PyTorch version: 2.6.0.dev20241112+cpu
Is debug build: False
CUDA used to build PyTorch: Could not collect
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.5 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: 14.0.0-1ubuntu1.1
CMake version: version 3.31.0
Libc version: glibc-2.35

Python version: 3.10.15 (main, Nov  6 2024, 17:05:55) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-6.8.0-49-generic-x86_64-with-glibc2.35
Is CUDA available: False
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3090
Nvidia driver version: 550.120
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        39 bits physical, 48 bits virtual
Byte Order:                           Little Endian
CPU(s):                               16
On-line CPU(s) list:                  0-15
Vendor ID:                            GenuineIntel
Model name:                           11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz
CPU family:                           6
Model:                                167
Thread(s) per core:                   2
Core(s) per socket:                   8
Socket(s):                            1
Stepping:                             1
CPU max MHz:                          5300.0000
CPU min MHz:                          800.0000
BogoMIPS:                             7008.00
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx avx512f avx512dq rdseed adx smap avx512ifma clflushopt intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req vnmi avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid fsrm md_clear flush_l1d arch_capabilities
Virtualization:                       VT-x
L1d cache:                            384 KiB (8 instances)
L1i cache:                            256 KiB (8 instances)
L2 cache:                             4 MiB (8 instances)
L3 cache:                             16 MiB (1 instance)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-15
Vulnerability Gather data sampling:   Mitigation; Microcode
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Mitigation; Enhanced IBRS
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loop
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

Versions of relevant libraries:
[pip3] executorch==0.5.0a0+fc42a4e
[pip3] numpy==1.21.3
[pip3] nvidia-cublas-cu12==12.4.5.8
[pip3] nvidia-cuda-cupti-cu12==12.4.127
[pip3] nvidia-cuda-nvrtc-cu12==12.4.127
[pip3] nvidia-cuda-runtime-cu12==12.4.127
[pip3] nvidia-cudnn-cu12==9.1.0.70
[pip3] nvidia-cufft-cu12==11.2.1.3
[pip3] nvidia-curand-cu12==10.3.5.147
[pip3] nvidia-cusolver-cu12==11.6.1.9
[pip3] nvidia-cusparse-cu12==12.3.1.170
[pip3] nvidia-nccl-cu12==2.21.5
[pip3] nvidia-nvjitlink-cu12==12.4.127
[pip3] nvidia-nvtx-cu12==12.4.127
[pip3] torch==2.6.0.dev20241112+cpu
[pip3] torchaudio==2.5.0.dev20241112+cpu
[pip3] torchsr==1.0.4
[pip3] torchvision==0.20.0.dev20241112+cpu
[pip3] triton==3.1.0
@metascroy
Copy link
Contributor

cc @manuelcandales do we have aten::_upsample_bilinear2d_aa.out implemented in portable? I don't see it.

@metascroy metascroy added the module: kernels Issues related to kernel libraries, e.g. portable kernels and optimized kernels label Nov 22, 2024
@My-captain
Copy link
Author

May I ask if there has been any progress ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: kernels Issues related to kernel libraries, e.g. portable kernels and optimized kernels
Projects
None yet
Development

No branches or pull requests

2 participants