Commit 0d3d675
committed
Fix NPU segfault with two concurrent inference pipelines
When two gvadetect pipelines target device=NPU simultaneously the NPU
VCL compiler crashes with "ConvertVPUMI37XX2ELF failed: bad optional
access" followed by SIGSEGV.
Root causes and fixes:
1. ov::Core::compile_model() is not re-entrant for the NPU plugin.
The existing Meyers-singleton ov::Core is thread-safe to construct
but concurrent compile_model calls race inside the NPU driver.
Added a compile_mutex that serializes only compile_model and
remote-context creation — read_model is intentionally left
unserialized since it is a pure XML parse with no device contact.
2. gvafpscounter accesses its global fps_counters map without holding
channels_mutex in create_average, create_writepipe, create_readpipe,
new_frame and eos. Added the missing lock_guard in each.
3. NPU does not support batch-size > 1. Requesting batch-size=32
triggers a compiler crash even on a single pipeline. Added a clamp
to 1 with a warning when device contains "NPU".
Tested: 5/5 concurrent dual-pipeline runs pass (0/5 before fix).
Single pipeline: 90 FPS, no regression. Dual pipeline: 44 FPS each.1 parent 5b22540 commit 0d3d675
2 files changed
Lines changed: 36 additions & 19 deletions
File tree
- src
- gst/elements/gvafpscounter
- monolithic/inference_backend/image_inference/openvino
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 46 | + | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 58 | + | |
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
| |||
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
75 | 74 | | |
76 | 75 | | |
77 | | - | |
78 | | - | |
79 | | - | |
| 76 | + | |
| 77 | + | |
80 | 78 | | |
81 | 79 | | |
82 | 80 | | |
| |||
85 | 83 | | |
86 | 84 | | |
87 | 85 | | |
| 86 | + | |
88 | 87 | | |
89 | 88 | | |
90 | 89 | | |
| |||
102 | 101 | | |
103 | 102 | | |
104 | 103 | | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
Lines changed: 26 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
754 | 755 | | |
755 | 756 | | |
756 | 757 | | |
757 | | - | |
758 | 758 | | |
759 | 759 | | |
760 | 760 | | |
761 | 761 | | |
762 | 762 | | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
763 | 770 | | |
764 | 771 | | |
765 | 772 | | |
| |||
809 | 816 | | |
810 | 817 | | |
811 | 818 | | |
812 | | - | |
| 819 | + | |
813 | 820 | | |
814 | 821 | | |
815 | 822 | | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
816 | 828 | | |
817 | 829 | | |
818 | 830 | | |
| |||
1071 | 1083 | | |
1072 | 1084 | | |
1073 | 1085 | | |
1074 | | - | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
1079 | | - | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
1080 | 1096 | | |
1081 | | - | |
1082 | 1097 | | |
1083 | 1098 | | |
1084 | 1099 | | |
| |||
1129 | 1144 | | |
1130 | 1145 | | |
1131 | 1146 | | |
| 1147 | + | |
1132 | 1148 | | |
1133 | 1149 | | |
1134 | 1150 | | |
| |||
1144 | 1160 | | |
1145 | 1161 | | |
1146 | 1162 | | |
| 1163 | + | |
1147 | 1164 | | |
1148 | 1165 | | |
1149 | 1166 | | |
| |||
0 commit comments