Skip to content

Qwen3 Vulkan Delegate Failures at Runtime #13135

@alexdean08

Description

@alexdean08

🐛 Describe the bug

This is an additional issue to #12373

Using the following yaml to generate Qwen3 0.6B:

base:
  metadata: '{"get_bos_id": 151644, "get_eos_ids":[151645]}'

model:
  dtype_override: fp32
  enable_dynamic_shape: true
 
quantization:
  qmode: vulkan_4w
 
backend:
  vulkan:
    enabled: True

It builds the pte, but at runtime I get:

./llama_main --model_path=/data/local/tmp/qwen3_0_6b.pte --tokenizer_path=/data/local/tmp/tokenizer.json --prompt "Hi there"
I tokenizers:regex.cpp:27] Registering override fallback regex
I 00:00:00.005135 executorch:cpuinfo_utils.cpp:71] Reading file /sys/devices/soc0/image_version
I 00:00:00.005205 executorch:cpuinfo_utils.cpp:87] Failed to open midr file /sys/devices/soc0/image_version
I 00:00:00.005227 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu0/regs/identification/midr_el1
I 00:00:00.005303 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu1/regs/identification/midr_el1
I 00:00:00.005363 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu2/regs/identification/midr_el1
I 00:00:00.005396 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu3/regs/identification/midr_el1
I 00:00:00.005427 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu4/regs/identification/midr_el1
I 00:00:00.005461 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu5/regs/identification/midr_el1
I 00:00:00.005493 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu6/regs/identification/midr_el1
I 00:00:00.005554 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu7/regs/identification/midr_el1
I 00:00:00.005627 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu8/regs/identification/midr_el1
I 00:00:00.005839 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu9/regs/identification/midr_el1
I 00:00:00.005999 executorch:main.cpp:87] Resetting threadpool with num threads = 6
I 00:00:00.008321 executorch:runner.cpp:44] Creating LLaMa runner: model_path=/data/local/tmp/qwen3_0_6b.pte, tokenizer_path=/data/local/tmp/tokenizer.json
I tokenizers:hf_tokenizer.cpp:109] Setting up normalizer...
I tokenizers:normalizer.cpp:89] Using NFC normalizer. Please notice that our implementation may not handle all edge cases.
I tokenizers:hf_tokenizer.cpp:113] Normalizer set up
I tokenizers:hf_tokenizer.cpp:127] Setting up pretokenizer...
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1754416404.061986     890 re2.cc:237] Error parsing '((?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s...': invalid perl operator: (?!
E tokenizers:re2_regex.cpp:26] Failed to compile regex: ((?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+), error: invalid perl operator: (?!
I tokenizers:regex_lookahead.cpp:27] Creating PCRE2 regex
I tokenizers:hf_tokenizer.cpp:131] Pretokenizer set up
I tokenizers:hf_tokenizer.cpp:147] Loading BPE merges...
I tokenizers:hf_tokenizer.cpp:185] Loaded 151387 BPE merge rules
I tokenizers:hf_tokenizer.cpp:193] Built merge ranks map with 151387 entries
I 00:00:00.632394 executorch:text_llm_runner.cpp:274] Loaded json tokenizer
I 00:00:00.632443 executorch:text_llm_runner.cpp:401] Reading metadata from model
I 00:00:00.803426 executorch:text_llm_runner.cpp:344] Metadata: use_sdpa_with_kv_cache = 0
I 00:00:00.803474 executorch:text_llm_runner.cpp:344] Metadata: use_kv_cache = 0
I 00:00:00.803476 executorch:text_llm_runner.cpp:344] Metadata: get_max_context_len = 128
I 00:00:00.803479 executorch:text_llm_runner.cpp:344] Metadata: get_max_seq_len = 128
I 00:00:00.803483 executorch:text_llm_runner.cpp:344] Metadata: enable_dynamic_shape = 1
I 00:00:00.803489 executorch:text_llm_runner.cpp:374] eos_id = 151645
I 00:00:01.497521 executorch:text_llm_runner.cpp:111] RSS after loading model: 867.000000 MiB (0 if unsupported)
I tokenizers:hf_tokenizer.cpp:327] normalized input: 'Hi there' -> 'Hi there'
I 00:00:01.500510 executorch:text_llm_runner.cpp:168] Max new tokens resolved: 126, given start_pos 0, num_prompt_tokens 2, max_context_len 128
Hi therelibc++abi: terminating due to uncaught exception of type vkcompute::vkapi::Error: Exception raised from execute at /home/a.dean1/dev/executorchMain/executorchFork/executorch/backends/vulkan/runtime/VulkanBackend.cpp:613: Could not handle output with type SYMINT
Aborted

Looking at the failure, it seems like the model executes, but can't process the output.

When setting enable_dynamic_shape: false, I get:

