oflm.exe prefill runs ~25% slower than it should: OpenMP worker threads spin
oflm serve and oflm bench print this at model load, and it's accurate:
open_qwen36: WARNING: VCOMP140.DLL was already loaded before OMP_WAIT_POLICY could be set, so the host workers will SPIN through every dispatch and the prefill will be ~20% slower.
The open engine sets OMP_WAIT_POLICY=PASSIVE from a static initializer, and oflm.exe delay-loads vcomp so that the setting lands before vcomp reads it. But eight of the closed model DLLs that oflm.exe links at load time import vcomp themselves: qwen3_6_moe_npu, qwen3_5vl_npu, qwen3_5_omni_npu, qwen3vl_npu, gemma_npu, gemma4e_npu, gemma4_12b_npu and gpt_oss_npu. So vcomp is already in the process before any of our code runs, the policy is never applied, and the host's OpenMP workers spin through every NPU dispatch. Spinning cores draw down the shared power budget and slow the NPU. The spec records this as unfixed (OPEN-PREFILL-BATCH, the 2026-09-21 result), and today the only workaround is setting the variable in the environment before launch.
Measured with oflm bench on Qwen3.6-35B-A3B q8 (#172's kernel set), HX 370, one iteration per length:
| context | prefill, as shipped | prefill, OMP_WAIT_POLICY=PASSIVE set beforehand |
|---|---|---|
| 1k | 84.0 tok/s | 109.3 tok/s |
| 2k | 87.8 | 116.3 |
| 4k | 93.8 | 117.7 |
| 8k | 92.1 | 115.9 |
Decode improves too (6.44 → 6.91 tok/s at 8k).
Proposed fix: delay-load those eight DLLs from oflm.exe as well, so vcomp loads only when one of them is first called, after the policy is set. A prototype links cleanly (none of them export data oflm.exe imports), and the warning is gone.
🤖 Generated with Claude Code
@Cyronius lazy-loading has almost never steered me wrong