Skip to content

openvino : enable qwen35 on NPU - #281

Merged
wine99 merged 1 commit into
dev_backend_openvinofrom
qwen35-npu
Aug 26, 2026
Merged

openvino : enable qwen35 on NPU#281
wine99 merged 1 commit into
dev_backend_openvinofrom
qwen35-npu

Conversation

@wine99

@wine99 wine99 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

The translation is verified with NPUW_DIVECES: CPU. However on LNL NPU inference crashes:

GGML OpenVINO backend ov::Exception: Exception from src/inference/src/cpp/infer_request.cpp:224:
Exception from src/plugins/intel_npu/src/utils/src/zero/zero_wrappers.cpp:382:
L0 zeFenceHostSynchronize result: ZE_RESULT_ERROR_DEVICE_LOST, code 0x70000001 - device hung, reset, was removed, or driver update occurred

@wine99

wine99 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

CI openvino-windows-2022 keeps failing on
24 - test-thread-safety (ILLEGAL) main
27 - test-backend-ops (ILLEGAL) main
while ubuntu-24-openvino passes

@wine99
wine99 force-pushed the dev_backend_openvino branch 2 times, most recently from 37b164f to 2bacf9e Compare August 14, 2026 05:24
@wine99
wine99 force-pushed the dev_backend_openvino branch from 678ba21 to 16f69ac Compare August 18, 2026 01:01
@ravi9
ravi9 force-pushed the dev_backend_openvino branch from eb54a50 to 04b5691 Compare August 18, 2026 14:43
@ravi9
ravi9 force-pushed the dev_backend_openvino branch from d691121 to 407e209 Compare August 25, 2026 16:53
@wine99

wine99 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

The model runs on PTL NPU with accuracy issue. Llama-simple is 5 tokens/second on NPU while OV CPU is 11 tokens/second.

The accuracy issue is likely bugs in the NPU plugin since changing NPUW_DEVICES to CPU produces the correct result.

Static shapes:
- get_graph_input_shape() left the s_copy / s_copy-leaf inputs dynamic
  ([1,1,1,-1]) even in static mode, which propagated a dynamic slot dim through
  GET_ROWS into the conv/GDN state, the state reshapes and the GDN output.
- With -np 1 the s_copy defrag remainder gathers zero rows; short-circuit that
  CPY to the untouched cache instead of emitting a degenerate Slice/Concat, and
  skip binding its zero-byte ggml tensor as an output (the dynamic path already
  did the latter, the static path wrote the full cache over a 0-byte buffer).

Token-count independence:
- In static mode the compiled model's token count is the prefill chunk size or
  1, not the captured cgraph's. Offsets derived from the captured count were
  therefore wrong. Anchor the GDN state slice at the end of the packed
  [attn | state] output and drop the rs_src_begin runtime inputs, and make
  VIEWs over the GDN output / conv_input pass through so the consumer does the
  slicing.
- CONT could not identify its token axis when the graph was captured with a
  single token (every trailing dim has the same stride and size 1) and baked
  the captured shape into the prefill model.

Chunked prefill:
- The last chunk is padded with fabricated tokens. Attention masks them, but
  the recurrent path folded them into cache_r/cache_s permanently. Add a
  chunk_valid_len runtime input, use it to zero g and beta for padded steps
  (making the recurrence an exact identity) and to end the conv snapshot window
  at the last valid token, and disable the recurrent-cache reset after the
  first chunk so earlier chunks are not wiped.
- get_is_prefill() and the chunk loop bound read inp_pos->ne[0] directly, but
  IMROPE stacks 4 position planes, so every decode step was run through the
  padded prefill model and the loop ran extra out-of-bounds chunks.

cache_rs_reset_idx/len now stay runtime Parameters in static mode, since
can_reuse_statically() does not invalidate the cached model on ComputeParams
changes. Add GGML_OPENVINO_FORCE_STATIC to exercise the static path on CPU.
@wine99
wine99 merged commit 9f0c9bd into dev_backend_openvino Aug 26, 2026
5 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant