Skip to content

OpenVINO Backend: Upgrade graph cache to use buffer pointers instead of names - #261

Draft
mostafafaheem wants to merge 36 commits into
ravi9:dev_backend_openvinofrom
mostafafaheem:improve_graph_key
Draft

OpenVINO Backend: Upgrade graph cache to use buffer pointers instead of names#261
mostafafaheem wants to merge 36 commits into
ravi9:dev_backend_openvinofrom
mostafafaheem:improve_graph_key

Conversation

@mostafafaheem

Copy link
Copy Markdown

Overview

This PR replaces using names for graph_key struct with buffer pointers+offsets. This was done due to the previous approach sometimes causing false negatives, where the first decode graph would be deemed a cache miss, even though it is the same as the prefill graph.

Additional information

Example:

diff --git a/../prefill_graph.txt b/../decode_graph.txt
index 18ed618be..b6822c19c 100644
--- a/../prefill_graph.txt
+++ b/../decode_graph.txt
@@ -15,14 +15,14 @@ Graph input: 6:1:node_5#5502
 Graph input: 7:0:node_6#5594
 Graph input: 8:0:leaf_7#905
 Graph input: 9:0:node_7#5617
-Graph input: 9:1: (view)#5686
+Graph input: 9:1:leaf_7 (view)#5686^M
 Graph input: 10:0:leaf_8
 Graph input: 10:1:node_5#5502
 Graph input: 11:0:node_10#5640
 Graph input: 11:1:leaf_9
 Graph input: 12:0:leaf_10#928
 Graph input: 13:0:node_11#5663
-Graph input: 13:1: (view)#5709
+Graph input: 13:1:leaf_10 (view)#5709^M
 Graph input: 14:0:leaf_17
 Graph input: 14:1:node_5#5502
 Graph input: 15:0:node_14#5525

The views in the first decode graph accessed the leaf_7 and leaf_10 tensors after they were named, whereas they were still unnamed when the prefill graph accessed them. This is purely a name difference, the underlying graph is the exact same.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES, AI was used to explain relevant code relating to constructing graph keys, and help implementing an alternative using buffer pointers.

zhaixuejun1993 and others added 30 commits July 14, 2026 09:33
…g_src to recorde the src ggml tensor for OpenVINO dynamic shape infer
enable qwen35

Fix after rebase

remove logging
…t reason: the backend test initializes unary op inputs over a wide range, [-150, 150]. For FP32, exp(x) overflows around x ~= 88.7, so this test can randomly generate values right in or beyond the overflow region
In stateful mode the NEOX RoPE branch fed rank-3 data ([S, n_heads,
head_size]) into the Multiply against the rank-4 cos/sin tables
([1, S, 1, n_dims/2]). That mixed-rank broadcast is miscomputed by the
OpenVINO GPU plugin, corrupting the rotated Q/K and producing garbage
output (e.g. Phi-3-mini). Lift the data to rank-4 before the split/
Multiply so the operands are equal-rank, matching what the TYPE_NORMAL
branch already does. CPU and stateless paths are unaffected.

Phi-3-mini-Q4_K_M, wiki.test perplexity, GPU stateful:
  before: PPL = 27120.43
  after:  PPL = 6.2263   (CPU reference: 6.2251)
…ov name in ov bk; 3) fix issue in arch test & op test with latest code update
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mostafafaheem
mostafafaheem marked this pull request as ready for review July 22, 2026 19:12
@mostafafaheem
mostafafaheem marked this pull request as draft July 23, 2026 17:50
@wine99
wine99 force-pushed the dev_backend_openvino branch from 4250de7 to 175f422 Compare July 27, 2026 04:33
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.

7 participants