./llama_main --model_path=/data/local/tmp/qwen3_0_6b.pte --tokenizer_path=/data/local/tmp/tokenizer.json --prompt "Hi there"
I tokenizers:regex.cpp:27] Registering override fallback regex
I 00:00:00.007483 executorch:cpuinfo_utils.cpp:71] Reading file /sys/devices/soc0/image_version
I 00:00:00.007591 executorch:cpuinfo_utils.cpp:87] Failed to open midr file /sys/devices/soc0/image_version
I 00:00:00.007612 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu0/regs/identification/midr_el1
I 00:00:00.007667 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu1/regs/identification/midr_el1
I 00:00:00.007723 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu2/regs/identification/midr_el1
I 00:00:00.007753 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu3/regs/identification/midr_el1
I 00:00:00.007844 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu4/regs/identification/midr_el1
I 00:00:00.007894 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu5/regs/identification/midr_el1
I 00:00:00.007920 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu6/regs/identification/midr_el1
I 00:00:00.007946 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu7/regs/identification/midr_el1
I 00:00:00.007972 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu8/regs/identification/midr_el1
I 00:00:00.007995 executorch:cpuinfo_utils.cpp:100] Reading file /sys/devices/system/cpu/cpu9/regs/identification/midr_el1
I 00:00:00.008023 executorch:main.cpp:87] Resetting threadpool with num threads = 6
I 00:00:00.012889 executorch:runner.cpp:44] Creating LLaMa runner: model_path=/data/local/tmp/qwen3_0_6b.pte, tokenizer_path=/data/local/tmp/tokenizer.json
I tokenizers:hf_tokenizer.cpp:109] Setting up normalizer...
I tokenizers:normalizer.cpp:89] Using NFC normalizer. Please notice that our implementation may not handle all edge cases.
I tokenizers:hf_tokenizer.cpp:113] Normalizer set up
I tokenizers:hf_tokenizer.cpp:127] Setting up pretokenizer...
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1754417664.353883    4385 re2.cc:237] Error parsing '((?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s...': invalid perl operator: (?!
E tokenizers:re2_regex.cpp:26] Failed to compile regex: ((?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+), error: invalid perl operator: (?!
I tokenizers:regex_lookahead.cpp:27] Creating PCRE2 regex
I tokenizers:hf_tokenizer.cpp:131] Pretokenizer set up
I tokenizers:hf_tokenizer.cpp:147] Loading BPE merges...
I tokenizers:hf_tokenizer.cpp:185] Loaded 151387 BPE merge rules
I tokenizers:hf_tokenizer.cpp:193] Built merge ranks map with 151387 entries
I 00:00:00.629796 executorch:text_llm_runner.cpp:274] Loaded json tokenizer
I 00:00:00.629838 executorch:text_llm_runner.cpp:401] Reading metadata from model
I 00:00:00.790365 executorch:text_llm_runner.cpp:344] Metadata: use_sdpa_with_kv_cache = 0
I 00:00:00.790401 executorch:text_llm_runner.cpp:344] Metadata: use_kv_cache = 0
I 00:00:00.790404 executorch:text_llm_runner.cpp:344] Metadata: get_max_context_len = 128
I 00:00:00.790407 executorch:text_llm_runner.cpp:344] Metadata: get_max_seq_len = 128
I 00:00:00.790410 executorch:text_llm_runner.cpp:344] Metadata: enable_dynamic_shape = 0
I 00:00:00.790417 executorch:text_llm_runner.cpp:374] eos_id = 151645
I 00:00:01.511219 executorch:text_llm_runner.cpp:111] RSS after loading model: 850.789062 MiB (0 if unsupported)
I tokenizers:hf_tokenizer.cpp:327] normalized input: 'Hi there' -> 'Hi there'
I 00:00:01.514766 executorch:text_llm_runner.cpp:168] Max new tokens resolved: 120, given start_pos 0, num_prompt_tokens 8, max_context_len 128
Hi thereE 00:00:01.514820 executorch:tensor_impl.cpp:110] Attempted to resize a static tensor. Expected shape (1, 3), but received (1, 8).
E 00:00:01.514826 executorch:method.cpp:1078] Error setting input 0: 0x10
E 00:00:01.514830 executorch:main.cpp:114] Failed to warmup llama runner

This seems like more of an issue with the llama runner.

With the normal executor runner and dynamic shape disabled, it runs without a failure, but I would prefer to run the llama runner with dynamic shape enabled.

Versions

Collecting environment information...
PyTorch version: 2.9.0.dev20250725+cpu
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.6 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Clang version: Could not collect
CMake version: version 3.30.4
Libc version: glibc-2.31

