Skip to content

Vulkan Backend - Inference Error: concat_3_texture3d_uint8 #16823

@urbste

Description

@urbste

🐛 Describe the bug

I want to export the Mask2Former from the transformers python package. XNNPACK export and inference works.
Vulkan backend export works, but execution fails. With the error below:
I would expect that layers that are not supported are run on XNNPACK?

 File "export_executorch.py", line 47, in main
    method = Runtime.get().load_program(args.output).load_method("forward")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/steffen/anaconda3/envs/pte_vulkan/lib/python3.11/site-packages/executorch/runtime/__init__.py", line 195, in load_method
    method = Method(self._program.load_method(name))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Exception raised from get_shader_info at **/home/steffen/libraries/executorch/backends/vulkan/runtime/api/ShaderRegistry.cpp:51: (it != listings_.end()) is false! Could not find ShaderInfo with name concat_3_texture3d_uint8**

My export code:

#!/usr/bin/env python3
import os, sys, torch, argparse
from transformers import Mask2FormerForUniversalSegmentation
from executorch.exir import to_edge_transform_and_lower
from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner

class Mask2FormerWrapper(torch.nn.Module):
    def __init__(self, model):
        super().__init__()
        self.model = model
    def forward(self, pixel_values, pixel_mask):
        out = self.model(pixel_values=pixel_values, pixel_mask=pixel_mask)
        return out.class_queries_logits, out.masks_queries_logits

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--model', type=str, default='facebook/mask2former-swin-small-coco-instance')
    parser.add_argument('--output', type=str, default='mask2former_swin_small.pte')
    parser.add_argument('--backend', type=str, default='xnnpack')
    args = parser.parse_args()

    print(f"Loading {args.model}...")
    model = Mask2FormerForUniversalSegmentation.from_pretrained(args.model).eval()
    wrapped = Mask2FormerWrapper(model)
    
    pixel_values = torch.randn(1, 3, 384, 384)
    pixel_mask = torch.ones(1, 384, 384)
    
    print("Exporting...")
    exported = torch.export.export(wrapped, (pixel_values, pixel_mask), strict=False)
    
    if args.backend == "xnnpack": 
        partitioner = [XnnpackPartitioner()]
    elif args.backend == "vulkan":
        from executorch.backends.vulkan.partitioner.vulkan_partitioner import VulkanPartitioner
        partitioner = [VulkanPartitioner(), XnnpackPartitioner()]
    else: 
        partitioner = [XnnpackPartitioner()]

    program = to_edge_transform_and_lower(exported, partitioner=partitioner).to_executorch()
    
    with open(args.output, "wb") as f: f.write(program.buffer)
    print(f"Saved {args.output} ({os.path.getsize(args.output)/1024**2:.2f} MB)")

    try:
        from executorch.runtime import Runtime
        method = Runtime.get().load_program(args.output).load_method("forward")
        out = method.execute([pixel_values, pixel_mask])
        print(f"Verification successful. Outputs: {[list(o.shape) for o in out]}")
    except ImportError:
        print("ExecuTorch runtime not found, skipping verification.")

if __name__ == '__main__':
    main()

Versions

Collecting environment information...
PyTorch version: 2.11.0.dev20251222+cu128
Is debug build: False
CUDA used to build PyTorch: 12.8
ROCM used to build PyTorch: N/A

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

Python version: 3.11.14 (main, Oct 21 2025, 18:31:21) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-6.8.0-90-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.8.93
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 4090
Nvidia driver version: 580.126.09
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.9.18.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv.so.9.18.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.18.0
/usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.18.0
/usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.18.0
/usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.18.0
/usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.18.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.18.0
Is XPU available: False
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
Caching allocator config: N/A

CPU:
Architektur: x86_64
CPU Operationsmodus: 32-bit, 64-bit
Adressgrößen: 46 bits physical, 48 bits virtual
Byte-Reihenfolge: Little Endian
CPU(s): 24
Liste der Online-CPU(s): 0-23
Anbieterkennung: GenuineIntel
Modellname: 13th Gen Intel(R) Core(TM) i7-13700K
Prozessorfamilie: 6
Modell: 183
Thread(s) pro Kern: 2
Kern(e) pro Socket: 16
Sockel: 1
Stepping: 1
Maximale Taktfrequenz der CPU: 5400,0000
Minimale Taktfrequenz der CPU: 800,0000
BogoMIPS: 6835.20
Markierungen: 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 ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq tme rdpid movdiri movdir64b fsrm md_clear serialize pconfig arch_lbr ibt flush_l1d arch_capabilities ibpb_exit_to_user
Virtualisierung: VT-x
L1d Cache: 640 KiB (16 instances)
L1i Cache: 768 KiB (16 instances)
L2 Cache: 24 MiB (10 instances)
L3 Cache: 30 MiB (1 instance)
NUMA-Knoten: 1
NUMA-Knoten0 CPU(s): 0-23
Schwachstelle Gather data sampling: Not affected
Schwachstelle Itlb multihit: Not affected
Schwachstelle L1tf: Not affected
Schwachstelle Mds: Not affected
Schwachstelle Meltdown: Not affected
Schwachstelle Mmio stale data: Not affected
Schwachstelle Reg file data sampling: Mitigation; Clear Register File
Schwachstelle Retbleed: Not affected
Schwachstelle Spec rstack overflow: Not affected
Schwachstelle Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Schwachstelle Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Schwachstelle Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
Schwachstelle Srbds: Not affected
Schwachstelle Tsx async abort: Not affected
Schwachstelle Vmscape: Mitigation; IBPB before exit to userspace

