Repository navigation
fix(npu_utils): give npu_cmd a virtual destructor - #1233
michyu-amd wants to merge 1 commit into
Conversation
Commands are owned as std::unique_ptr<npu_cmd> and deleted through the base pointer (npu_instr_utils clear_cmds), but npu_cmd had no virtual destructor: undefined behaviour, and every subclass object was freed with the base size (AddressSanitizer: new-delete-type-mismatch, about a million reports per request in an engine run). Add `virtual ~npu_cmd() = default;` to both the XRT and the HRX definition, in the dev-kit copy (FLM_DLL/include) and the app copy (src/include). npu_cmd already has virtual methods, so the object layout does not change. Co-Authored-By: Claude <noreply@anthropic.com>
Security scan found no critical or high findings on lines changed by this pull requestView the security scan run for complete reports. “New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta. |
Dev-kit benchResults of the dev-kit benches in Build and Test run 46993496660 for SummaryDev-kit bench (pr) on
|
| Model | Machine | Context | Decode base → dev-kit | Δ | Prefill base → dev-kit | Δ | Decode Δ vs nightly (same kind) |
|---|---|---|---|---|---|---|---|
| gemma3:1b | krackan | 1k | — → 43.8 | — | — → 851.4 | — | no baseline for this kind |
| gemma3:1b | krackan | 2k | — → 43.7 | — | — → 1034.4 | — | no baseline for this kind |
| gemma3:1b | krackan | 4k | — → 43.3 | — | — → 1245.6 | — | no baseline for this kind |
| gemma3:1b | krackan | 8k | — → 41.1 | — | — → 1472.8 | — | no baseline for this kind |
| lfm2.5-it:1.2b | strix | 1k | — → 63.0 | — | — → 1686.3 | — | no baseline for this kind |
| lfm2.5-it:1.2b | strix | 2k | — → 60.1 | — | — → 1957.7 | — | no baseline for this kind |
| lfm2.5-it:1.2b | strix | 4k | — → 54.9 | — | — → 2141.0 | — | no baseline for this kind |
| lfm2.5-it:1.2b | strix | 8k | — → 53.3 | — | — → 2339.4 | — | no baseline for this kind |
| qwen3.5:0.8b | strix | 1k | — → 48.7 | — | — → 1642.5 | — | no baseline for this kind |
| qwen3.5:0.8b | strix | 2k | — → 47.5 | — | — → 1928.4 | — | no baseline for this kind |
| qwen3.5:0.8b | strix | 4k | — → 46.2 | — | — → 2072.1 | — | no baseline for this kind |
| qwen3.5:0.8b | strix | 8k | — → 41.3 | — | — → 2240.4 | — | no baseline for this kind |
| qwen3:0.6b | strix | 1k | — → 83.3 | — | — → 1532.6 | — | no baseline for this kind |
| qwen3:0.6b | strix | 2k | — → 65.5 | — | — → 1912.9 | — | no baseline for this kind |
| qwen3:0.6b | strix | 4k | — → 46.4 | — | — → 1977.3 | — | no baseline for this kind |
| qwen3:0.6b | strix | 8k | — → 31.9 | — | — → 1821.5 | — | no baseline for this kind |
GSM8K accuracy (%)
| Model | Nightly baseline | This run | Δ (points) | Notes |
|---|---|---|---|---|
| gemma3:1b | — | 38.0 | — | 5 hit max_tokens |
| lfm2.5-it:1.2b | — | 66.0 | — | |
| qwen3.5:0.8b | — | 6.0 | — | 3 hit max_tokens |
| qwen3:0.6b | — | 36.0 | — | 4 hit max_tokens |
Linux HRX
Perf (tok/s; dev-kit against the base package on the same runner)
| Model | Machine | Context | Decode base → dev-kit | Δ | Prefill base → dev-kit | Δ | Decode Δ vs nightly (same kind) |
|---|---|---|---|---|---|---|---|
| gemma3:1b | strix | 1k | — → 41.2 | — | — → 873.5 | — | no baseline for this kind |
| gemma3:1b | strix | 2k | — → 41.0 | — | — → 1022.4 | — | no baseline for this kind |
| gemma3:1b | strix | 4k | — → 39.9 | — | — → 1141.8 | — | no baseline for this kind |
| gemma3:1b | strix | 8k | — → 38.3 | — | — → 1349.2 | — | no baseline for this kind |
| lfm2.5-it:1.2b | strix | 1k | — → 63.6 | — | — → 1715.6 | — | no baseline for this kind |
| lfm2.5-it:1.2b | strix | 2k | — → 62.3 | — | — → 2104.4 | — | no baseline for this kind |
| lfm2.5-it:1.2b | strix | 4k | — → 58.9 | — | — → 2267.5 | — | no baseline for this kind |
| lfm2.5-it:1.2b | strix | 8k | — → 54.6 | — | — → 2354.6 | — | no baseline for this kind |
| qwen3.5:0.8b | strix-halo | 1k | — → 45.4 | — | — → 1702.2 | — | no baseline for this kind |
| qwen3.5:0.8b | strix-halo | 2k | — → 44.4 | — | — → 2078.3 | — | no baseline for this kind |
| qwen3.5:0.8b | strix-halo | 4k | — → 42.5 | — | — → 2291.0 | — | no baseline for this kind |
| qwen3.5:0.8b | strix-halo | 8k | — → 38.7 | — | — → 2315.3 | — | no baseline for this kind |
| qwen3:0.6b | krackan | 1k | — → 74.8 | — | — → 1635.0 | — | no baseline for this kind |
| qwen3:0.6b | krackan | 2k | — → 59.3 | — | — → 2010.3 | — | no baseline for this kind |
| qwen3:0.6b | krackan | 4k | — → 45.2 | — | — → 2064.5 | — | no baseline for this kind |
| qwen3:0.6b | krackan | 8k | — → 30.6 | — | — → 1874.6 | — | no baseline for this kind |
GSM8K accuracy (%)
| Model | Nightly baseline | This run | Δ (points) | Notes |
|---|---|---|---|---|
| gemma3:1b | — | 38.0 | — | 5 hit max_tokens |
| lfm2.5-it:1.2b | — | 66.0 | — | |
| qwen3.5:0.8b | — | 6.0 | — | 3 hit max_tokens |
| qwen3:0.6b | — | 36.0 | — | 4 hit max_tokens |
Perf: flm bench, decode and prefill average tok/s per context. A/B is the one perf signal that judges a change; the runners differ by machine kind, so the nightly comparison is informational and only made for the same kind. Accuracy: GSM8K (first 50 questions) and DocVQA (when enabled), greedy; unanswered questions count as wrong. Per-question reports, server logs and CSVs: the devkit-bench-result-* artifacts.
npu_cmd is the base of all NPU instruction commands. Commands are owned as
std::unique_ptr<npu_cmd> and deleted through the base pointer
(npu_instr_utils.hpp clear_cmds), but npu_cmd had no virtual destructor.
That is undefined behaviour, and every subclass object was freed with the
base size.
Found with AddressSanitizer while debugging a Windows-only bug in the
minicpm-v-4.7-bf16 engine: about a million new-delete-type-mismatch reports
per request (unrelated to that bug, but it hides real findings).
Change:
virtual ~npu_cmd() = default;in both definitions (XRT and HRX) ofnpu_cmd already has virtual methods, so the object layout does not change.
Not touched: FLM_Xclbin/host_common (kernel host tests) and the LiquidAI
model's own copy.
Tests:
old header -> new-delete-type-mismatch (32 bytes freed as 8); new header -> clean
🤖 Generated with Claude Code