Python version: 3.10.17 | packaged by conda-forge | (main, Apr 10 2025, 22:19:12) [GCC 13.3.0] (64-bit runtime)
Python platform: Linux-5.15.0-139-generic-x86_64-with-glibc2.31
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
Is XPU available: False
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
Byte Order:                           Little Endian
Address sizes:                        46 bits physical, 48 bits virtual
CPU(s):                               48
On-line CPU(s) list:                  0-47
Thread(s) per core:                   2
Core(s) per socket:                   24
Socket(s):                            1
NUMA node(s):                         1
Vendor ID:                            GenuineIntel
CPU family:                           6
Model:                                85
Model name:                           Intel(R) Xeon(R) Gold 5220R CPU @ 2.20GHz
Stepping:                             7
CPU MHz:                              2200.000
CPU max MHz:                          4000.0000
CPU min MHz:                          1000.0000
BogoMIPS:                             4400.00
Virtualization:                       VT-x
L1d cache:                            768 KiB
L1i cache:                            768 KiB
L2 cache:                             24 MiB
L3 cache:                             35.8 MiB
NUMA node0 CPU(s):                    0-47
Vulnerability Gather data sampling:   Mitigation; Microcode
Vulnerability Itlb multihit:          KVM: Mitigation: VMX disabled
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 and seccomp
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:        Mitigation; TSX disabled
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 pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke avx512_vnni md_clear flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] executorch==0.8.0a0+f891c4b
[pip3] mypy_extensions==1.1.0
[pip3] numpy==2.1.1
[pip3] nvidia-cublas-cu12==12.6.4.1
[pip3] nvidia-cuda-cupti-cu12==12.6.80
[pip3] nvidia-cuda-nvrtc-cu12==12.6.77
[pip3] nvidia-cuda-runtime-cu12==12.6.77
[pip3] nvidia-cudnn-cu12==9.5.1.17
[pip3] nvidia-cufft-cu12==11.3.0.4
[pip3] nvidia-curand-cu12==10.3.7.77
[pip3] nvidia-cusolver-cu12==11.7.1.2
[pip3] nvidia-cusparse-cu12==12.5.4.2
[pip3] nvidia-cusparselt-cu12==0.6.3
[pip3] nvidia-nccl-cu12==2.26.2
[pip3] nvidia-nvjitlink-cu12==12.6.85
[pip3] nvidia-nvtx-cu12==12.6.77
[pip3] pytorch_tokenizers==0.1.0
[pip3] torch==2.9.0.dev20250725+cpu
[pip3] torchao==0.13.0+git2eb4f9762
[pip3] torchaudio==2.8.0.dev20250725+cpu
[pip3] torchdata==0.11.0
[pip3] torchexplorer==1.1.2
[pip3] torchsr==1.0.4
[pip3] torchtune==0.6.1
[pip3] torchview==0.2.7
[pip3] torchvision==0.24.0.dev20250725+cpu
[pip3] torchviz==0.0.3
[pip3] triton==3.3.1
[conda] executorch                0.8.0a0+f891c4b          pypi_0    pypi
[conda] numpy                     2.1.1                    pypi_0    pypi
[conda] nvidia-cublas-cu12        12.6.4.1                 pypi_0    pypi
[conda] nvidia-cuda-cupti-cu12    12.6.80                  pypi_0    pypi
[conda] nvidia-cuda-nvrtc-cu12    12.6.77                  pypi_0    pypi
[conda] nvidia-cuda-runtime-cu12  12.6.77                  pypi_0    pypi
[conda] nvidia-cudnn-cu12         9.5.1.17                 pypi_0    pypi
[conda] nvidia-cufft-cu12         11.3.0.4                 pypi_0    pypi
[conda] nvidia-curand-cu12        10.3.7.77                pypi_0    pypi
[conda] nvidia-cusolver-cu12      11.7.1.2                 pypi_0    pypi
[conda] nvidia-cusparse-cu12      12.5.4.2                 pypi_0    pypi
[conda] nvidia-cusparselt-cu12    0.6.3                    pypi_0    pypi
[conda] nvidia-nccl-cu12          2.26.2                   pypi_0    pypi
[conda] nvidia-nvjitlink-cu12     12.6.85                  pypi_0    pypi
[conda] nvidia-nvtx-cu12          12.6.77                  pypi_0    pypi
[conda] pytorch-tokenizers        0.1.0                    pypi_0    pypi
[conda] torch                     2.9.0.dev20250725+cpu          pypi_0    pypi
[conda] torchao                   0.13.0+git2eb4f9762          pypi_0    pypi
[conda] torchaudio                2.8.0.dev20250725+cpu          pypi_0    pypi
[conda] torchdata                 0.11.0                   pypi_0    pypi
[conda] torchexplorer             1.1.2                    pypi_0    pypi
[conda] torchsr                   1.0.4                    pypi_0    pypi
[conda] torchtune                 0.6.1                    pypi_0    pypi
[conda] torchview                 0.2.7                    pypi_0    pypi
[conda] torchvision               0.24.0.dev20250725+cpu          pypi_0    pypi
[conda] torchviz                  0.0.3                    pypi_0    pypi
[conda] triton                    3.3.1                    pypi_0    pypi

cc @SS-JIA @manuelcandales @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