Versions of relevant libraries:
[pip3] executorch==1.1.0a0+763a474
[pip3] numpy==2.2.6
[pip3] nvidia-cublas-cu12==12.8.4.1
[pip3] nvidia-cuda-cupti-cu12==12.8.90
[pip3] nvidia-cuda-nvrtc-cu12==12.8.93
[pip3] nvidia-cuda-runtime-cu12==12.8.90
[pip3] nvidia-cudnn-cu12==9.10.2.21
[pip3] nvidia-cufft-cu12==11.3.3.83
[pip3] nvidia-curand-cu12==10.3.9.90
[pip3] nvidia-cusolver-cu12==11.7.3.90
[pip3] nvidia-cusparse-cu12==12.5.8.93
[pip3] nvidia-cusparselt-cu12==0.7.1
[pip3] nvidia-nccl-cu12==2.28.9
[pip3] nvidia-nvjitlink-cu12==12.8.93
[pip3] nvidia-nvtx-cu12==12.8.90
[pip3] pytorch_tokenizers==1.0.1
[pip3] pytorch-triton==3.5.0+git7416ffcb
[pip3] torch==2.11.0.dev20251222+cu128
[pip3] torchao==0.14.0+git01849b2b1
[pip3] torchaudio==2.10.0.dev20251222+cu128
[pip3] torchdata==0.11.0
[pip3] torchsr==1.0.4
[pip3] torchtune==0.6.1
[pip3] torchvision==0.25.0.dev20251222+cu128
[pip3] triton==3.6.0+git6213a0e8
[conda] executorch 1.1.0a0+763a474 pypi_0 pypi
[conda] numpy 2.2.6 pypi_0 pypi
[conda] nvidia-cublas-cu12 12.8.4.1 pypi_0 pypi
[conda] nvidia-cuda-cupti-cu12 12.8.90 pypi_0 pypi
[conda] nvidia-cuda-nvrtc-cu12 12.8.93 pypi_0 pypi
[conda] nvidia-cuda-runtime-cu12 12.8.90 pypi_0 pypi
[conda] nvidia-cudnn-cu12 9.10.2.21 pypi_0 pypi
[conda] nvidia-cufft-cu12 11.3.3.83 pypi_0 pypi
[conda] nvidia-curand-cu12 10.3.9.90 pypi_0 pypi
[conda] nvidia-cusolver-cu12 11.7.3.90 pypi_0 pypi
[conda] nvidia-cusparse-cu12 12.5.8.93 pypi_0 pypi
[conda] nvidia-cusparselt-cu12 0.7.1 pypi_0 pypi
[conda] nvidia-nccl-cu12 2.28.9 pypi_0 pypi
[conda] nvidia-nvjitlink-cu12 12.8.93 pypi_0 pypi
[conda] nvidia-nvtx-cu12 12.8.90 pypi_0 pypi
[conda] pytorch-tokenizers 1.0.1 pypi_0 pypi
[conda] pytorch-triton 3.5.0+git7416ffcb pypi_0 pypi
[conda] torch 2.11.0.dev20251222+cu128 pypi_0 pypi
[conda] torchao 0.14.0+git01849b2b1 pypi_0 pypi
[conda] torchaudio 2.10.0.dev20251222+cu128 pypi_0 pypi
[conda] torchdata 0.11.0 pypi_0 pypi
[conda] torchsr 1.0.4 pypi_0 pypi
[conda] torchtune 0.6.1 pypi_0 pypi
[conda] torchvision 0.25.0.dev20251222+cu128 pypi_0 pypi
[conda] triton 3.6.0+git6213a0e8 pypi_0 pypi

cc @SS-JIA @manuelcandales @digantdesai @cbilgin

Metadata

Metadata

Assignees

Labels

module: vulkanIssues related to the Vulkan delegate and code under backends/vulkan/

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions