Repository navigation
Description
🐛 Describe the bug
Hello,
I am trying to run a YOLO-NAS model on a GPU using a Vulkan backend.
I can lower and export the model to run it with the executor_runner, however, the first tensor on the outputs which represent the boxes coordinates diverge.
This behavior is not consistent. If I execute the same command line different outputs may be produced, even if I use the same input file. The command I am using is the following one:
./executor_runner --model_path=YOLO_NAS_S_vulkan.pte --inputs=dummy_input.bin
I did a minimal reproduction using the export.py available in executorch/examples/vulkan. I will attach the diff for you to reproduce it. To run it:
python export.py --model=YOLO_NAS_S
I believe that @SS-JIA is the most suitable person to provide support for this.
Many thanks for your support.
Versions
Collecting environment information...
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) 11.4.0
Clang version: 22.0.0git
CMake version: version 3.31.6
Libc version: glibc-2.35
Python version: 3.10.12 (main, May 27 2025, 17:12:29) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-6.8.0-60-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 11.5.119
CUDA_MODULE_LOADING set to:
GPU models and configuration: GPU 0: NVIDIA RTX 2000 Ada Generation
Nvidia driver version: 570.133.07
cuDNN version: Could not collect
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
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 32
On-line CPU(s) list: 0-31
Vendor ID: GenuineIntel
Model name: Intel(R) Core(TM) i9-14900
CPU family: 6
Model: 183
Thread(s) per core: 2
Core(s) per socket: 24
Socket(s): 1
Stepping: 1
CPU max MHz: 5800.0000
CPU min MHz: 800.0000
BogoMIPS: 3993.60
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 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 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
Virtualization: VT-x
L1d cache: 896 KiB (24 instances)
L1i cache: 1.3 MiB (24 instances)
L2 cache: 32 MiB (12 instances)
L3 cache: 36 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-31
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Mitigation; Clear Register File
Vulnerability Retbleed: Not affected
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 BHI_DIS_S
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Versions of relevant libraries:
[pip3] executorch==1.0.0
[pip3] numpy==1.26.4
[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] onnx==1.15.0
[pip3] onnxruntime==1.15.0
[pip3] onnxsim==0.4.36
[pip3] pytorch-lightning==2.5.5
[pip3] pytorch_tokenizers==1.0.1
[pip3] torch==2.9.0
[pip3] torch-complex==0.4.4
[pip3] torchao==0.14.0+git01849b2b1
[pip3] torchaudio==2.9.0
[pip3] torchmetrics==0.8.0
[pip3] torchvision==0.24.0
[pip3] triton==3.5.0
[conda] Could not collect
Activity
SS-JIA commentedon Nov 10, 2025
@lsauerr thanks for reporting!
Could you provide one or both:
.ptefile you are testing with.ptefile you are testing withThis will help me reproduce the issue and investigate further. Thanks in advance!
lsauerr commentedon Nov 10, 2025
Thanks for the quick reply.
I only extended what you did for the Vulkan examples. I put the diff of mine and yours in here.
I can't send the *.pte file, I am receiving a message that this file type is not supported.
To run it:
Many thanks for the support!
SS-JIA commentedon Nov 10, 2025
@lsauerr perfect, thanks. I will try to reproduce and will update when I have more news 👍
[ET-VK] Add some utility compile options + improve export script
SS-JIA commentedon Nov 12, 2025
@lsauerr I was able to reproduce an issue where the model was producing incorrect output, and found that it was an issue with the
split_with_sizesoperator. I have created a fix here: #15793If you are able, it would be great if you could try pulling the fix and checking to see if the issue persists. Thanks in advance!
P.S. For an easier repro, you can also use this PR #15795 where I add
YOLO_NAS_Sas an option inexport.pyPulling that branch will include the fix as well. Once the branch is checked out, you can test via
lsauerr commentedon Nov 13, 2025
Many thanks for that!
For anyone following this issue in the future, use the following to install (as pointed here):
CMAKE_ARGS="-DEXECUTORCH_BUILD_VULKAN=ON " ./install_executorch.sh -eI did the process on your branch and the test passed. However, when executing it with the executor_runner, the values are still diverging (and thus presenting non-replicable results).
I used the following to build the executor_runner, inside the branch you told me to checkout:
To execute it:
For what it is worth:
- The behavior has been noticed for x86_64 architecture and for an aarch64.
- I transformed the model using XnnpackPartitioner() instead of VulkanPartitioner() and executed it with executor_runner and the results did not diverge and were replicable across different runs.
- I attached the produced output to show the divergence. You can notice it on the end of the first tensor, with values around e+30.
output.txt
I transformed the model using XnnpackPartitioner() instead of VulkanPartitioner() and executed it with executor_runner and the results did not diverge and were replicable across different runs.
Any ideas on the cause? Many thanks for investigating it.
SS-JIA commentedon Nov 13, 2025
@lsauerr Unfortunately I'm not able to observe the divergence that you are seeing on my development machine. I actually tried on the
mainbranch as well, and could not see the divergence (although the outputs did appear to be incorrect) so I think the divergence you are observing is coming from a separate issue entirely which is not being addressed by my fix.Here are some things you can try. First, if you are exporting with the
-fp16option, try to turn that off. Next, try exporting without memory planning. You can do this by running:Finally, I have posted my full repro instructions below - it may be helpful to try it out and compare with my uploaded results. If you have an Android device on hand, it may be helpful to test on that device as well to see if the issue may be something particular to the GPU you are testing on.
For the record, I am testing on a machine equipped with an NVIDIA A100, here is the output of
nvidia-smi:Here are my full repro instructions (outputs attached in a separate comment) for your reference. Note that I have updated my branch to make testing a bit easier, in particular adding the ability to save input data to
export.py.SS-JIA commentedon Nov 13, 2025
Attached are the outputs I'm observing.
Output when testing on the main branch on my development machine:
yolonas_main.txt
Output when testing on the gh/SS-JIA/371/head branch on my development machine:
yolonas_with_fix.txt
Output when testing on the gh/SS-JIA/371/head branch, on an Android device:
yolonas_android_with_fix.txt
SS-JIA commentedon Nov 13, 2025
Re-uploading with stderr output as well so there's more context in the logs:
yolonas_with_fix.txt
yolonas_android_with_fix.txt
Update base for Update on "[ET-VK] Add some utility compile options +…
Update on "[ET-VK] Add some utility compile options + improve export …
Update base for Update on "[ET-VK] Add some utility compile options +…
Update on "[ET-VK] Add some utility compile options + improve export …
14 remaining items
SS-JIA commentedon Feb 4, 2026
@lsauerr
To help us debug further, I've created a debugging script (#17224) to extract parts of the YOLONAS model to identify at which point the model outputs start to become incorrect.
Would you be able to try running the script and letting me know the results? Thanks in advance 🙏
lsauerr commentedon Feb 5, 2026
Hi @SS-JIA,
Thanks for following up on this. I ran your script and the behavior was inconsistent: most of the time it passes, but eventually it fails for the full model. I haven't observed any occurrence of failure which happened before the full model pass.
The logs are attached, the yolonas_debug-*-clean.log has only the logs that you inserted on the debug script, while the others contains the full console output (other files logs + warnings and dependencies messages from other packages).
yolonas_debug-FAIL.log
yolonas_debug-FAIL-clean.log
yolonas_debug-PASS.log
yolonas_debug-PASS-clean.log
This runs were on the RTX 2000 ADA Generation GPU. Let me know if I can help you any further and again, many thanks for your great support!
SS-JIA commentedon Feb 5, 2026
@lsauerr thank you for that data! So basically, we're seeing that backbone + neck is always ok, but the full model fails occasionally for you. That should narrow it down to the heads part of the model.
Will provide an update in a bit!
SS-JIA commentedon Feb 5, 2026
@lsauerr I updated the script in #17224 to isolate parts of the heads model.
Based on the results, it's likely that the issue is somewhere in one of the following operators
which is the list of operators that are included in the full model, but not the backbone/neck
lsauerr commentedon Feb 6, 2026
Thanks for that @SS-JIA.
I ran the updated script and the model passes the Heads but it still fails on Full Model execution, please find the log attached.
yolonas_debug-HEADS-FAIL.log
Maybe it is not an operator issue but a race condition during execution?
SS-JIA commentedon Feb 9, 2026
@lsauerr I was investigating another issue with inconsistent model outputs on an NVIDIA GPU, and discovered a bug in how the delegate is setting up memory barriers that could be causing the behaviour we are seeing here. A fix for the bug is in #17309 - could you try building with that fix and seeing if you are still observing the issue?
On a separate note, did you ever try to export while disabling memory planning? This can be done via the compile options i.e.
If not, it would also be insightful to try this and see if you are still observing the same issue.
lsauerr commentedon Feb 10, 2026
@SS-JIA I've just tried to build the executor_runner binary with the fix and I still see the issue. I Imagine that's what you meant, let me know if I understood incorrectly.
I also tried to export it disabling the memory planning as you mentioned, and the issue persisted. As a reminder, I am seeing this behavior both for the NVIDIA GPU being used on the host on for the Arm Mali GPU being used on the target.
If useful at all, here is the console output I see:
stdout_stderr.txt
SS-JIA commentedon Feb 10, 2026
@lsauerr
I do recall you mentioning the embedded GPU. What is the exactly model of the Arm Mali GPU, and are you testing it via an Android phone - if so, which one? I have Pixel 7 and Pixel 8 devices on hand that I can try to test with, and see if I can reproduce the divergence.
Also, what's the rough frequency with which you see the behaviour? IIRC, you are not encountering the issue every inference but I may be wrong.
Next steps:
lsauerr commentedon Feb 10, 2026
@SS-JIA unfortunately I can't disclose the exact model of the GPU, sorry for that. Being Valhall architecture, I think it makes more sense to follow on with the Pixel 7 which has a Mali-G710 GPU.
I am not testing on an android phone, but in a SoC which is running on Linux 5.10.205 generated through Yocto.
That depends:
The executor_runner tests were performed using a
*.ptefile generated with the skip_memory_planning option. Yet, for reasons that go beyond my comprehension, if I run the test within gdb, the divergence seems to occur every time.SS-JIA commentedon Feb 14, 2026
@lsauerr sorry for the slow progress on this. Given that you are seeing this issue across both NVIDIA and Arm GPU, I don't think it's a driver specific issue. Perhaps the Vulkan backend has some kind of undefined behaviour in one of its shaders which is causing this divergent behaviour to manifest in certain drivers.
I tested the model once again on NVIDIA A100, Pixel 8 Pro and Pixel 7 Pro - this time, setting up a script to execute the model N times and check that the outputs are consistent across all runs. However, I am still seeing that the model produces consistent outputs even with 50 runs.
Repro Steps
Export Model
Run on Development Machine Setup
Runner script
Run on Android Setup
Script to execute multiple times and check all outputs are the same
Output:
SS-JIA commentedon Feb 14, 2026
@lsauerr
I would greatly appreciate it if you could help me grab some debug info from your machine 🙏
I've set up #17466 to add debug logging to the compute shaders to try and detect at what point tensor values start to become extremely large. You should be able to enable debug prints on your development machine via the Vulkan SDK (the Vulkan Configuration app specifically).
You can get the changes by pulling the
gh/SS-JIA/431/headbranch. Afterwards, you should be able to see some output like the following when outputs diverge:Note that the threshold in the print shaders should be 1e5, but I set it to 1e2 temporarily to demonstrate the prints.
Also, there may be a lot of output, please save everything to a file so everything is captured!
SS-JIA commentedon Feb 15, 2026
Tested on NVIDIA RTX 4080 as well, no divergence over 50 runs.
lsauerr commentedon Feb 16, 2026
Hi @SS-JIA, many thanks for all your effort on this!
I ran the tests on my development machine following the repro steps you mentioned. I hope these logs can help you:
runner_script.log
vk_debug.log
I set the validation layers as specified by Khronos group here. I also set the buffer size to something greater than the default:
export VK_LAYER_PRINTF_ONLY_PRESET=1export VK_LAYER_PRINTF_BUFFER_SIZE=32768Good luck hacking!
lsauerr commentedon Jun 2, 2026
Closing this issue. I have not seen this behavior on more recent releases of ExecuTorch, so probably this got fixed.
As a note, I was able to obtain the correct outputs for YOLO-NAS model by using the DFL output tensor, which contains the boxes coordinates and labels.
Thanks for the support!