Skip to content

The CPU is functioning normally, but the QNN is behaving abnormally. #18812

@ThreeD-H

Description

@ThreeD-H

🐛 Describe the bug

Dear experts, I have a model that I can successfully export now. However, it performs normally on the CPU but exhibits abnormal behavior on the Qualcomm 8295, and the output does not meet the expectations. Could you please help me figure out what the reason is?
Model file connection is as follows:

https://github.com/ThreeD-H/litert-torch-custom/blob/main/my_model.zip

The export process log is recorded as follows:

export.txt

The exported code is as follows:

shared_buffer = False
executorch_config = ExecutorchBackendConfig(
    memory_planning_pass=MemoryPlanningPass(
        alloc_graph_input=not shared_buffer,
        alloc_graph_output=not shared_buffer,
    ),
)
mod = ExportableModule(pytorch_model, export_config=export_config).eval()
backend_options = generate_htp_compiler_spec(
    use_fp16=True,
    use_multi_contexts=False,
    use_weight_sharing=False  # v86 not support
)
compile_spec = generate_qnn_executorch_compiler_spec(
    soc_model=QcomChipset.SA8295,
    backend_options=backend_options,
    shared_buffer=shared_buffer
)
program = to_edge_transform_and_lower_to_qnn(
    mod,
    compiler_specs=compile_spec,
    inputs=method_kwargs,
    skip_mutable_buffer=False,
).to_executorch(config=executorch_config)
file_name = f"{output_name_prefix}_{method_name}.pte" if output_name_prefix is not None else f"model_{backend}_{method_name}.pte"
with open(file_name, "wb") as f:
    f.write(program.buffer)
print(f"save finished~")

Versions

PyTorch version: 2.9.0+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.3) 11.4.0
Clang version: 14.0.0-1ubuntu1.1
CMake version: version 3.31.2
Libc version: glibc-2.35

Python version: 3.12.12 (main, Oct 10 2025, 08:52:57) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-6.8.0-106-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.8.61
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: Quadro P4000
Nvidia driver version: 580.126.09
cuDNN version: Could not collect
Is XPU available: False
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
Caching allocator config: N/A

CPU:
架构: x86_64
CPU 运行模式: 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
字节序: Little Endian
CPU: 8
在线 CPU 列表: 0-7
厂商 ID: GenuineIntel
型号名称: Intel(R) Xeon(R) Gold 5122 CPU @ 3.60GHz
CPU 系列: 6
型号: 85
每个核的线程数: 2
每个座的核数: 4
座: 1
步进: 4
CPU 最大 MHz: 3700.0000
CPU 最小 MHz: 1200.0000
BogoMIPS: 7200.00
标记: 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_perfmonbs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl 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 pti intel_ppin ssbd mba ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm 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 md_clear flush_l1d arch_capabilities ibpb_exit_to_user
L1d 缓存: 128 KiB (4 instances)
L1i 缓存: 128 KiB (4 instances)
L2 缓存: 4 MiB (4 instances)
L3 缓存: 16.5 MiB (1 instance)
NUMA 节点: 1
NUMA 节点0 CPU: 0-7
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: KVM: Mitigation: VMX unsupported
Vulnerability L1tf: Mitigation; PTE Inversion
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Mitigation; 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; IBRS; IBPB conditional; STIBP conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Vmscape: Mitigation; IBPB before exit to userspace

Versions of relevant libraries:
[pip3] executorch==1.0.1
[pip3] litert-torch==0.9.0
[pip3] numpy==2.4.3
[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.27.5
[pip3] nvidia-nvjitlink-cu12==12.8.93
[pip3] nvidia-nvtx-cu12==12.8.90
[pip3] optree==0.19.0
[pip3] pytorch_tokenizers==1.2.0
[pip3] torch==2.9.0
[pip3] torchao==0.14.0
[pip3] torchaudio==2.9.0
[pip3] torchvision==0.24.0
[pip3] triton==3.5.0
[conda] No relevant packages

cc @cccclai @cbilgin @abhinaykukkadapu

Metadata

Metadata

Labels

module: qnnIssues related to Qualcomm's QNN delegate and code under backends/qualcomm/

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions