OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[Core][ONNX FE][GPU] GroupQueryAttention: query_seqlens right-padded chunks Support (#39495)
Ankit Maheshkar8a91a733ef1c
diff --git a/src/common/transformations/include/transformations/op_conversions/group_query_attention_decomposition.hpp b/src/common/transformations/include/transformations/op_conversions/group_query_attention_decomposition.hppindex 8ed8b04e575..c1dc2d0d2bb 100644--- a/src/common/transformations/include/transformations/op_conversions/group_query_attention_decomposition.hpp+++ b/src/common/transformations/include/transformations/op_conversions/group_query_attention_decomposition.hpp@@ -59,6 +59,7 @@ protected:const ov::Output<ov::Node>& value,const std::shared_ptr<ov::Node>& kv_past_b,const std::shared_ptr<ov::Node>& kv_rows,+ const std::shared_ptr<ov::Node>& total_b,KVCacheMetadata& metadata);virtual std::shared_ptr<ov::Node> make_sdpa(const ov::Output<ov::Node>& query,const ov::Output<ov::Node>& key,@@ -96,6 +97,12 @@ protected:std::shared_ptr<ov::Node> get_dimensions(const std::shared_ptr<op::v3::ShapeOf>& shape,const std::vector<int>& dims);std::shared_ptr<ov::Node> get_dimensions(const ov::Output<ov::Node>& output, const std::vector<int>& dims);+ // Resizes a rank-4 KV cache buffer (axis 2) to ORT's max(past_rows, total_sequence_length) capacity: trims an+ // overlap in the buffer's tail, or pads headroom past it with unspecified (zero) filler rows. past_rows is an+ // i64 [1] node (e.g. from ShapeOf(past), or a zero Constant when there is no past tensor to read).+ ov::Output<ov::Node> resize_kv_to_capacity(const ov::Output<ov::Node>& past_rows,+ const ov::Output<ov::Node>& buffer,+ const ov::Output<ov::Node>& total_sequence_length);std::shared_ptr<ov::Node> rotaryEmbedding(ov::Output<ov::Node> input,ov::Output<ov::Node> cos,ov::Output<ov::Node> sin,diff --git a/src/common/transformations/src/transformations/op_conversions/group_query_attention_decomposition.cpp b/src/common/transformations/src/transformations/op_conversions/group_query_attention_decomposition.cppindex abc59d8c6dc..fb5d5e7490b 100644--- a/src/common/transformations/src/transformations/op_conversions/group_query_attention_decomposition.cpp+++ b/src/common/transformations/src/transformations/op_conversions/group_query_attention_decomposition.cpp@@ -183,6 +183,16 @@ ov::OutputVector ov::pass::GroupQueryAttentionDecomposition::decompose(const auto kv_seqlen = independent_kv_len ? get_dimensions(register_new_node<v3::ShapeOf>(K), {2}) : nullptr;const auto seqlens_elemi64 = register_new_node<v0::Convert>(seqlens_k, ov::element::i64);const auto real_seqlens = register_new_node<v1::Add>(seqlens_elemi64, one);+ // Right-padded chunk (query_seqlens): only the first Q of the S query rows are real tokens, so the past is+ // total - Q. All S rows are still written at [past, past + S) to keep shapes static; the padded tail lands at or+ // beyond total, where no query reads it and the next step overwrites it (ORT requires past + S <= capacity).+ // Like seqlens_k, Q is taken as given (ORT: 0 <= Q <= min(S, total)); Q = 0 marks an idle entry (past = total),+ // whose rows all land at or beyond total, so its valid cache is unchanged.+ const bool has_query_seqlens = node->has_query_seqlens();+ const auto query_seqlens_i64 =+ has_query_seqlens+ ? register_new_node<v0::Convert>(get_input(GQAInputs::QUERY_SEQLENS), ov::element::i64)->output(0)+ : ov::Output<ov::Node>();// Per-batch lengths (ORT: one seqlens_k entry per batch) whenever the batch is not statically 1. A static batch// of 1 keeps the scalar-length graph below unchanged, since plugins and the NPU compiler pattern-match it; the@@ -192,7 +202,7 @@ ov::OutputVector ov::pass::GroupQueryAttentionDecomposition::decompose(!(q_ps.rank().is_static() && q_ps[0].is_static() && q_ps[0].get_length() == 1);// [B, 1, 1]: total = seqlens_k + 1, the causal offset of the first query (ORT: 0 for a first, right-padded// prompt, total - S otherwise), and the row the first new key is written at.- std::shared_ptr<ov::Node> total_b, q_past_b, kv_past_b;+ std::shared_ptr<ov::Node> total_b, q_past_b, kv_past_b, query_len_b;if (batched) {// [B, 1, 1] with B taken from the query, so a seqlens_k without one entry per batch fails the Reshape// instead of broadcasting one length over every batch (ORT requires batch_size elements).@@ -201,16 +211,20 @@ ov::OutputVector ov::pass::GroupQueryAttentionDecomposition::decompose(register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{2}, {1, 1}))},0);total_b = register_new_node<v1::Reshape>(real_seqlens, per_batch, false);- q_past_b = register_new_node<v1::Maximum>(register_new_node<v1::Subtract>(total_b, current_seqlen), zero);- kv_past_b = independent_kv_len+ query_len_b =+ has_query_seqlens ? register_new_node<v1::Reshape>(query_seqlens_i64, per_batch, false) : current_seqlen;+ q_past_b = register_new_node<v1::Maximum>(register_new_node<v1::Subtract>(total_b, query_len_b), zero);+ // A padded chunk carries full S-row keys (ORT), so its keys start at the query past as well.+ kv_past_b = independent_kv_len && !has_query_seqlens? register_new_node<v1::Maximum>(register_new_node<v1::Subtract>(total_b, kv_seqlen), zero): q_past_b;}// A single batch entry uses scalar ([1]) lengths; only built when not batched (the [1] reshape needs batch 1).- std::shared_ptr<ov::Node> seqlens_1d, past_seqlen;+ std::shared_ptr<ov::Node> seqlens_1d, past_seqlen, query_len;if (!batched) {seqlens_1d = register_new_node<v1::Reshape>(real_seqlens, one, false);- past_seqlen = register_new_node<v1::Subtract>(seqlens_1d, current_seqlen);+ query_len = has_query_seqlens ? register_new_node<v1::Reshape>(query_seqlens_i64, one, false) : current_seqlen;+ past_seqlen = register_new_node<v1::Subtract>(seqlens_1d, query_len);}const auto curr_seqlen_scalar = register_new_node<v0::Squeeze>(current_seqlen);@@ -240,14 +254,27 @@ ov::OutputVector ov::pass::GroupQueryAttentionDecomposition::decompose(position_ids = register_new_node<v1::Reshape>(get_input(GQAInputs::POSITION_IDS), rows, false);} else {const auto column = register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{2}, {-1, 1}));+ const auto rows = position_ids;position_ids =- register_new_node<v1::Add>(register_new_node<v1::Reshape>(q_past_b, column, false), position_ids);+ register_new_node<v1::Add>(register_new_node<v1::Reshape>(q_past_b, column, false), rows);+ if (has_query_seqlens) {+ // Padded rows (P + s >= total) are capped at the last valid position, a valid rotary-cache row;+ // their outputs are unspecified (ORT) and valid rows are unchanged.+ position_ids =+ register_new_node<v1::Minimum>(position_ids,+ register_new_node<v1::Reshape>(seqlens_elemi64, column, false));+ }}} else if (has_input(GQAInputs::POSITION_IDS)) {// Flatten position_ids to 1D so that Gather produces 2D [seqlen, head_size/2] output,// ensuring correct 4D shapes after Unsqueeze in rotaryEmbedding.const auto neg_one = register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{1}, {-1}));position_ids = register_new_node<v1::Reshape>(get_input(GQAInputs::POSITION_IDS), neg_one, false);+ } else if (has_query_seqlens) {+ // Padded rows (P + s >= total) are capped at the last valid position, a valid rotary-cache row; their+ // outputs are unspecified (ORT) and valid rows are unchanged.+ position_ids = register_new_node<v1::Minimum>(register_new_node<v1::Add>(position_ids, past_seqlen),+ register_new_node<v1::Reshape>(seqlens_elemi64, one, false));} else {position_ids = register_new_node<v1::Add>(position_ids, past_seqlen);}@@ -266,9 +293,40 @@ ov::OutputVector ov::pass::GroupQueryAttentionDecomposition::decompose(K = rotaryEmbedding(K, cos, sin, rotary_interleaved);}}+ // Zero padded K/V rows (s >= Q): masking alone lets NaN filler reach valid rows via the scores and 0 * V.+ // A single-token step skips it: its padded entries are idle, so no valid query reads them.+ const bool single_token_step = q_ps.rank().is_static() && q_ps[2].is_static() && q_ps[2].get_length() == 1;+ if (has_query_seqlens && !single_token_step) {+ const auto rows = register_new_node<v1::Reshape>(+ register_new_node<v4::Range>(zero_without_shape, curr_seqlen_scalar, one_without_shape, ov::element::i64),+ register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{4}, {1, 1, -1, 1})),+ false);+ const auto valid_rows = register_new_node<v1::Less>(+ rows,+ register_new_node<v1::Reshape>(+ query_seqlens_i64,+ register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{4}, {-1, 1, 1, 1})),+ false));+ K = register_new_node<v1::Select>(+ valid_rows,+ K,+ register_new_node(v0::Constant::create(K.get_element_type(), ov::Shape{}, {0})));+ V = register_new_node<v1::Select>(+ valid_rows,+ V,+ register_new_node(v0::Constant::create(V.get_element_type(), ov::Shape{}, {0})));+ }// Absent past inputs and zero-capacity caches both use current K/V as the complete cache.const bool empty_past =!has_past || (past_key.get_partial_shape()[2].is_static() && past_key.get_partial_shape()[2].get_length() == 0);+ // A padded growing cache sizes present to total_sequence_length even with an empty past, so it always goes+ // through construct_kvcache (overridable by plugins). query_seqlens requires a rank-4 past, possibly a+ // typed-empty Constant that has_input() reports as absent.+ const bool padded_growing_cache = has_query_seqlens && !node->get_sliding_window_cache();+ if (padded_growing_cache && !has_past) {+ past_key = node->input_value(static_cast<size_t>(GQAInputs::PAST_KEY));+ past_value = node->input_value(static_cast<size_t>(GQAInputs::PAST_VALUE));+ }// Quantize-on-write: when the cache is quantized, quantize the (post-RoPE) current K/V into the cache type// before appending them, so the assembled present cache stays quantized and the past bytes are preserved@@ -295,8 +353,8 @@ ov::OutputVector ov::pass::GroupQueryAttentionDecomposition::decompose(V = past_value;present_k = past_key;present_v = past_value;- } else if (empty_past) {- // With no past tokens, the current K/V already are the complete present cache.+ } else if (empty_past && !padded_growing_cache) {+ // With no past tokens, the current K/V are the complete present cache.present_k = K;present_v = V;} else {@@ -307,6 +365,7 @@ ov::OutputVector ov::pass::GroupQueryAttentionDecomposition::decompose(V,kv_past_b,independent_kv_len ? kv_seqlen : current_seqlen,+ total_b,*metadata): construct_kvcache(node,past_key,@@ -368,7 +427,15 @@ ov::OutputVector ov::pass::GroupQueryAttentionDecomposition::decompose(const bool has_sink = has_head_sink || smooth_softmax;// The explicit chain has no is_causal fallback, and shared KV must hide the past rows beyond `total`, so both// always take the explicit (base) mask; overrides may otherwise drop it in favor of SDPA's causal flag.- const bool explicit_mask = use_explicit_attention || shared_kv;+ // A declared fixed (static) capacity can likewise sit in a capacity-padded KV buffer once query_seqlens grows+ // it past its static size, where kv_len - S no longer equals the true past offset -- an override's implicit+ // causal alignment (SDPA's native is_causal, which assumes the query is the buffer's tail) would then be+ // wrong, so force the explicit mask (built from the real past offset) there too. A growing (non-fixed-+ // capacity) or windowed cache keeps its existing exactly-sized buffer invariant (no capacity slack), so both+ // are left out to keep their native fast paths.+ const bool explicit_mask =+ use_explicit_attention || shared_kv ||+ (has_query_seqlens && node->has_fixed_kv_capacity() && !node->get_sliding_window_cache());// qk_output before softmax reports masked positions as 0 (ORT); they are found on the bias-free mask, so a large// negative attention_bias reads logit + bias. The mask is then built once without the bias, and the aligned bias// is added on top (same op count as the fused form).@@ -469,13 +536,28 @@ ov::OutputVector ov::pass::GroupQueryAttentionDecomposition::decompose(qga_output = attention[0];if (qk_output != ov::op::internal::GroupQueryAttentionQKOutput::NONE) {// ONNX Runtime lays output_qk out over the total_sequence_length input, which a static or shared cache- // does not tie to seqlens_k; the per-batch lengths only mask. Extra cache rows are dropped here.+ // does not tie to seqlens_k; the per-batch lengths only mask. Extra attention columns are dropped by+ // the Slice; a padded chunk's total_sequence_length can instead exceed the tight attention buffer+ // (it pre-allocates present-cache headroom), so pad the shortfall with zero filler columns to match.const auto three = register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{1}, {3}));const auto total_cols = register_new_node<v1::Reshape>(register_new_node<v0::Convert>(get_input(GQAInputs::TOTAL_SEQUENCE_LENGTH), ov::element::i64),one,false);qk_scores = register_new_node<v8::Slice>(attention[1], zero, total_cols, one, three);+ if (node->has_query_seqlens()) {+ const auto attention_shape = register_new_node<v3::ShapeOf>(attention[1]);+ const auto attention_cols = get_dimensions(attention_shape, {3});+ const auto extra =+ register_new_node<v1::Maximum>(register_new_node<v1::Subtract>(total_cols, attention_cols), zero);+ const auto filler_shape =+ register_new_node<v0::Concat>(ov::OutputVector{get_dimensions(attention_shape, {0, 1, 2}), extra},+ 0);+ const auto filler = register_new_node<v3::Broadcast>(+ register_new_node(v0::Constant::create(attention[1].get_element_type(), ov::Shape{}, {0})),+ filler_shape);+ qk_scores = register_new_node<v0::Concat>(ov::OutputVector{qk_scores, filler}, 3)->output(0);+ }}} else if (sink.get_node_shared_ptr()) {// SDPA's 6-input form requires an explicit scale.@@ -500,6 +582,44 @@ ov::OutputVector ov::pass::GroupQueryAttentionDecomposition::decompose(return {output, present_k, present_v};}+ov::Output<ov::Node> ov::pass::GroupQueryAttentionDecomposition::resize_kv_to_capacity(+ const ov::Output<ov::Node>& past_rows,+ const ov::Output<ov::Node>& buffer,+ const ov::Output<ov::Node>& total_sequence_length) {+ // Skip building the Slice/Broadcast/Concat growth entirely when it would be a no-op: a statically-sized+ // buffer that's already EXACTLY capacity rows never needs trimming or filler, so the result is just the+ // buffer unchanged. A buffer bigger than capacity must still go through the Slice below to trim it down+ // (not just "already covers" -- that would wrongly return an oversized buffer as-is).+ const auto& buffer_ps = buffer.get_partial_shape();+ if (buffer_ps.rank().is_static() && buffer_ps[2].is_static()) {+ const auto past_rows_const = ov::util::get_constant_from_source(past_rows);+ const auto total_const = ov::util::get_constant_from_source(total_sequence_length);+ if (past_rows_const && total_const) {+ const auto capacity =+ std::max(past_rows_const->cast_vector<int64_t>().at(0), total_const->cast_vector<int64_t>().at(0));+ if (capacity == buffer_ps[2].get_length()) {+ return buffer;+ }+ }+ }+ const auto zero = register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{1}, {0}));+ const auto one = register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{1}, {1}));+ const auto two = register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{1}, {2}));+ const auto buffer_shape = register_new_node<v3::ShapeOf>(buffer);+ const auto buffer_rows = get_dimensions(buffer_shape, {2});+ const auto capacity = register_new_node<v1::Maximum>(past_rows, total_sequence_length);+ const auto trimmed =+ register_new_node<v8::Slice>(buffer, zero, register_new_node<v1::Minimum>(capacity, buffer_rows), one, two);+ const auto extra = register_new_node<v1::Maximum>(register_new_node<v1::Subtract>(capacity, buffer_rows), zero);+ const auto filler_shape = register_new_node<v0::Concat>(+ ov::OutputVector{get_dimensions(buffer_shape, {0, 1}), extra, get_dimensions(buffer_shape, {3})},+ 0);+ const auto filler = register_new_node<v3::Broadcast>(+ register_new_node(v0::Constant::create(buffer.get_element_type(), ov::Shape{}, {0})),+ filler_shape);+ return register_new_node<v0::Concat>(ov::OutputVector{trimmed, filler}, 2)->output(0);+}+ov::pass::GroupQueryAttentionDecomposition::KVCacheOutputsov::pass::GroupQueryAttentionDecomposition::construct_kvcache(const std::shared_ptr<ov::op::internal::GroupQueryAttention>& node,@@ -545,8 +665,9 @@ ov::pass::GroupQueryAttentionDecomposition::construct_kvcache(// an eviction, making the in-place kept = end_after - S negative, so it takes the staging path below.// A statically-known S > 1 is rejected up front (FE + op), so it never reaches here.const auto& q_ps = node->get_input_partial_shape(0);+ // An idle single-token entry (query_seqlens = 0) appends nothing, so it takes the staging path as well.const bool static_single_token = q_ps.rank().is_static() && q_ps.rank().get_length() == 4 &&- q_ps[2].is_static() && q_ps[2].get_length() == 1;+ q_ps[2].is_static() && q_ps[2].get_length() == 1 && !node->has_query_seqlens();const auto scatter_axis = register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{1}, {2}));const auto zeros =@@ -595,7 +716,13 @@ ov::pass::GroupQueryAttentionDecomposition::construct_kvcache(const auto temp_v = register_new_node<v0::Concat>(ov::OutputVector{resident_v, value}, 2);// tail = last end_after rows of the temp buffer, scattered into [0, end_after) of the C buffer.- const auto temp_len = register_new_node<v1::Add>(end_before, current_seqlen_scalar);+ // A right-padded chunk (query_seqlens) has only Q = total - past valid rows: its padded tail stays+ // in the temp buffer (masked for the valid queries) but is never written back.+ const ov::Output<ov::Node> new_rows =+ node->has_query_seqlens()+ ? register_new_node<v1::Subtract>(abs_total_scalar, abs_past_scalar)->output(0)+ : current_seqlen_scalar;+ const auto temp_len = register_new_node<v1::Add>(end_before, new_rows);const auto tail_start = register_new_node<v1::Subtract>(temp_len, end_after);const auto tail_start_1d = register_new_node<v0::Unsqueeze>(tail_start, zero);const auto temp_len_1d = register_new_node<v0::Unsqueeze>(temp_len, zero);@@ -620,29 +747,85 @@ ov::pass::GroupQueryAttentionDecomposition::construct_kvcache(// An out-of-range past_seqlen is ScatterUpdate's own bounds-check responsibility, not something to// guard against here via a graph-level clamp; the decomposition assumes the caller-supplied// seqlens_k stays within the declared cache capacity.+ // query_seqlens can need more rows than the declared capacity (ORT: max(past_rows, total_sequence_length)).+ // Grow with zero filler first so the scatter stays in bounds; a no-op Slice when capacity already covers it.+ ov::Output<ov::Node> base_key = past_key;+ ov::Output<ov::Node> base_value = past_value;+ const auto total_seqlen_pos = static_cast<size_t>(GQAInputs::TOTAL_SEQUENCE_LENGTH);+ const bool has_total_sequence_length = node->has_query_seqlens() && total_seqlen_pos < node->get_input_size() &&+ !ov::util::is_empty_constant_tensor(node->input_value(total_seqlen_pos));+ ov::Output<ov::Node> total_sequence_length;+ if (has_total_sequence_length) {+ total_sequence_length = register_new_node<v1::Reshape>(+ register_new_node<v0::Convert>(node->input_value(total_seqlen_pos), ov::element::i64),+ one,+ false);+ const auto past_rows = get_dimensions(register_new_node<v3::ShapeOf>(past_key), {2});+ base_key = resize_kv_to_capacity(past_rows, past_key, total_sequence_length);+ base_value = resize_kv_to_capacity(past_rows, past_value, total_sequence_length);+ }std::shared_ptr<ov::Node> scatter_idx = register_new_node<v4::Range>(zero_without_shape,current_seqlen_scalar,one_without_shape,ov::element::i64);scatter_idx = register_new_node<v1::Add>(scatter_idx, past_seqlen);const auto scatter_axis = register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{1}, {2}));- outputs.present_key = register_new_node<v3::ScatterUpdate>(past_key, scatter_idx, key, scatter_axis);- outputs.present_value = register_new_node<v3::ScatterUpdate>(past_value, scatter_idx, value, scatter_axis);+ outputs.present_key = register_new_node<v3::ScatterUpdate>(base_key, scatter_idx, key, scatter_axis);+ outputs.present_value = register_new_node<v3::ScatterUpdate>(base_value, scatter_idx, value, scatter_axis);+ if (node->has_query_seqlens()) {+ // Positions >= the valid total may hold never-written filler. Masking alone can't neutralize NaN+ // there (NaN + mask bias is still NaN), so zero it directly, mirroring the new-chunk padding above.+ const auto capacity = get_dimensions(register_new_node<v3::ShapeOf>(outputs.present_key), {2});+ const auto rows = register_new_node<v1::Reshape>(+ register_new_node<v4::Range>(zero_without_shape,+ register_new_node<v0::Squeeze>(capacity),+ one_without_shape,+ ov::element::i64),+ register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{4}, {1, 1, -1, 1})),+ false);+ const auto valid_cols = register_new_node<v1::Less>(rows, seqlens_1d);+ const auto zero_fill = register_new_node(v0::Constant::create(kv_cache_type, ov::Shape{}, {0}));+ outputs.present_key = register_new_node<v1::Select>(valid_cols, outputs.present_key, zero_fill);+ outputs.present_value = register_new_node<v1::Select>(valid_cols, outputs.present_value, zero_fill);+ }outputs.sdpa_key = outputs.present_key;outputs.sdpa_value = outputs.present_value;} else {auto construct_kv_cache = [&](const ov::Output<ov::Node>& past, const ov::Output<ov::Node>& current) {return register_new_node<v0::Concat>(ov::OutputVector{past, current}, 2);};- const ov::Output<ov::Node> kept_past = independent_kv_len+ // A padded chunk (query_seqlens) carries full S-row keys starting at the query past.+ const ov::Output<ov::Node> kept_past = independent_kv_len && !node->has_query_seqlens()? register_new_node<v1::Subtract>(seqlens_1d, kv_seqlen)->output(0): past_seqlen->output(0);const auto sliced_past_key = register_new_node<v8::Slice>(past_key, zero, kept_past, one, two);const auto sliced_past_value = register_new_node<v8::Slice>(past_value, zero, kept_past, one, two);- outputs.present_key = construct_kv_cache(sliced_past_key, key);- outputs.present_value = construct_kv_cache(sliced_past_value, value);- outputs.sdpa_key = outputs.present_key;- outputs.sdpa_value = outputs.present_value;+ outputs.sdpa_key = construct_kv_cache(sliced_past_key, key);+ outputs.sdpa_value = construct_kv_cache(sliced_past_value, value);+ const auto total_seqlen_pos = static_cast<size_t>(GQAInputs::TOTAL_SEQUENCE_LENGTH);+ const bool has_total_sequence_length = total_seqlen_pos < node->get_input_size() &&+ !ov::util::is_empty_constant_tensor(node->input_value(total_seqlen_pos));+ if (node->has_query_seqlens() && has_total_sequence_length) {+ // sdpa_key/value already hold the chunk correctly placed at [kept_past, kept_past + rows(current)),+ // with no overlap to fix up (sliced_past_key/value are trimmed to exactly kept_past). present only+ // needs resizing to ORT's max(past_rows, total_sequence_length) capacity, independent of that write+ // window (total_sequence_length is optional -- required only for qk_output -- so present stays+ // sdpa-sized when it's absent).+ const auto total_sequence_length = register_new_node<v1::Reshape>(+ register_new_node<v0::Convert>(node->input_value(total_seqlen_pos), ov::element::i64),+ one,+ false);+ outputs.present_key = resize_kv_to_capacity(get_dimensions(register_new_node<v3::ShapeOf>(past_key), {2}),+ outputs.sdpa_key,+ total_sequence_length);+ outputs.present_value =+ resize_kv_to_capacity(get_dimensions(register_new_node<v3::ShapeOf>(past_value), {2}),+ outputs.sdpa_value,+ total_sequence_length);+ } else {+ outputs.present_key = outputs.sdpa_key;+ outputs.present_value = outputs.sdpa_value;+ }}return outputs;}@@ -656,9 +839,11 @@ ov::pass::GroupQueryAttentionDecomposition::construct_batched_kvcache(const ov::Output<ov::Node>& value,const std::shared_ptr<ov::Node>& kv_past_b,const std::shared_ptr<ov::Node>& kv_rows,+ const std::shared_ptr<ov::Node>& total_b,[[maybe_unused]] KVCacheMetadata& metadata) {const auto zero = register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{1}, {0}));const auto zero_without_shape = register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{}, {0}));+ const auto one = register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{1}, {1}));const auto one_without_shape = register_new_node(v0::Constant::create(ov::element::i64, ov::Shape{}, {1}));const auto kv_num_heads = node->get_kv_num_heads();const auto is_static_input = node->has_fixed_kv_capacity();@@ -697,9 +882,33 @@ ov::pass::GroupQueryAttentionDecomposition::construct_batched_kvcache(ov::element::i64),as_shape({1, 1, -1, 1}),false)); // [B, 1, S_kv, 1]+ // ORT's growing-cache present capacity is max(past_rows, total_sequence_length) (CheckInputs in+ // onnxruntime/contrib_ops/cpu/bert/group_query_attention_helper.h), a caller-declared value independent of+ // this step's write. Only a padded chunk can disagree with the plain past+kv_rows append below -- an ordinary+ // step's total_sequence_length always equals past_rows + kv_rows by ORT's own validation.+ const auto total_seqlen_pos = static_cast<size_t>(GQAInputs::TOTAL_SEQUENCE_LENGTH);+ const bool has_total_sequence_length = node->has_query_seqlens() && total_seqlen_pos < node->get_input_size() &&+ !ov::util::is_empty_constant_tensor(node->input_value(total_seqlen_pos));+ const ov::Output<ov::Node> total_sequence_length =+ has_total_sequence_length+ ? register_new_node<v1::Reshape>(+ register_new_node<v0::Convert>(node->input_value(total_seqlen_pos), ov::element::i64),+ one,+ false)+ ->output(0)+ : ov::Output<ov::Node>();const auto write = [&](const ov::Output<ov::Node>& past, const ov::Output<ov::Node>& current) {- const ov::Output<ov::Node> buffer =- is_static_input ? past : register_new_node<v0::Concat>(ov::OutputVector{past, current}, 2)->output(0);+ // Same capacity grow-before-scatter as the non-batched writer above.+ ov::Output<ov::Node> buffer;+ if (is_static_input) {+ buffer = has_total_sequence_length+ ? resize_kv_to_capacity(get_dimensions(register_new_node<v3::ShapeOf>(past), {2}),+ past,+ total_sequence_length)+ : past;+ } else {+ buffer = register_new_node<v0::Concat>(ov::OutputVector{past, current}, 2)->output(0);+ }const auto buffer_shape = register_new_node<v3::ShapeOf>(buffer);const auto rows_per_head = get_dimensions(buffer_shape, {2});const auto flat_idx = register_new_node<v1::Reshape>(@@ -717,8 +926,37 @@ ov::pass::GroupQueryAttentionDecomposition::construct_batched_kvcache(};outputs.sdpa_key = write(past_key, key);outputs.sdpa_value = write(past_value, value);- outputs.present_key = outputs.sdpa_key;- outputs.present_value = outputs.sdpa_value;+ if (node->has_query_seqlens()) {+ // Same unwritten-capacity-tail NaN hazard as the non-batched writer (see construct_kvcache above), per+ // batch: zero columns at or beyond that batch's running valid total (total_b). Applies to both the+ // static (preallocated, grown-before-scatter) and dynamic (Concat-grown) buffers above -- a dynamic+ // past Parameter can itself carry unwritten/garbage rows beyond this batch's valid length.+ const auto capacity = get_dimensions(register_new_node<v3::ShapeOf>(outputs.sdpa_key), {2});+ const auto rows =+ register_new_node<v1::Reshape>(register_new_node<v4::Range>(zero_without_shape,+ register_new_node<v0::Squeeze>(capacity),+ one_without_shape,+ ov::element::i64),+ as_shape({1, 1, -1, 1}),+ false);+ const auto valid_cols =+ register_new_node<v1::Less>(rows, register_new_node<v1::Reshape>(total_b, as_shape({-1, 1, 1, 1}), false));+ const auto zero_fill = register_new_node(v0::Constant::create(past_key.get_element_type(), ov::Shape{}, {0}));+ outputs.sdpa_key = register_new_node<v1::Select>(valid_cols, outputs.sdpa_key, zero_fill);+ outputs.sdpa_value = register_new_node<v1::Select>(valid_cols, outputs.sdpa_value, zero_fill);+ }+ // Attention stays on the tight scatter-corrected buffer above; present is separately resized to capacity.+ if (!is_static_input && has_total_sequence_length) {+ outputs.present_key = resize_kv_to_capacity(get_dimensions(register_new_node<v3::ShapeOf>(past_key), {2}),+ outputs.sdpa_key,+ total_sequence_length);+ outputs.present_value = resize_kv_to_capacity(get_dimensions(register_new_node<v3::ShapeOf>(past_value), {2}),+ outputs.sdpa_value,+ total_sequence_length);+ } else {+ outputs.present_key = outputs.sdpa_key;+ outputs.present_value = outputs.sdpa_value;+ }return outputs;}diff --git a/src/common/transformations/tests/op_conversions/group_query_attention_decomposition_test.cpp b/src/common/transformations/tests/op_conversions/group_query_attention_decomposition_test.cppindex a47ead106fe..8017e6d2ecd 100644--- a/src/common/transformations/tests/op_conversions/group_query_attention_decomposition_test.cpp+++ b/src/common/transformations/tests/op_conversions/group_query_attention_decomposition_test.cpp@@ -39,6 +39,7 @@#include "openvino/op/tanh.hpp"#include "openvino/op/variadic_split.hpp"#include "openvino/pass/manager.hpp"+#include "openvino/runtime/tensor.hpp"#include "ov_ops/rms.hpp"#include "transformations/common_optimizations/rms_fusion.hpp"@@ -549,6 +550,33 @@ TEST(GroupQueryAttentionValues, shared_kv_attends_to_past_and_returns_it_as_presEXPECT_TRUE(params[1]->output(0).get_target_inputs().empty());}+// An empty (0-row) past still has ORT's max(past_rows, total_sequence_length) capacity contract: total_sequence_length+// can pre-allocate present-cache headroom beyond the first chunk, so present must not stay sized to just the+// current chunk's S rows. A windowed cache is excluded (it keeps its own past_rows-only capacity rule).+TEST(GroupQueryAttentionValues, padded_query_empty_past_keeps_total_sequence_length_capacity) {+ const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{1, 4, 2, 8});+ const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{1, 2, 2, 8});+ const auto value = std::make_shared<op::v0::Parameter>(element::f32, Shape{1, 2, 2, 8});+ const auto empty_past = op::v0::Constant::create(element::f32, Shape{1, 2, 0, 8}, {});+ const auto seqlens_k = std::make_shared<op::v0::Parameter>(element::i32, Shape{1});+ const auto total_length = op::v0::Constant::create(element::i32, Shape{}, {10});+ const auto empty = op::v0::Constant::create(element::dynamic, Shape{0}, {});+ OutputVector args{query, key, value, empty_past, empty_past, seqlens_k, total_length};+ args.resize(16, empty);+ const auto query_seqlens = std::make_shared<op::v0::Parameter>(element::i32, Shape{1});+ args.push_back(query_seqlens);+ const auto gqa = std::make_shared<GroupQueryAttention>(args, 4, 2, 0.0f, false, false);+ ASSERT_TRUE(gqa->has_query_seqlens());+ const auto expected_shape = PartialShape{1, 2, 10, 8};+ EXPECT_EQ(gqa->get_output_partial_shape(1), expected_shape);+ EXPECT_EQ(gqa->get_output_partial_shape(2), expected_shape);++ auto model = std::make_shared<Model>(gqa->outputs(), ParameterVector{query, key, value, seqlens_k, query_seqlens});+ decompose(model);+ EXPECT_EQ(model->get_results()[1]->get_output_partial_shape(0), expected_shape);+ EXPECT_EQ(model->get_results()[2]->get_output_partial_shape(0), expected_shape);+}+TEST(GroupQueryAttentionValues, absent_past_returns_current_kv_as_present) {const auto query = std::make_shared<op::v0::Parameter>(element::f32, Shape{1, 4, 3, 8});const auto key = std::make_shared<op::v0::Parameter>(element::f32, Shape{1, 2, 3, 8});@@ -903,6 +931,306 @@ TEST(GroupQueryAttentionValues, batched_cache_update_is_per_batch) {}}+// ORT sizes a growing cache's public present to max(past_rows, total_sequence_length) (CheckInputs in+// onnxruntime/contrib_ops/cpu/bert/group_query_attention_helper.h), not to the write window a padded chunk+// actually touches. A sliced present output would hide an undersized buffer, so this evaluates the raw+// (unsliced) decomposed graph with the exact P=3/S=4/Q=2/past_rows=5/total_sequence_length=10 scenario where the+// two differ (write end = 3 + 4 = 7, but ORT's declared capacity is max(5, 10) = 10), and checks both the+// resulting shape and that the unwritten past prefix survives untouched.+TEST(GroupQueryAttentionValues, padded_query_growing_cache_present_keeps_total_sequence_length_capacity) {+ const auto f32 = element::f32;+ constexpr int64_t S = 4;+ constexpr int64_t past_rows = 5;+ constexpr int64_t total_sequence_length = 10;+ constexpr int64_t kept_past = 3; // P = max(total - Q, 0) = max((seqlens_k + 1) - query_seqlens, 0) = max(5-2,0)++ auto q = std::make_shared<op::v0::Parameter>(f32, PartialShape{Dimension::dynamic(), NUM_HEADS, S, HEAD_SIZE});+ auto k = std::make_shared<op::v0::Parameter>(f32, PartialShape{Dimension::dynamic(), KV_NUM_HEADS, S, HEAD_SIZE});+ auto v = std::make_shared<op::v0::Parameter>(f32, PartialShape{Dimension::dynamic(), KV_NUM_HEADS, S, HEAD_SIZE});+ auto past_key = std::make_shared<op::v0::Parameter>(+ f32,+ PartialShape{Dimension::dynamic(), KV_NUM_HEADS, Dimension::dynamic(), HEAD_SIZE});+ auto past_value = std::make_shared<op::v0::Parameter>(+ f32,+ PartialShape{Dimension::dynamic(), KV_NUM_HEADS, Dimension::dynamic(), HEAD_SIZE});+ auto seqlens_k = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{Dimension::dynamic()});+ auto total_seq = op::v0::Constant::create(element::i32, Shape{}, {total_sequence_length});+ const auto empty = op::v0::Constant::create(element::dynamic, Shape{0}, {});+ OutputVector args{q, k, v, past_key, past_value, seqlens_k, total_seq};+ args.resize(16, empty);+ auto query_seqlens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{Dimension::dynamic()});+ args.push_back(query_seqlens);++ auto gqa = std::make_shared<GroupQueryAttention>(args,+ NUM_HEADS,+ KV_NUM_HEADS,+ /*scale*/ 0.0f,+ /*do_rotary*/ false,+ /*rotary_interleaved*/ false);+ ASSERT_TRUE(gqa->has_query_seqlens());+ ASSERT_FALSE(gqa->has_fixed_kv_capacity());++ // Only present_key/present_value are checked, so only they are declared as Results: they don't depend on the+ // attention output, and Model::evaluate only evaluates a Result's ancestors.+ ResultVector results{std::make_shared<op::v0::Result>(gqa->output(1)),+ std::make_shared<op::v0::Result>(gqa->output(2))};+ ParameterVector params{q, k, v, past_key, past_value, seqlens_k, query_seqlens};+ auto model = std::make_shared<Model>(results, params);+ decompose(model);++ const auto batch = Shape{1};+ const auto q_shape = Shape{1, static_cast<size_t>(NUM_HEADS), S, HEAD_SIZE};+ const auto kv_shape = Shape{1, static_cast<size_t>(KV_NUM_HEADS), S, HEAD_SIZE};+ const auto past_shape = Shape{1, static_cast<size_t>(KV_NUM_HEADS), past_rows, HEAD_SIZE};++ std::vector<float> q_data(shape_size(q_shape), 0.5f);+ std::vector<float> new_k_data(shape_size(kv_shape));+ std::vector<float> new_v_data(shape_size(kv_shape));+ for (int64_t row = 0; row < S; ++row)+ for (int64_t col = 0; col < HEAD_SIZE; ++col) {+ new_k_data[row * HEAD_SIZE + col] = 100.0f + static_cast<float>(row);+ new_v_data[row * HEAD_SIZE + col] = 200.0f + static_cast<float>(row);+ }+ std::vector<float> past_k_data(shape_size(past_shape));+ std::vector<float> past_v_data(shape_size(past_shape));+ for (int64_t row = 0; row < past_rows; ++row)+ for (int64_t col = 0; col < HEAD_SIZE; ++col) {+ past_k_data[row * HEAD_SIZE + col] = static_cast<float>(row);+ past_v_data[row * HEAD_SIZE + col] = static_cast<float>(row);+ }+ std::vector<int32_t> seqlens_k_data{4};+ std::vector<int32_t> query_seqlens_data{2};++ ov::TensorVector inputs{ov::Tensor(f32, q_shape, q_data.data()),+ ov::Tensor(f32, kv_shape, new_k_data.data()),+ ov::Tensor(f32, kv_shape, new_v_data.data()),+ ov::Tensor(f32, past_shape, past_k_data.data()),+ ov::Tensor(f32, past_shape, past_v_data.data()),+ ov::Tensor(element::i32, batch, seqlens_k_data.data()),+ ov::Tensor(element::i32, batch, query_seqlens_data.data())};+ ov::TensorVector outputs(model->get_output_size());+ ASSERT_TRUE(model->evaluate(outputs, inputs));++ const auto expected_present_shape = Shape{1, static_cast<size_t>(KV_NUM_HEADS), total_sequence_length, HEAD_SIZE};+ EXPECT_EQ(outputs[0].get_shape(), expected_present_shape)+ << "unsliced present_key must follow total_sequence_length";+ EXPECT_EQ(outputs[1].get_shape(), expected_present_shape)+ << "unsliced present_value must follow total_sequence_length";++ const auto* present_key = outputs[0].data<float>();+ const auto* present_value = outputs[1].data<float>();+ // Rows before the write window (the unwritten past prefix) must survive untouched.+ for (int64_t row = 0; row < kept_past; ++row) {+ EXPECT_FLOAT_EQ(present_key[row * HEAD_SIZE], static_cast<float>(row))+ << "past prefix row " << row << " clobbered";+ EXPECT_FLOAT_EQ(present_value[row * HEAD_SIZE], static_cast<float>(row))+ << "past prefix row " << row << " clobbered";+ }+ // [kept_past, total) must hold the valid rows of the new chunk, overwriting any stale past rows in the overlap+ // (the padded rows beyond total are unspecified).+ for (int64_t row = 0; row < query_seqlens_data[0]; ++row) {+ EXPECT_FLOAT_EQ(present_key[(kept_past + row) * HEAD_SIZE], 100.0f + static_cast<float>(row))+ << "new chunk row " << row << " not written at kept_past + row";+ EXPECT_FLOAT_EQ(present_value[(kept_past + row) * HEAD_SIZE], 200.0f + static_cast<float>(row))+ << "new chunk row " << row << " not written at kept_past + row";+ }+}++// Same scenario as above but with a statically-known batch of 1 for Q/K/V/past, which routes through the scalar+// construct_kvcache (ScatterUpdate/Slice+Concat) path instead of construct_batched_kvcache's flat per-batch+// ScatterUpdate -- a separate resize_kv_to_capacity call site the dynamic-batch test above never exercises.+TEST(GroupQueryAttentionValues, padded_query_growing_cache_present_keeps_total_sequence_length_capacity_static_batch) {+ const auto f32 = element::f32;+ constexpr int64_t S = 4;+ constexpr int64_t past_rows = 5;+ constexpr int64_t total_sequence_length = 10;+ constexpr int64_t kept_past = 3; // P = max(total - Q, 0) = max((seqlens_k + 1) - query_seqlens, 0) = max(5-2,0)++ auto q = std::make_shared<op::v0::Parameter>(f32, PartialShape{1, NUM_HEADS, S, HEAD_SIZE});+ auto k = std::make_shared<op::v0::Parameter>(f32, PartialShape{1, KV_NUM_HEADS, S, HEAD_SIZE});+ auto v = std::make_shared<op::v0::Parameter>(f32, PartialShape{1, KV_NUM_HEADS, S, HEAD_SIZE});+ auto past_key =+ std::make_shared<op::v0::Parameter>(f32, PartialShape{1, KV_NUM_HEADS, Dimension::dynamic(), HEAD_SIZE});+ auto past_value =+ std::make_shared<op::v0::Parameter>(f32, PartialShape{1, KV_NUM_HEADS, Dimension::dynamic(), HEAD_SIZE});+ auto seqlens_k = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{1});+ auto total_seq = op::v0::Constant::create(element::i32, Shape{}, {total_sequence_length});+ const auto empty = op::v0::Constant::create(element::dynamic, Shape{0}, {});+ OutputVector args{q, k, v, past_key, past_value, seqlens_k, total_seq};+ args.resize(16, empty);+ auto query_seqlens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{1});+ args.push_back(query_seqlens);++ auto gqa = std::make_shared<GroupQueryAttention>(args,+ NUM_HEADS,+ KV_NUM_HEADS,+ /*scale*/ 0.0f,+ /*do_rotary*/ false,+ /*rotary_interleaved*/ false);+ ASSERT_TRUE(gqa->has_query_seqlens());+ ASSERT_FALSE(gqa->has_fixed_kv_capacity());++ ResultVector results{std::make_shared<op::v0::Result>(gqa->output(1)),+ std::make_shared<op::v0::Result>(gqa->output(2))};+ ParameterVector params{q, k, v, past_key, past_value, seqlens_k, query_seqlens};+ auto model = std::make_shared<Model>(results, params);+ decompose(model);++ // A static batch of 1 must take the scalar cache-update path (no per-batch flat ScatterUpdate).+ size_t flat_scatter_count = 0;+ for (const auto& op : model->get_ordered_ops())+ flat_scatter_count += is_flat_scatter_update(op) ? 1 : 0;+ EXPECT_EQ(flat_scatter_count, 0u);++ const auto batch = Shape{1};+ const auto q_shape = Shape{1, static_cast<size_t>(NUM_HEADS), S, HEAD_SIZE};+ const auto kv_shape = Shape{1, static_cast<size_t>(KV_NUM_HEADS), S, HEAD_SIZE};+ const auto past_shape = Shape{1, static_cast<size_t>(KV_NUM_HEADS), past_rows, HEAD_SIZE};++ std::vector<float> q_data(shape_size(q_shape), 0.5f);+ std::vector<float> new_k_data(shape_size(kv_shape));+ std::vector<float> new_v_data(shape_size(kv_shape));+ for (int64_t row = 0; row < S; ++row)+ for (int64_t col = 0; col < HEAD_SIZE; ++col) {+ new_k_data[row * HEAD_SIZE + col] = 100.0f + static_cast<float>(row);+ new_v_data[row * HEAD_SIZE + col] = 200.0f + static_cast<float>(row);+ }+ std::vector<float> past_k_data(shape_size(past_shape));+ std::vector<float> past_v_data(shape_size(past_shape));+ for (int64_t row = 0; row < past_rows; ++row)+ for (int64_t col = 0; col < HEAD_SIZE; ++col) {+ past_k_data[row * HEAD_SIZE + col] = static_cast<float>(row);+ past_v_data[row * HEAD_SIZE + col] = static_cast<float>(row);+ }+ std::vector<int32_t> seqlens_k_data{4};+ std::vector<int32_t> query_seqlens_data{2};++ ov::TensorVector inputs{ov::Tensor(f32, q_shape, q_data.data()),+ ov::Tensor(f32, kv_shape, new_k_data.data()),+ ov::Tensor(f32, kv_shape, new_v_data.data()),+ ov::Tensor(f32, past_shape, past_k_data.data()),+ ov::Tensor(f32, past_shape, past_v_data.data()),+ ov::Tensor(element::i32, batch, seqlens_k_data.data()),+ ov::Tensor(element::i32, batch, query_seqlens_data.data())};+ ov::TensorVector outputs(model->get_output_size());+ ASSERT_TRUE(model->evaluate(outputs, inputs));++ const auto expected_present_shape = Shape{1, static_cast<size_t>(KV_NUM_HEADS), total_sequence_length, HEAD_SIZE};+ EXPECT_EQ(outputs[0].get_shape(), expected_present_shape)+ << "unsliced present_key must follow total_sequence_length";+ EXPECT_EQ(outputs[1].get_shape(), expected_present_shape)+ << "unsliced present_value must follow total_sequence_length";++ const auto* present_key = outputs[0].data<float>();+ const auto* present_value = outputs[1].data<float>();+ for (int64_t row = 0; row < kept_past; ++row) {+ EXPECT_FLOAT_EQ(present_key[row * HEAD_SIZE], static_cast<float>(row))+ << "past prefix row " << row << " clobbered";+ EXPECT_FLOAT_EQ(present_value[row * HEAD_SIZE], static_cast<float>(row))+ << "past prefix row " << row << " clobbered";+ }+ for (int64_t row = 0; row < query_seqlens_data[0]; ++row) {+ EXPECT_FLOAT_EQ(present_key[(kept_past + row) * HEAD_SIZE], 100.0f + static_cast<float>(row))+ << "new chunk row " << row << " not written at kept_past + row";+ EXPECT_FLOAT_EQ(present_value[(kept_past + row) * HEAD_SIZE], 200.0f + static_cast<float>(row))+ << "new chunk row " << row << " not written at kept_past + row";+ }+}++// qk_output is laid out over total_sequence_length too: a padded chunk's total_sequence_length can exceed the+// tight attention buffer the same way it can exceed the present cache, so the shared QK scores need the same+// zero-padded tail instead of Slice silently returning fewer columns than declared.+TEST(GroupQueryAttentionValues, padded_query_qk_output_keeps_total_sequence_length_capacity) {+ for (const auto mode : {op::internal::GroupQueryAttentionQKOutput::BEFORE_SOFTMAX,+ op::internal::GroupQueryAttentionQKOutput::AFTER_SOFTMAX}) {+ const auto f32 = element::f32;+ constexpr int64_t S = 4;+ constexpr int64_t past_rows = 5;+ constexpr int64_t total_sequence_length = 10;+ constexpr int64_t attention_cols = 7; // kept_past(3) + S(4): the tight attention buffer this step writes++ auto q = std::make_shared<op::v0::Parameter>(f32, PartialShape{Dimension::dynamic(), NUM_HEADS, S, HEAD_SIZE});+ auto k =+ std::make_shared<op::v0::Parameter>(f32, PartialShape{Dimension::dynamic(), KV_NUM_HEADS, S, HEAD_SIZE});+ auto v =+ std::make_shared<op::v0::Parameter>(f32, PartialShape{Dimension::dynamic(), KV_NUM_HEADS, S, HEAD_SIZE});+ auto past_key = std::make_shared<op::v0::Parameter>(+ f32,+ PartialShape{Dimension::dynamic(), KV_NUM_HEADS, Dimension::dynamic(), HEAD_SIZE});+ auto past_value = std::make_shared<op::v0::Parameter>(+ f32,+ PartialShape{Dimension::dynamic(), KV_NUM_HEADS, Dimension::dynamic(), HEAD_SIZE});+ auto seqlens_k = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{Dimension::dynamic()});+ auto total_seq = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{});+ const auto empty = op::v0::Constant::create(element::dynamic, Shape{0}, {});+ OutputVector args{q, k, v, past_key, past_value, seqlens_k, total_seq};+ args.resize(16, empty);+ auto query_seqlens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{1});+ args.push_back(query_seqlens);++ auto gqa = std::make_shared<GroupQueryAttention>(args,+ NUM_HEADS,+ KV_NUM_HEADS,+ /*scale*/ 0.0f,+ /*do_rotary*/ false,+ /*rotary_interleaved*/ false,+ /*kv_cache_bit_width*/ 0,+ op::internal::GroupQueryAttentionQuantType::NONE,+ op::internal::GroupQueryAttentionQuantType::NONE,+ /*local_window_size*/ -1,+ /*sliding_window_cache*/ false,+ /*smooth_softmax*/ false,+ /*causal*/ true,+ /*softcap*/ 0.0f,+ /*qk_norm_epsilon*/ 1e-6f,+ mode);+ ASSERT_TRUE(gqa->has_query_seqlens());++ // Only the QK scores output is checked, so only it is declared as a Result.+ ResultVector results{std::make_shared<op::v0::Result>(gqa->output(3))};+ ParameterVector params{q, k, v, past_key, past_value, seqlens_k, total_seq, query_seqlens};+ auto model = std::make_shared<Model>(results, params);+ decompose(model);++ const auto q_shape = Shape{1, static_cast<size_t>(NUM_HEADS), S, HEAD_SIZE};+ const auto kv_shape = Shape{1, static_cast<size_t>(KV_NUM_HEADS), S, HEAD_SIZE};+ const auto past_shape = Shape{1, static_cast<size_t>(KV_NUM_HEADS), past_rows, HEAD_SIZE};+ std::vector<float> q_data(shape_size(q_shape), 0.1f);+ std::vector<float> k_data(shape_size(kv_shape), 0.1f);+ std::vector<float> v_data(shape_size(kv_shape), 0.1f);+ std::vector<float> past_k_data(shape_size(past_shape), 0.1f);+ std::vector<float> past_v_data(shape_size(past_shape), 0.1f);+ std::vector<int32_t> seqlens_k_data{4};+ std::vector<int32_t> total_seq_data{total_sequence_length};+ std::vector<int32_t> query_seqlens_data{2};++ ov::TensorVector inputs{ov::Tensor(f32, q_shape, q_data.data()),+ ov::Tensor(f32, kv_shape, k_data.data()),+ ov::Tensor(f32, kv_shape, v_data.data()),+ ov::Tensor(f32, past_shape, past_k_data.data()),+ ov::Tensor(f32, past_shape, past_v_data.data()),+ ov::Tensor(element::i32, Shape{1}, seqlens_k_data.data()),+ ov::Tensor(element::i32, Shape{}, total_seq_data.data()),+ ov::Tensor(element::i32, Shape{1}, query_seqlens_data.data())};+ ov::TensorVector outputs(1);+ ASSERT_TRUE(model->evaluate(outputs, inputs));++ const auto expected_shape = Shape{1, static_cast<size_t>(NUM_HEADS), S, total_sequence_length};+ EXPECT_EQ(outputs[0].get_shape(), expected_shape) << "qk_output must follow total_sequence_length";++ const auto* scores = outputs[0].data<float>();+ for (int64_t head = 0; head < NUM_HEADS; ++head) {+ for (int64_t row = 0; row < S; ++row) {+ for (int64_t col = attention_cols; col < total_sequence_length; ++col) {+ const auto idx = ((head * S + row) * total_sequence_length) + col;+ EXPECT_FLOAT_EQ(scores[idx], 0.0f)+ << "qk_output column " << col << " beyond the attention buffer must be zero-padded";+ }+ }+ }+ }+}+// A preallocated cache with a dynamic batch is written in place: the decomposed present keeps the op's inferred// capacity (no Concat growth).TEST(GroupQueryAttentionValues, batched_fixed_capacity_cache_keeps_capacity) {@@ -928,3 +1256,235 @@ TEST(GroupQueryAttentionValues, batched_fixed_capacity_cache_keeps_capacity) {}}}++// A fully static padded chunk (query_seqlens) whose total_sequence_length exceeds the declared fixed+// capacity must still grow to max(past_rows, total_sequence_length), with the scatter writing into the+// grown buffer (not past_key directly, which would run out of bounds) and the unwritten tail zeroed.+TEST(GroupQueryAttentionValues, padded_query_static_capacity_grows_and_sanitizes_unwritten_tail) {+ const auto f32 = element::f32;+ constexpr int64_t S = 4;+ constexpr int64_t past_rows = 8;+ constexpr int64_t total_sequence_length = 12;++ auto q = std::make_shared<op::v0::Parameter>(f32, PartialShape{1, NUM_HEADS, S, HEAD_SIZE});+ auto k = std::make_shared<op::v0::Parameter>(f32, PartialShape{1, KV_NUM_HEADS, S, HEAD_SIZE});+ auto v = std::make_shared<op::v0::Parameter>(f32, PartialShape{1, KV_NUM_HEADS, S, HEAD_SIZE});+ auto past_key = std::make_shared<op::v0::Parameter>(f32, PartialShape{1, KV_NUM_HEADS, past_rows, HEAD_SIZE});+ auto past_value = std::make_shared<op::v0::Parameter>(f32, PartialShape{1, KV_NUM_HEADS, past_rows, HEAD_SIZE});+ auto seqlens_k = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{1});+ auto total_seq = op::v0::Constant::create(element::i32, Shape{}, {total_sequence_length});+ const auto empty = op::v0::Constant::create(element::dynamic, Shape{0}, {});+ OutputVector args{q, k, v, past_key, past_value, seqlens_k, total_seq};+ args.resize(16, empty);+ auto query_seqlens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{1});+ args.push_back(query_seqlens);++ auto gqa = std::make_shared<GroupQueryAttention>(args, NUM_HEADS, KV_NUM_HEADS, 0.0f, false, false);+ ASSERT_TRUE(gqa->has_query_seqlens());+ ASSERT_TRUE(gqa->has_fixed_kv_capacity());+ ASSERT_EQ(gqa->get_output_partial_shape(1), (PartialShape{1, KV_NUM_HEADS, total_sequence_length, HEAD_SIZE}));++ ResultVector results{std::make_shared<op::v0::Result>(gqa->output(1)),+ std::make_shared<op::v0::Result>(gqa->output(2))};+ ParameterVector params{q, k, v, past_key, past_value, seqlens_k, query_seqlens};+ auto model = std::make_shared<Model>(results, params);+ decompose(model);+ EXPECT_EQ(model->get_results()[0]->get_input_partial_shape(0),+ (PartialShape{1, KV_NUM_HEADS, total_sequence_length, HEAD_SIZE}));++ bool scatter_into_past_key_directly = false;+ bool found_capacity_concat = false;+ bool found_sanitize_select = false;+ for (const auto& op : model->get_ordered_ops()) {+ if (const auto su = as_type_ptr<op::v3::ScatterUpdate>(op)) {+ scatter_into_past_key_directly |= su->get_input_node_shared_ptr(0) == past_key;+ }+ if (const auto concat = as_type_ptr<op::v0::Concat>(op)) {+ found_capacity_concat |= concat->get_output_partial_shape(0).rank() == 4 && concat->get_axis() == 2;+ }+ if (const auto select = as_type_ptr<op::v1::Select>(op)) {+ const auto zero_const = as_type_ptr<op::v0::Constant>(select->get_input_node_shared_ptr(2));+ found_sanitize_select |= zero_const && zero_const->get_shape().empty();+ }+ }+ EXPECT_FALSE(scatter_into_past_key_directly)+ << "scatter must target the capacity-grown buffer, not past_key directly (out-of-bounds indices)";+ EXPECT_TRUE(found_capacity_concat) << "present must grow via Concat to reach total_sequence_length";+ EXPECT_TRUE(found_sanitize_select)+ << "unwritten capacity tail must be zeroed so NaN filler can't leak through softmax";+}++// When the declared capacity already covers a constant total_sequence_length, resize_kv_to_capacity must+// fold away instead of building a Slice/Broadcast/Concat that would just reproduce its input: the scatter+// writes directly into past_key/past_value, same as the no-total_sequence_length fast path.+TEST(GroupQueryAttentionValues, padded_query_static_capacity_already_sufficient_skips_resize) {+ const auto f32 = element::f32;+ constexpr int64_t S = 4;+ constexpr int64_t past_rows = 8;+ constexpr int64_t total_sequence_length = 8;++ auto q = std::make_shared<op::v0::Parameter>(f32, PartialShape{1, NUM_HEADS, S, HEAD_SIZE});+ auto k = std::make_shared<op::v0::Parameter>(f32, PartialShape{1, KV_NUM_HEADS, S, HEAD_SIZE});+ auto v = std::make_shared<op::v0::Parameter>(f32, PartialShape{1, KV_NUM_HEADS, S, HEAD_SIZE});+ auto past_key = std::make_shared<op::v0::Parameter>(f32, PartialShape{1, KV_NUM_HEADS, past_rows, HEAD_SIZE});+ auto past_value = std::make_shared<op::v0::Parameter>(f32, PartialShape{1, KV_NUM_HEADS, past_rows, HEAD_SIZE});+ auto seqlens_k = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{1});+ auto total_seq = op::v0::Constant::create(element::i32, Shape{}, {total_sequence_length});+ const auto empty = op::v0::Constant::create(element::dynamic, Shape{0}, {});+ OutputVector args{q, k, v, past_key, past_value, seqlens_k, total_seq};+ args.resize(16, empty);+ auto query_seqlens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{1});+ args.push_back(query_seqlens);++ auto gqa = std::make_shared<GroupQueryAttention>(args, NUM_HEADS, KV_NUM_HEADS, 0.0f, false, false);+ ASSERT_TRUE(gqa->has_query_seqlens());+ ASSERT_TRUE(gqa->has_fixed_kv_capacity());+ ASSERT_EQ(gqa->get_output_partial_shape(1), (PartialShape{1, KV_NUM_HEADS, past_rows, HEAD_SIZE}));++ ResultVector results{std::make_shared<op::v0::Result>(gqa->output(1)),+ std::make_shared<op::v0::Result>(gqa->output(2))};+ ParameterVector params{q, k, v, past_key, past_value, seqlens_k, query_seqlens};+ auto model = std::make_shared<Model>(results, params);+ decompose(model);++ bool scatter_into_past_key_directly = false;+ bool found_capacity_concat = false;+ for (const auto& op : model->get_ordered_ops()) {+ if (const auto su = as_type_ptr<op::v3::ScatterUpdate>(op)) {+ scatter_into_past_key_directly |= su->get_input_node_shared_ptr(0) == past_key;+ }+ if (const auto concat = as_type_ptr<op::v0::Concat>(op)) {+ found_capacity_concat |= concat->get_output_partial_shape(0).rank() == 4 && concat->get_axis() == 2;+ }+ }+ EXPECT_TRUE(scatter_into_past_key_directly)+ << "an already-sufficient static capacity should scatter straight into past_key, no resize needed";+ EXPECT_FALSE(found_capacity_concat) << "resize_kv_to_capacity must fold away as a no-op, not build a Concat";+}++// Same hazard as padded_query_static_capacity_grows_and_sanitizes_unwritten_tail, through the batched writer+// (dynamic batch) instead of the scalar one.+TEST(GroupQueryAttentionValues, padded_query_batched_static_capacity_sanitizes_unwritten_tail) {+ const auto f32 = element::f32;+ constexpr int64_t S = 4;+ constexpr int64_t past_rows = 8;++ auto q = std::make_shared<op::v0::Parameter>(f32, PartialShape{Dimension::dynamic(), NUM_HEADS, S, HEAD_SIZE});+ auto k = std::make_shared<op::v0::Parameter>(f32, PartialShape{Dimension::dynamic(), KV_NUM_HEADS, S, HEAD_SIZE});+ auto v = std::make_shared<op::v0::Parameter>(f32, PartialShape{Dimension::dynamic(), KV_NUM_HEADS, S, HEAD_SIZE});+ auto past_key =+ std::make_shared<op::v0::Parameter>(f32,+ PartialShape{Dimension::dynamic(), KV_NUM_HEADS, past_rows, HEAD_SIZE});+ auto past_value =+ std::make_shared<op::v0::Parameter>(f32,+ PartialShape{Dimension::dynamic(), KV_NUM_HEADS, past_rows, HEAD_SIZE});+ auto seqlens_k = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{Dimension::dynamic()});+ auto total_seq = op::v0::Constant::create(element::i32, Shape{}, {past_rows});+ const auto empty = op::v0::Constant::create(element::dynamic, Shape{0}, {});+ OutputVector args{q, k, v, past_key, past_value, seqlens_k, total_seq};+ args.resize(16, empty);+ auto query_seqlens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{Dimension::dynamic()});+ args.push_back(query_seqlens);++ auto gqa = std::make_shared<GroupQueryAttention>(args, NUM_HEADS, KV_NUM_HEADS, 0.0f, false, false);+ ASSERT_TRUE(gqa->has_query_seqlens());+ ASSERT_TRUE(gqa->has_fixed_kv_capacity());++ ResultVector results{std::make_shared<op::v0::Result>(gqa->output(1)),+ std::make_shared<op::v0::Result>(gqa->output(2))};+ ParameterVector params{q, k, v, past_key, past_value, seqlens_k, query_seqlens};+ auto model = std::make_shared<Model>(results, params);+ decompose(model);++ bool found_sanitize_select = false;+ for (const auto& op : model->get_ordered_ops()) {+ if (const auto select = as_type_ptr<op::v1::Select>(op)) {+ const auto zero_const = as_type_ptr<op::v0::Constant>(select->get_input_node_shared_ptr(2));+ found_sanitize_select |= zero_const && zero_const->get_shape().empty();+ }+ }+ EXPECT_TRUE(found_sanitize_select)+ << "batched writer must also zero the unwritten capacity tail so NaN filler can't leak through softmax";+}++TEST(GroupQueryAttentionValues, padded_query_batched_dynamic_capacity_sanitizes_unwritten_tail) {+ const auto f32 = element::f32;+ constexpr int64_t S = 4;++ auto q = std::make_shared<op::v0::Parameter>(f32, PartialShape{Dimension::dynamic(), NUM_HEADS, S, HEAD_SIZE});+ auto k = std::make_shared<op::v0::Parameter>(f32, PartialShape{Dimension::dynamic(), KV_NUM_HEADS, S, HEAD_SIZE});+ auto v = std::make_shared<op::v0::Parameter>(f32, PartialShape{Dimension::dynamic(), KV_NUM_HEADS, S, HEAD_SIZE});+ auto past_key = std::make_shared<op::v0::Parameter>(+ f32,+ PartialShape{Dimension::dynamic(), KV_NUM_HEADS, Dimension::dynamic(), HEAD_SIZE});+ auto past_value = std::make_shared<op::v0::Parameter>(+ f32,+ PartialShape{Dimension::dynamic(), KV_NUM_HEADS, Dimension::dynamic(), HEAD_SIZE});+ auto seqlens_k = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{Dimension::dynamic()});+ auto total_seq = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{});+ const auto empty = op::v0::Constant::create(element::dynamic, Shape{0}, {});+ OutputVector args{q, k, v, past_key, past_value, seqlens_k, total_seq};+ args.resize(16, empty);+ auto query_seqlens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{Dimension::dynamic()});+ args.push_back(query_seqlens);++ auto gqa = std::make_shared<GroupQueryAttention>(args, NUM_HEADS, KV_NUM_HEADS, 0.0f, false, false);+ ASSERT_TRUE(gqa->has_query_seqlens());+ ASSERT_FALSE(gqa->has_fixed_kv_capacity());++ ResultVector results{std::make_shared<op::v0::Result>(gqa->output(1)),+ std::make_shared<op::v0::Result>(gqa->output(2))};+ ParameterVector params{q, k, v, past_key, past_value, seqlens_k, total_seq, query_seqlens};+ auto model = std::make_shared<Model>(results, params);+ decompose(model);++ bool found_sanitize_select = false;+ for (const auto& op : model->get_ordered_ops()) {+ if (const auto select = as_type_ptr<op::v1::Select>(op)) {+ const auto zero_const = as_type_ptr<op::v0::Constant>(select->get_input_node_shared_ptr(2));+ found_sanitize_select |= zero_const && zero_const->get_shape().empty();+ }+ }+ EXPECT_TRUE(found_sanitize_select) << "batched writer's dynamic-capacity (Concat-grown) buffer must also zero "+ "the unwritten tail so a garbage past Parameter can't leak NaN through "+ "softmax";+}++// resize_kv_to_capacity's no-op fold must trim an OVERSIZED buffer down to capacity, not just skip when the+// buffer already covers it: batch 2 (triggers the batched writer) with a dynamic query sequence_length+// (has_fixed_kv_capacity() is false even though K/V/past rows are all static) builds a 12-row Concat-grown+// buffer (8 past + 4 current) against a constant total_sequence_length=8, so present must still come out at+// exactly 8 rows, not the unsliced 12.+TEST(GroupQueryAttentionValues, padded_query_batched_oversized_buffer_still_trims_to_capacity) {+ const auto f32 = element::f32;+ constexpr int64_t S = 4;+ constexpr int64_t past_rows = 8;+ constexpr int64_t total_sequence_length = 8;++ auto q = std::make_shared<op::v0::Parameter>(f32, PartialShape{2, NUM_HEADS, Dimension::dynamic(), HEAD_SIZE});+ auto k = std::make_shared<op::v0::Parameter>(f32, PartialShape{2, KV_NUM_HEADS, S, HEAD_SIZE});+ auto v = std::make_shared<op::v0::Parameter>(f32, PartialShape{2, KV_NUM_HEADS, S, HEAD_SIZE});+ auto past_key = std::make_shared<op::v0::Parameter>(f32, PartialShape{2, KV_NUM_HEADS, past_rows, HEAD_SIZE});+ auto past_value = std::make_shared<op::v0::Parameter>(f32, PartialShape{2, KV_NUM_HEADS, past_rows, HEAD_SIZE});+ auto seqlens_k = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{2});+ auto total_seq = op::v0::Constant::create(element::i32, Shape{}, {total_sequence_length});+ const auto empty = op::v0::Constant::create(element::dynamic, Shape{0}, {});+ OutputVector args{q, k, v, past_key, past_value, seqlens_k, total_seq};+ args.resize(16, empty);+ auto query_seqlens = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{2});+ args.push_back(query_seqlens);++ auto gqa = std::make_shared<GroupQueryAttention>(args, NUM_HEADS, KV_NUM_HEADS, 0.0f, false, false);+ ASSERT_TRUE(gqa->has_query_seqlens());+ ASSERT_FALSE(gqa->has_fixed_kv_capacity());++ ResultVector results{std::make_shared<op::v0::Result>(gqa->output(1)),+ std::make_shared<op::v0::Result>(gqa->output(2))};+ ParameterVector params{q, k, v, past_key, past_value, seqlens_k, query_seqlens};+ auto model = std::make_shared<Model>(results, params);+ decompose(model);++ EXPECT_EQ(model->get_results()[0]->get_input_partial_shape(0),+ (PartialShape{2, KV_NUM_HEADS, total_sequence_length, HEAD_SIZE}))+ << "an oversized Concat-grown buffer (12 rows) must still be trimmed to capacity (8), not returned as-is";+}diff --git a/src/core/dev_api/openvino/op/group_query_attention.hpp b/src/core/dev_api/openvino/op/group_query_attention.hppindex 34f27d0e979..00426359c28 100644--- a/src/core/dev_api/openvino/op/group_query_attention.hpp+++ b/src/core/dev_api/openvino/op/group_query_attention.hpp@@ -28,6 +28,7 @@ enum class GroupQueryAttentionInputs : size_t {V_SCALE = 13, // Quantization scale for V (optional, required if kv_cache_bit_width != 0)Q_NORM_WEIGHT = 14, // Per-head Q RMSNorm weight [head_size] (optional, paired with K_NORM_WEIGHT)K_NORM_WEIGHT = 15, // Per-head K RMSNorm weight [head_size] (optional, paired with Q_NORM_WEIGHT)+ QUERY_SEQLENS = 16, // Valid (non-padded) rows of a right-padded query chunk [batch] (optional)};enum class GroupQueryAttentionQuantType {@@ -175,6 +176,10 @@ public:// QK-Norm (Qwen3/Gemma3-style): when q_norm_weight/k_norm_weight are present, the new Q and K heads are// RMS-normalized over head_size before RoPE: x * rsqrt(mean(x^2) + qk_norm_epsilon) * weight.bool has_qk_norm() const;+ // Right-padded query chunk (ONNX query_seqlens): only the first query_seqlens[b] of the S query rows are real+ // tokens, so the past length is seqlens_k + 1 - query_seqlens[b] instead of seqlens_k + 1 - S. Also honored for a+ // single-token step, where 0 marks an idle entry (ONNX Runtime).+ bool has_query_seqlens() const;float get_qk_norm_epsilon() const {return m_qk_norm_epsilon;}diff --git a/src/core/src/op/group_query_attention.cpp b/src/core/src/op/group_query_attention.cppindex fb0a1fc73ba..b80aa9a8939 100644--- a/src/core/src/op/group_query_attention.cpp+++ b/src/core/src/op/group_query_attention.cpp@@ -137,6 +137,8 @@ void GroupQueryAttention::validate_and_infer_types() {return "q_norm_weight";case GroupQueryAttentionInputs::K_NORM_WEIGHT:return "k_norm_weight";+ case GroupQueryAttentionInputs::QUERY_SEQLENS:+ return "query_seqlens";}return "unknown";};@@ -325,6 +327,48 @@ void GroupQueryAttention::validate_and_infer_types() {".");}+ // query_seqlens (ONNX input 16): valid rows of a right-padded chunk appended to an existing cache, so it needs the+ // past, causal attention and new keys (ORT rejects shared KV), and one length per batch entry.+ check_input(GroupQueryAttentionInputs::QUERY_SEQLENS, {1}, integral_types, false);+ if (has_query_seqlens()) {+ NODE_VALIDATION_CHECK(this,+ has_past_layout,+ "GroupQueryAttention: query_seqlens requires past_key and past_value.");+ NODE_VALIDATION_CHECK(this, m_causal, "GroupQueryAttention: query_seqlens requires causal=1.");+ NODE_VALIDATION_CHECK(this,+ !is_shared_kv(),+ "GroupQueryAttention: query_seqlens is not supported with shared KV.");+ const auto& qsl_ps = get_input_partial_shape(static_cast<size_t>(GroupQueryAttentionInputs::QUERY_SEQLENS));+ NODE_VALIDATION_CHECK(this,+ qsl_ps.rank().is_dynamic() || qsl_ps[0].compatible(batch_size),+ "GroupQueryAttention: query_seqlens must have batch_size (",+ batch_size,+ ") elements, got shape ",+ qsl_ps,+ ".");+ // ORT's CheckQuerySeqlens requires the new key/value chunk to have the same row count as the query (the+ // padded chunk writes all S rows); a mismatched static key length would apply the query's S rotary/mask+ // positions to a differently-sized key chunk in the decomposition instead of being rejected here.+ const auto& key_ps_for_qsl = get_input_partial_shape(static_cast<size_t>(GroupQueryAttentionInputs::KEY));+ NODE_VALIDATION_CHECK(this,+ key_ps_for_qsl.rank().is_dynamic() || key_ps_for_qsl[2].compatible(sequence_len),+ "GroupQueryAttention: query_seqlens requires key/value sequence_length to equal "+ "query's, got key shape ",+ key_ps_for_qsl,+ " and query sequence_length ",+ sequence_len,+ ".");+ const auto& value_ps_for_qsl = get_input_partial_shape(static_cast<size_t>(GroupQueryAttentionInputs::VALUE));+ NODE_VALIDATION_CHECK(this,+ value_ps_for_qsl.rank().is_dynamic() || value_ps_for_qsl[2].compatible(sequence_len),+ "GroupQueryAttention: query_seqlens requires key/value sequence_length to equal "+ "query's, got value shape ",+ value_ps_for_qsl,+ " and query sequence_length ",+ sequence_len,+ ".");+ }+if (m_do_rotary) {// Partial RoPE (GPT-NeoX/Phi-style): rotary_dim = 2 * cos_cache.shape[-1] may be smaller than// head_size; only the leading rotary_dim channels are rotated (see@@ -465,8 +509,42 @@ void GroupQueryAttention::validate_and_infer_types() {// A key/value of dynamic length cannot be written in place, so present grows by its own length.const bool empty_past = output_kv_len.is_static() && output_kv_len.get_length() == 0;const bool dynamic_kv_len = key_ps.rank().is_static() && key_ps[2].is_dynamic();- if ((!m_sliding_window_cache || empty_past) && !is_shared_kv() && !has_fixed_kv_capacity()) {- output_kv_len += dynamic_kv_len ? key_ps[2] : sequence_len;+ // A fixed capacity still grows for query_seqlens if total_sequence_length exceeds it.+ if ((!m_sliding_window_cache || empty_past) && !is_shared_kv() &&+ (!has_fixed_kv_capacity() || (!m_sliding_window_cache && has_query_seqlens()))) {+ if (!m_sliding_window_cache && has_query_seqlens()) {+ // present capacity is max(past_rows, total_sequence_length) for a padded chunk (CheckInputs in+ // onnxruntime/contrib_ops/cpu/bert/group_query_attention_helper.h), including an empty (0-row) past --+ // total_sequence_length can pre-allocate headroom beyond the current chunk either way, so+ // past_rows + sequence_len no longer bounds it. A windowed cache keeps the plain past_rows rule above+ // instead (ORT never grows it to total_sequence_length). Fold a constant total_sequence_length for a+ // tight static bound; it's optional (required only for qk_output), so an absent input is an empty+ // Constant.+ const auto total_len_input =+ input_value(static_cast<size_t>(GroupQueryAttentionInputs::TOTAL_SEQUENCE_LENGTH));+ const auto total_len_const = ov::util::is_empty_constant_tensor(total_len_input)+ ? nullptr+ : ov::util::get_constant_from_source(total_len_input);+ if (total_len_const && output_kv_len.is_static()) {+ output_kv_len =+ Dimension(std::max(output_kv_len.get_length(), total_len_const->cast_vector<int64_t>().at(0)));+ } else {+ output_kv_len = Dimension::dynamic();+ }+ } else {+ output_kv_len += dynamic_kv_len ? key_ps[2] : sequence_len;+ }+ }+ // ORT's CheckQuerySeqlens: a non-windowed cache must hold the whole padded chunk (output_kv_len is this op's+ // present/cache_capacity at this point).+ if (!m_sliding_window_cache && has_query_seqlens() && sequence_len.is_static() && output_kv_len.is_static()) {+ NODE_VALIDATION_CHECK(this,+ sequence_len.get_length() <= output_kv_len.get_length(),+ "GroupQueryAttention: query_seqlens requires the KV cache capacity (",+ output_kv_len,+ ") to hold a whole query chunk (sequence_length=",+ sequence_len,+ ").");}set_output_type(0, q_type, PartialShape{batch_size, sequence_len, head_size * m_num_heads});@@ -510,6 +588,11 @@ bool GroupQueryAttention::has_qk_norm() const {return pos < get_input_size() && !ov::util::is_empty_constant_tensor(input_value(pos));}+bool GroupQueryAttention::has_query_seqlens() const {+ const auto pos = static_cast<size_t>(GroupQueryAttentionInputs::QUERY_SEQLENS);+ return pos < get_input_size() && !ov::util::is_empty_constant_tensor(input_value(pos));+}+bool GroupQueryAttention::visit_attributes(AttributeVisitor& visitor) {OV_OP_SCOPE(GroupQueryAttention_visit_attributes);visitor.on_attribute("causal", m_causal);diff --git a/src/core/tests/type_prop/group_query_attention.cpp b/src/core/tests/type_prop/group_query_attention.cppindex b94d0004e9a..11fee728f3a 100644--- a/src/core/tests/type_prop/group_query_attention.cpp+++ b/src/core/tests/type_prop/group_query_attention.cpp@@ -863,5 +863,141 @@ TEST(type_prop, group_query_attention_seqlens_k_must_match_batch) {std::make_shared<op::internal::GroupQueryAttention>(args, 6, 2, 1.0f, false, false));}+namespace {+// Valid args padded with empty optional inputs 7-15, then query_seqlens (input 16).+ov::OutputVector make_gqa_query_seqlens_args(const PartialShape& query_seqlens_shape = PartialShape{1}) {+ auto args = make_valid_gqa_args();+ const auto empty = op::v0::Constant::create(element::dynamic, Shape{0}, {});+ args.resize(16, empty);+ args.push_back(std::make_shared<op::v0::Parameter>(element::i32, query_seqlens_shape));+ return args;+}+} // namespace++TEST(type_prop, group_query_attention_query_seqlens) {+ const auto op =+ std::make_shared<op::internal::GroupQueryAttention>(make_gqa_query_seqlens_args(), 6, 2, 1.0f, false, false);+ EXPECT_TRUE(op->has_query_seqlens());+ // The padded chunk is still written as S rows, so output 0's shape does not depend on query_seqlens.+ EXPECT_EQ(op->get_output_partial_shape(0), (PartialShape{1, 4, 48}));+ // Fixed capacity (5) can't be promised once query_seqlens is present and total_sequence_length is a+ // runtime Parameter, not a known constant (ORT: max(past_rows, total_sequence_length)).+ EXPECT_EQ(op->get_output_partial_shape(1), (PartialShape{1, 2, Dimension::dynamic(), 8}));++ const auto plain =+ std::make_shared<op::internal::GroupQueryAttention>(make_valid_gqa_args(), 6, 2, 1.0f, false, false);+ EXPECT_FALSE(plain->has_query_seqlens());++ // A single-token step honors query_seqlens too (0 marks an idle entry).+ auto decode_args = make_gqa_query_seqlens_args();+ for (size_t i = 0; i < 3; ++i) {+ decode_args[i] = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{1, i == 0 ? 6 : 2, 1, 8});+ }+ const auto decode = std::make_shared<op::internal::GroupQueryAttention>(decode_args, 6, 2, 1.0f, false, false);+ EXPECT_TRUE(decode->has_query_seqlens());++ // Batched padded chunks (sequence_length > 1, batch_size > 1) are supported.+ auto batched = make_gqa_query_seqlens_args(PartialShape{2});+ batched[0] = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{2, 6, 4, 8});+ batched[1] = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{2, 2, 4, 8});+ batched[2] = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{2, 2, 4, 8});+ batched[3] = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{2, 2, 5, 8});+ batched[4] = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{2, 2, 5, 8});+ batched[5] = std::make_shared<op::v0::Parameter>(element::i32, PartialShape{2});+ const auto batched_op = std::make_shared<op::internal::GroupQueryAttention>(batched, 6, 2, 1.0f, false, false);+ EXPECT_TRUE(batched_op->has_query_seqlens());+ EXPECT_EQ(batched_op->get_output_partial_shape(0), (PartialShape{2, 4, 48}));+}++// A static past capacity must still grow to a constant total_sequence_length that exceeds it (ORT:+// max(past_rows, total_sequence_length)); common cache writers must allocate before scattering into it.+TEST(type_prop, group_query_attention_query_seqlens_fixed_capacity_grows_to_total_sequence_length) {+ using op::v0::Constant;+ using op::v0::Parameter;+ auto grows = make_gqa_query_seqlens_args();+ grows[3] = std::make_shared<Parameter>(element::f32, PartialShape{1, 2, 8, 8});+ grows[4] = std::make_shared<Parameter>(element::f32, PartialShape{1, 2, 8, 8});+ grows[6] = Constant::create(element::i32, Shape{}, {12});+ const auto grown = std::make_shared<op::internal::GroupQueryAttention>(grows, 6, 2, 1.0f, false, false);+ EXPECT_TRUE(grown->has_fixed_kv_capacity());+ EXPECT_EQ(grown->get_output_partial_shape(1), (PartialShape{1, 2, 12, 8}));++ auto fits = grows;+ fits[6] = Constant::create(element::i32, Shape{}, {6});+ const auto unchanged = std::make_shared<op::internal::GroupQueryAttention>(fits, 6, 2, 1.0f, false, false);+ EXPECT_EQ(unchanged->get_output_partial_shape(1), (PartialShape{1, 2, 8, 8}));+}++TEST(type_prop, group_query_attention_query_seqlens_invalid) {+ using op::internal::GroupQueryAttention;+ using op::internal::GroupQueryAttentionQuantType;+ constexpr auto none = GroupQueryAttentionQuantType::NONE;++ OV_EXPECT_THROW(std::ignore = std::make_shared<GroupQueryAttention>(make_gqa_query_seqlens_args(PartialShape{2}),+ 6,+ 2,+ 1.0f,+ false,+ false),+ ov::NodeValidationFailure,+ HasSubstr("query_seqlens must have batch_size"));+ OV_EXPECT_THROW(std::ignore = std::make_shared<GroupQueryAttention>(make_gqa_query_seqlens_args(PartialShape{1, 1}),+ 6,+ 2,+ 1.0f,+ false,+ false),+ ov::NodeValidationFailure,+ HasSubstr("Rank of `query_seqlens` input is not compatible"));+ OV_EXPECT_THROW(std::ignore = std::make_shared<GroupQueryAttention>(make_gqa_query_seqlens_args(),+ 6,+ 2,+ 1.0f,+ false,+ false,+ 0,+ none,+ none,+ -1,+ false,+ false,+ false),+ ov::NodeValidationFailure,+ HasSubstr("query_seqlens requires causal=1"));++ auto no_past = make_gqa_query_seqlens_args();+ no_past[3] = op::v0::Constant::create(element::f32, Shape{0}, {});+ no_past[4] = no_past[3];+ OV_EXPECT_THROW(std::ignore = std::make_shared<GroupQueryAttention>(no_past, 6, 2, 1.0f, false, false),+ ov::NodeValidationFailure,+ HasSubstr("query_seqlens requires past_key and past_value"));++ // A statically mismatched key/value sequence_length would apply the query's S rotary/mask positions to a+ // differently-sized key chunk in the decomposition; reject it here instead.+ auto mismatched_kv = make_gqa_query_seqlens_args();+ mismatched_kv[1] = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{1, 2, 2, 8});+ mismatched_kv[2] = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{1, 2, 2, 8});+ OV_EXPECT_THROW(std::ignore = std::make_shared<GroupQueryAttention>(mismatched_kv, 6, 2, 1.0f, false, false),+ ov::NodeValidationFailure,+ HasSubstr("query_seqlens requires key/value sequence_length to equal query's"));++ // VALUE alone mismatched (KEY still matches query's S): must be rejected too, not just KEY.+ auto mismatched_value_only = make_gqa_query_seqlens_args();+ mismatched_value_only[2] = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{1, 2, 1, 8});+ OV_EXPECT_THROW(+ std::ignore = std::make_shared<GroupQueryAttention>(mismatched_value_only, 6, 2, 1.0f, false, false),+ ov::NodeValidationFailure,+ HasSubstr("query_seqlens requires key/value sequence_length to equal query's"));++ // ORT's CheckQuerySeqlens: a non-windowed cache must hold the whole padded chunk (sequence_length=4 here).+ auto undersized_capacity = make_gqa_query_seqlens_args();+ undersized_capacity[3] = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{1, 2, 2, 8});+ undersized_capacity[4] = std::make_shared<op::v0::Parameter>(element::f32, PartialShape{1, 2, 2, 8});+ undersized_capacity[6] = op::v0::Constant::create(element::i32, Shape{}, {2});+ OV_EXPECT_THROW(std::ignore = std::make_shared<GroupQueryAttention>(undersized_capacity, 6, 2, 1.0f, false, false),+ ov::NodeValidationFailure,+ HasSubstr("requires the KV cache capacity"));+}+} // namespace testing} // namespace ov\ No newline at end of filediff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/group_query_attention.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/group_query_attention.cppindex 61d4835f9f5..64e1cdc16ac 100644--- a/src/frontends/onnx/frontend/src/op/com.microsoft/group_query_attention.cpp+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/group_query_attention.cpp@@ -31,7 +31,8 @@ using ov::frontend::onnx::attention::get_dimensions;namespace opset_1 {ov::OutputVector group_query_attention(const ov::frontend::onnx::Node& node) {constexpr size_t inputs_count_min = 7; // Taken from ONNX spec- constexpr size_t inputs_count_max = 16; // Taken from ONNX spec+ constexpr size_t inputs_count_max = 17; // 16 from ONNX spec + query_seqlens (ORT contrib-op extension)+ constexpr size_t query_seqlens_index = 16;// Minimum required inputs basing on the spec and ONNX Runtime code: 7// 0: packed QKV (mandatory)@@ -261,13 +262,17 @@ ov::OutputVector group_query_attention(const ov::frontend::onnx::Node& node) {// Process optional inputs: use a zero-sized Constant placeholder for missing optional ONNX inputs.// Note: When the ONNX's input index changed, the corresponding index in the GroupQueryAttentionInputs enum must// also be updated and may need mapping the index manually.- for (size_t i = ov_op_inputs.size(); i < inputs_count_max; ++i) {+ for (size_t i = ov_op_inputs.size(); i < query_seqlens_index; ++i) {if (i < onnx_op_inputs.size() && !ov::op::util::is_null(onnx_op_inputs[i])) {ov_op_inputs.push_back(onnx_op_inputs[i]);} else {ov_op_inputs.push_back(make_empty_optional_input());}}+ // query_seqlens (right-padded chunk) is appended only when wired, so models without it keep a 16-input op.+ if (common::is_input_valid(onnx_op_inputs, query_seqlens_index)) {+ ov_op_inputs.push_back(onnx_op_inputs[query_seqlens_index]);+ }// smooth_softmax's ONNX schema default is -1, not 0, yet ORT's own CPU/CUDA kernels enable it only when// the value is exactly 1. Comparing == 1 (not != 0) keeps a graph that never set the attribute fromdiff --git a/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_batched.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_batched.prototxtnew file mode 100644index 00000000000..40a36623141--- /dev/null+++ b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_batched.prototxt@@ -0,0 +1,691 @@+ir_version: 10+producer_name: "OpenVINO ONNX Frontend"+graph {+ node {+ input: "query"+ input: "key"+ input: "value"+ input: "past_key"+ input: "past_value"+ input: "seqlens_k"+ input: "total_sequence_length"+ input: "cos_cache"+ input: "sin_cache"+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: "query_seqlens"+ output: "out_full"+ output: "pk_full"+ output: "pv_full"+ op_type: "GroupQueryAttention"+ attribute {+ name: "do_rotary"+ i: 1+ type: INT+ }+ attribute {+ name: "kv_num_heads"+ i: 1+ type: INT+ }+ attribute {+ name: "num_heads"+ i: 2+ type: INT+ }+ domain: "com.microsoft"+ }+ node {+ input: "query"+ output: "q_shape"+ op_type: "Shape"+ }+ node {+ input: "q_shape"+ input: "idx1"+ output: "s_len"+ op_type: "Gather"+ }+ node {+ input: "zero_i"+ input: "s_len"+ input: "one_i"+ output: "q_range"+ op_type: "Range"+ }+ node {+ input: "q_range"+ input: "ax_0_2"+ output: "q_range_3d"+ op_type: "Unsqueeze"+ }+ node {+ input: "query_seqlens"+ output: "qsl_i64"+ op_type: "Cast"+ attribute {+ name: "to"+ i: 7+ type: INT+ }+ }+ node {+ input: "qsl_i64"+ input: "ax_1_2"+ output: "qsl_3d"+ op_type: "Unsqueeze"+ }+ node {+ input: "q_range_3d"+ input: "qsl_3d"+ output: "q_mask"+ op_type: "Less"+ }+ node {+ input: "q_mask"+ input: "out_full"+ input: "zero_f"+ output: "output"+ op_type: "Where"+ }+ node {+ input: "pk_full"+ output: "pk_shape"+ op_type: "Shape"+ }+ node {+ input: "pk_shape"+ input: "idx2"+ output: "kv_len"+ op_type: "Gather"+ }+ node {+ input: "zero_i"+ input: "kv_len"+ input: "one_i"+ output: "kv_range"+ op_type: "Range"+ }+ node {+ input: "kv_range"+ input: "ax_0_1_3"+ output: "kv_range_4d"+ op_type: "Unsqueeze"+ }+ node {+ input: "kv_rows"+ input: "ax_1_2_3"+ output: "kv_rows_4d"+ op_type: "Unsqueeze"+ }+ node {+ input: "kv_range_4d"+ input: "kv_rows_4d"+ output: "kv_mask"+ op_type: "Less"+ }+ node {+ input: "kv_mask"+ input: "pk_full"+ input: "zero_f"+ output: "present_key"+ op_type: "Where"+ }+ node {+ input: "kv_mask"+ input: "pv_full"+ input: "zero_f"+ output: "present_value"+ op_type: "Where"+ }+ name: "GroupQueryAttention_Graph"+ initializer {+ data_type: 7+ int64_data: 0+ name: "zero_i"+ }+ initializer {+ data_type: 7+ int64_data: 1+ name: "one_i"+ }+ initializer {+ data_type: 7+ int64_data: 1+ name: "idx1"+ }+ initializer {+ data_type: 7+ int64_data: 2+ name: "idx2"+ }+ initializer {+ dims: 2+ data_type: 7+ int64_data: 0+ int64_data: 2+ name: "ax_0_2"+ }+ initializer {+ dims: 2+ data_type: 7+ int64_data: 1+ int64_data: 2+ name: "ax_1_2"+ }+ initializer {+ dims: 3+ data_type: 7+ int64_data: 0+ int64_data: 1+ int64_data: 3+ name: "ax_0_1_3"+ }+ initializer {+ dims: 3+ data_type: 7+ int64_data: 1+ int64_data: 2+ int64_data: 3+ name: "ax_1_2_3"+ }+ initializer {+ data_type: 1+ float_data: 0.0+ name: "zero_f"+ }+ initializer {+ dims: 16+ dims: 8+ data_type: 1+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 0.540302+ float_data: 0.950415+ float_data: 0.995004+ float_data: 0.9995+ float_data: 0.99995+ float_data: 0.999995+ float_data: 1.0+ float_data: 1.0+ float_data: -0.416147+ float_data: 0.806578+ float_data: 0.980067+ float_data: 0.998001+ float_data: 0.9998+ float_data: 0.99998+ float_data: 0.999998+ float_data: 1.0+ float_data: -0.989992+ float_data: 0.582754+ float_data: 0.955336+ float_data: 0.995503+ float_data: 0.99955+ float_data: 0.999955+ float_data: 0.999996+ float_data: 1.0+ float_data: -0.653644+ float_data: 0.301137+ float_data: 0.921061+ float_data: 0.992011+ float_data: 0.9992+ float_data: 0.99992+ float_data: 0.999992+ float_data: 0.999999+ float_data: 0.283662+ float_data: -0.010342+ float_data: 0.877583+ float_data: 0.987526+ float_data: 0.99875+ float_data: 0.999875+ float_data: 0.999988+ float_data: 0.999999+ float_data: 0.96017+ float_data: -0.320796+ float_data: 0.825336+ float_data: 0.982054+ float_data: 0.998201+ float_data: 0.99982+ float_data: 0.999982+ float_data: 0.999998+ float_data: 0.753902+ float_data: -0.599438+ float_data: 0.764842+ float_data: 0.9756+ float_data: 0.997551+ float_data: 0.999755+ float_data: 0.999976+ float_data: 0.999998+ float_data: -0.1455+ float_data: -0.818632+ float_data: 0.696707+ float_data: 0.96817+ float_data: 0.996802+ float_data: 0.99968+ float_data: 0.999968+ float_data: 0.999997+ float_data: -0.91113+ float_data: -0.956644+ float_data: 0.62161+ float_data: 0.959773+ float_data: 0.995953+ float_data: 0.999595+ float_data: 0.99996+ float_data: 0.999996+ float_data: -0.839072+ float_data: -0.999786+ float_data: 0.540302+ float_data: 0.950415+ float_data: 0.995004+ float_data: 0.9995+ float_data: 0.99995+ float_data: 0.999995+ float_data: 0.004426+ float_data: -0.94378+ float_data: 0.453596+ float_data: 0.940108+ float_data: 0.993956+ float_data: 0.999395+ float_data: 0.99994+ float_data: 0.999994+ float_data: 0.843854+ float_data: -0.794179+ float_data: 0.362358+ float_data: 0.92886+ float_data: 0.992809+ float_data: 0.99928+ float_data: 0.999928+ float_data: 0.999993+ float_data: 0.907447+ float_data: -0.56582+ float_data: 0.267499+ float_data: 0.916683+ float_data: 0.991562+ float_data: 0.999155+ float_data: 0.999916+ float_data: 0.999992+ float_data: 0.136737+ float_data: -0.281349+ float_data: 0.169967+ float_data: 0.90359+ float_data: 0.990216+ float_data: 0.99902+ float_data: 0.999902+ float_data: 0.99999+ float_data: -0.759688+ float_data: 0.031022+ float_data: 0.070737+ float_data: 0.889594+ float_data: 0.988771+ float_data: 0.998875+ float_data: 0.999888+ float_data: 0.999989+ name: "cos_cache"+ }+ initializer {+ dims: 16+ dims: 8+ data_type: 1+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.841471+ float_data: 0.310984+ float_data: 0.099833+ float_data: 0.031618+ float_data: 0.01+ float_data: 0.003162+ float_data: 0.001+ float_data: 0.000316+ float_data: 0.909297+ float_data: 0.591127+ float_data: 0.198669+ float_data: 0.063203+ float_data: 0.019999+ float_data: 0.006325+ float_data: 0.002+ float_data: 0.000632+ float_data: 0.14112+ float_data: 0.812649+ float_data: 0.29552+ float_data: 0.094726+ float_data: 0.029996+ float_data: 0.009487+ float_data: 0.003+ float_data: 0.000949+ float_data: -0.756802+ float_data: 0.953581+ float_data: 0.389418+ float_data: 0.126154+ float_data: 0.039989+ float_data: 0.012649+ float_data: 0.004+ float_data: 0.001265+ float_data: -0.958924+ float_data: 0.999947+ float_data: 0.479426+ float_data: 0.157456+ float_data: 0.049979+ float_data: 0.015811+ float_data: 0.005+ float_data: 0.001581+ float_data: -0.279416+ float_data: 0.947148+ float_data: 0.564642+ float_data: 0.1886+ float_data: 0.059964+ float_data: 0.018973+ float_data: 0.006+ float_data: 0.001897+ float_data: 0.656987+ float_data: 0.800422+ float_data: 0.644218+ float_data: 0.219556+ float_data: 0.069943+ float_data: 0.022134+ float_data: 0.007+ float_data: 0.002214+ float_data: 0.989358+ float_data: 0.574318+ float_data: 0.717356+ float_data: 0.250292+ float_data: 0.079915+ float_data: 0.025296+ float_data: 0.008+ float_data: 0.00253+ float_data: 0.412118+ float_data: 0.291259+ float_data: 0.783327+ float_data: 0.280778+ float_data: 0.089879+ float_data: 0.028457+ float_data: 0.009+ float_data: 0.002846+ float_data: -0.544021+ float_data: -0.020684+ float_data: 0.841471+ float_data: 0.310984+ float_data: 0.099833+ float_data: 0.031618+ float_data: 0.01+ float_data: 0.003162+ float_data: -0.99999+ float_data: -0.330575+ float_data: 0.891207+ float_data: 0.340878+ float_data: 0.109778+ float_data: 0.034778+ float_data: 0.011+ float_data: 0.003478+ float_data: -0.536573+ float_data: -0.607683+ float_data: 0.932039+ float_data: 0.370431+ float_data: 0.119712+ float_data: 0.037938+ float_data: 0.012+ float_data: 0.003795+ float_data: 0.420167+ float_data: -0.824528+ float_data: 0.963558+ float_data: 0.399614+ float_data: 0.129634+ float_data: 0.041098+ float_data: 0.013+ float_data: 0.004111+ float_data: 0.990607+ float_data: -0.959605+ float_data: 0.98545+ float_data: 0.428398+ float_data: 0.139543+ float_data: 0.044257+ float_data: 0.014+ float_data: 0.004427+ float_data: 0.650288+ float_data: -0.999519+ float_data: 0.997495+ float_data: 0.456753+ float_data: 0.149438+ float_data: 0.047416+ float_data: 0.014999+ float_data: 0.004743+ name: "sin_cache"+ }+ input {+ name: "query"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "batch_size"+ }+ dim {+ dim_param: "sequence_length"+ }+ dim {+ dim_value: 32+ }+ }+ }+ }+ }+ input {+ name: "key"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "batch_size"+ }+ dim {+ dim_param: "sequence_length"+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "value"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "batch_size"+ }+ dim {+ dim_param: "sequence_length"+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "past_key"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "batch_size"+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_param: "past_sequence_length"+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "past_value"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "batch_size"+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_param: "past_sequence_length"+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "seqlens_k"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_param: "batch_size"+ }+ }+ }+ }+ }+ input {+ name: "total_sequence_length"+ type {+ tensor_type {+ elem_type: 6+ shape {+ }+ }+ }+ }+ input {+ name: "query_seqlens"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_param: "batch_size"+ }+ }+ }+ }+ }+ input {+ name: "kv_rows"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_param: "batch_size"+ }+ }+ }+ }+ }+ output {+ name: "output"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "ob"+ }+ dim {+ dim_param: "os"+ }+ dim {+ dim_value: 32+ }+ }+ }+ }+ }+ output {+ name: "present_key"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "kb"+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_param: "kl"+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ output {+ name: "present_value"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "kb"+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_param: "kl"+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+}+opset_import {+ domain: ""+ version: 17+}+opset_import {+ domain: "com.microsoft"+ version: 1+}diff --git a/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_growing_cache.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_growing_cache.prototxtnew file mode 100644index 00000000000..fcf5c8793bf--- /dev/null+++ b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_growing_cache.prototxt@@ -0,0 +1,497 @@+ir_version: 10+graph {+ node {+ input: "query"+ input: ""+ input: ""+ input: "past_key"+ input: "past_value"+ input: "seqlens_k"+ input: "total_sequence_length"+ input: "cos_cache"+ input: "sin_cache"+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: "query_seqlens"+ output: "out_full"+ output: "pk_full"+ output: "pv_full"+ name: "GroupQueryAttention_0"+ op_type: "GroupQueryAttention"+ attribute {+ name: "do_rotary"+ i: 1+ type: INT+ }+ attribute {+ name: "kv_num_heads"+ i: 1+ type: INT+ }+ attribute {+ name: "num_heads"+ i: 2+ type: INT+ }+ domain: "com.microsoft"+ }+ node {+ input: "out_full"+ input: "zero"+ input: "q_rows"+ input: "ax1"+ output: "output"+ op_type: "Slice"+ }+ node {+ input: "pk_full"+ input: "zero"+ input: "kv_rows"+ input: "ax2"+ output: "present_key"+ op_type: "Slice"+ }+ node {+ input: "pv_full"+ input: "zero"+ input: "kv_rows"+ input: "ax2"+ output: "present_value"+ op_type: "Slice"+ }+ name: "GroupQueryAttention_Graph"+ initializer {+ dims: 16+ dims: 8+ data_type: 1+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 0.5403023+ float_data: 0.95041525+ float_data: 0.9950042+ float_data: 0.99950004+ float_data: 0.99995+ float_data: 0.999995+ float_data: 0.9999995+ float_data: 0.99999994+ float_data: -0.41614684+ float_data: 0.8065784+ float_data: 0.9800666+ float_data: 0.9980007+ float_data: 0.9998+ float_data: 0.99998+ float_data: 0.999998+ float_data: 0.9999998+ float_data: -0.9899925+ float_data: 0.5827536+ float_data: 0.9553365+ float_data: 0.99550337+ float_data: 0.99955004+ float_data: 0.999955+ float_data: 0.9999955+ float_data: 0.9999995+ float_data: -0.6536436+ float_data: 0.30113748+ float_data: 0.921061+ float_data: 0.99201065+ float_data: 0.9992001+ float_data: 0.99992+ float_data: 0.999992+ float_data: 0.9999992+ float_data: 0.2836622+ float_data: -0.010342319+ float_data: 0.87758255+ float_data: 0.987526+ float_data: 0.99875027+ float_data: 0.999875+ float_data: 0.9999875+ float_data: 0.99999875+ float_data: 0.96017027+ float_data: -0.32079646+ float_data: 0.8253356+ float_data: 0.98205394+ float_data: 0.99820054+ float_data: 0.99982+ float_data: 0.999982+ float_data: 0.9999982+ float_data: 0.75390226+ float_data: -0.5994374+ float_data: 0.7648422+ float_data: 0.9755999+ float_data: 0.997551+ float_data: 0.999755+ float_data: 0.9999755+ float_data: 0.99999756+ float_data: -0.14550003+ float_data: -0.8186325+ float_data: 0.6967067+ float_data: 0.9681703+ float_data: 0.99680173+ float_data: 0.99968004+ float_data: 0.999968+ float_data: 0.9999968+ float_data: -0.91113025+ float_data: -0.9566442+ float_data: 0.62161+ float_data: 0.95977265+ float_data: 0.9959527+ float_data: 0.99959505+ float_data: 0.9999595+ float_data: 0.99999595+ float_data: -0.8390715+ float_data: -0.9997861+ float_data: 0.5403023+ float_data: 0.95041525+ float_data: 0.9950042+ float_data: 0.99950004+ float_data: 0.99995+ float_data: 0.999995+ float_data: 0.004425698+ float_data: -0.9437797+ float_data: 0.45359612+ float_data: 0.9401076+ float_data: 0.9939561+ float_data: 0.9993951+ float_data: 0.9999395+ float_data: 0.9999939+ float_data: 0.84385395+ float_data: -0.79417926+ float_data: 0.36235777+ float_data: 0.9288599+ float_data: 0.99280864+ float_data: 0.9992801+ float_data: 0.999928+ float_data: 0.9999928+ float_data: 0.9074468+ float_data: -0.5658205+ float_data: 0.26749882+ float_data: 0.9166834+ float_data: 0.9915619+ float_data: 0.9991551+ float_data: 0.9999155+ float_data: 0.99999154+ float_data: 0.13673721+ float_data: -0.28134963+ float_data: 0.16996714+ float_data: 0.90359026+ float_data: 0.990216+ float_data: 0.99902016+ float_data: 0.999902+ float_data: 0.9999902+ float_data: -0.7596879+ float_data: 0.031022532+ float_data: 0.0707372+ float_data: 0.8895936+ float_data: 0.9887711+ float_data: 0.9988752+ float_data: 0.9998875+ float_data: 0.99998873+ name: "cos_cache"+ }+ initializer {+ dims: 16+ dims: 8+ data_type: 1+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.84147096+ float_data: 0.3109836+ float_data: 0.099833414+ float_data: 0.031617507+ float_data: 0.009999833+ float_data: 0.0031622723+ float_data: 0.0009999998+ float_data: 0.00031622776+ float_data: 0.9092974+ float_data: 0.5911271+ float_data: 0.19866933+ float_data: 0.063203394+ float_data: 0.019998666+ float_data: 0.0063245133+ float_data: 0.0019999987+ float_data: 0.0006324555+ float_data: 0.14112+ float_data: 0.8126489+ float_data: 0.29552022+ float_data: 0.09472609+ float_data: 0.029995501+ float_data: 0.009486691+ float_data: 0.0029999956+ float_data: 0.0009486832+ float_data: -0.7568025+ float_data: 0.95358074+ float_data: 0.38941833+ float_data: 0.12615407+ float_data: 0.039989334+ float_data: 0.012648773+ float_data: 0.0039999895+ float_data: 0.0012649107+ float_data: -0.9589243+ float_data: 0.99994653+ float_data: 0.47942555+ float_data: 0.15745589+ float_data: 0.04997917+ float_data: 0.01581073+ float_data: 0.0049999794+ float_data: 0.0015811381+ float_data: -0.2794155+ float_data: 0.94714814+ float_data: 0.5646425+ float_data: 0.18860029+ float_data: 0.059964005+ float_data: 0.018972527+ float_data: 0.005999964+ float_data: 0.0018973654+ float_data: 0.6569866+ float_data: 0.80042166+ float_data: 0.64421767+ float_data: 0.2195561+ float_data: 0.06994285+ float_data: 0.022134136+ float_data: 0.006999943+ float_data: 0.0022135926+ float_data: 0.98935825+ float_data: 0.57431775+ float_data: 0.7173561+ float_data: 0.25029236+ float_data: 0.0799147+ float_data: 0.025295522+ float_data: 0.007999915+ float_data: 0.0025298195+ float_data: 0.4121185+ float_data: 0.2912591+ float_data: 0.7833269+ float_data: 0.28077835+ float_data: 0.08987855+ float_data: 0.028456656+ float_data: 0.008999879+ float_data: 0.0028460461+ float_data: -0.5440211+ float_data: -0.02068353+ float_data: 0.84147096+ float_data: 0.3109836+ float_data: 0.099833414+ float_data: 0.031617507+ float_data: 0.009999833+ float_data: 0.0031622723+ float_data: -0.9999902+ float_data: -0.33057502+ float_data: 0.89120734+ float_data: 0.34087786+ float_data: 0.1097783+ float_data: 0.03477804+ float_data: 0.010999778+ float_data: 0.0034784984+ float_data: -0.53657293+ float_data: -0.60768354+ float_data: 0.9320391+ float_data: 0.3704313+ float_data: 0.119712204+ float_data: 0.037938226+ float_data: 0.011999712+ float_data: 0.0037947241+ float_data: 0.42016703+ float_data: -0.82452846+ float_data: 0.9635582+ float_data: 0.39961433+ float_data: 0.12963414+ float_data: 0.041098032+ float_data: 0.012999634+ float_data: 0.0041109496+ float_data: 0.9906074+ float_data: -0.95960534+ float_data: 0.98544973+ float_data: 0.4283978+ float_data: 0.13954312+ float_data: 0.044257425+ float_data: 0.013999542+ float_data: 0.004427174+ float_data: 0.65028787+ float_data: -0.9995187+ float_data: 0.997495+ float_data: 0.45675287+ float_data: 0.14943813+ float_data: 0.047416378+ float_data: 0.014999437+ float_data: 0.0047433986+ name: "sin_cache"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 0+ name: "zero"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 2+ name: "q_rows"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 5+ name: "kv_rows"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 1+ name: "ax1"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 2+ name: "ax2"+ }+ input {+ name: "query"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "batch_size"+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 64+ }+ }+ }+ }+ }+ input {+ name: "past_key"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "batch_size"+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_param: "past_sequence_length"+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "past_value"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "batch_size"+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_param: "past_sequence_length"+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "seqlens_k"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_param: "batch_size"+ }+ }+ }+ }+ }+ input {+ name: "total_sequence_length"+ type {+ tensor_type {+ elem_type: 6+ shape {+ }+ }+ }+ }+ input {+ name: "query_seqlens"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_param: "batch_size"+ }+ }+ }+ }+ }+ output {+ name: "output"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+ output {+ name: "present_key"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+ output {+ name: "present_value"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+}+opset_import {+ domain: ""+ version: 17+}+opset_import {+ domain: "com.microsoft"+ version: 1+}diff --git a/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_i8kv.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_i8kv.prototxtnew file mode 100644index 00000000000..58b73446599--- /dev/null+++ b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_i8kv.prototxt@@ -0,0 +1,524 @@+ir_version: 10+graph {+ node {+ input: "query"+ input: ""+ input: ""+ input: "past_key"+ input: "past_value"+ input: "seqlens_k"+ input: "total_sequence_length"+ input: "cos_cache"+ input: "sin_cache"+ input: ""+ input: ""+ input: ""+ input: "k_scale"+ input: "v_scale"+ input: ""+ input: ""+ input: "query_seqlens"+ output: "out_full"+ output: "pk_full"+ output: "pv_full"+ name: "GroupQueryAttention_0"+ op_type: "GroupQueryAttention"+ attribute {+ name: "do_rotary"+ i: 1+ type: INT+ }+ attribute {+ name: "k_quant_type"+ s: "PER_TENSOR"+ type: STRING+ }+ attribute {+ name: "kv_cache_bit_width"+ i: 8+ type: INT+ }+ attribute {+ name: "kv_num_heads"+ i: 1+ type: INT+ }+ attribute {+ name: "num_heads"+ i: 2+ type: INT+ }+ attribute {+ name: "v_quant_type"+ s: "PER_TENSOR"+ type: STRING+ }+ domain: "com.microsoft"+ }+ node {+ input: "out_full"+ input: "zero"+ input: "q_rows"+ input: "ax1"+ output: "output"+ op_type: "Slice"+ }+ node {+ input: "pk_full"+ input: "zero"+ input: "kv_rows"+ input: "ax2"+ output: "present_key"+ op_type: "Slice"+ }+ node {+ input: "pv_full"+ input: "zero"+ input: "kv_rows"+ input: "ax2"+ output: "present_value"+ op_type: "Slice"+ }+ name: "GroupQueryAttention_Graph"+ initializer {+ dims: 16+ dims: 8+ data_type: 1+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 0.5403023+ float_data: 0.95041525+ float_data: 0.9950042+ float_data: 0.99950004+ float_data: 0.99995+ float_data: 0.999995+ float_data: 0.9999995+ float_data: 0.99999994+ float_data: -0.41614684+ float_data: 0.8065784+ float_data: 0.9800666+ float_data: 0.9980007+ float_data: 0.9998+ float_data: 0.99998+ float_data: 0.999998+ float_data: 0.9999998+ float_data: -0.9899925+ float_data: 0.5827536+ float_data: 0.9553365+ float_data: 0.99550337+ float_data: 0.99955004+ float_data: 0.999955+ float_data: 0.9999955+ float_data: 0.9999995+ float_data: -0.6536436+ float_data: 0.30113748+ float_data: 0.921061+ float_data: 0.99201065+ float_data: 0.9992001+ float_data: 0.99992+ float_data: 0.999992+ float_data: 0.9999992+ float_data: 0.2836622+ float_data: -0.010342319+ float_data: 0.87758255+ float_data: 0.987526+ float_data: 0.99875027+ float_data: 0.999875+ float_data: 0.9999875+ float_data: 0.99999875+ float_data: 0.96017027+ float_data: -0.32079646+ float_data: 0.8253356+ float_data: 0.98205394+ float_data: 0.99820054+ float_data: 0.99982+ float_data: 0.999982+ float_data: 0.9999982+ float_data: 0.75390226+ float_data: -0.5994374+ float_data: 0.7648422+ float_data: 0.9755999+ float_data: 0.997551+ float_data: 0.999755+ float_data: 0.9999755+ float_data: 0.99999756+ float_data: -0.14550003+ float_data: -0.8186325+ float_data: 0.6967067+ float_data: 0.9681703+ float_data: 0.99680173+ float_data: 0.99968004+ float_data: 0.999968+ float_data: 0.9999968+ float_data: -0.91113025+ float_data: -0.9566442+ float_data: 0.62161+ float_data: 0.95977265+ float_data: 0.9959527+ float_data: 0.99959505+ float_data: 0.9999595+ float_data: 0.99999595+ float_data: -0.8390715+ float_data: -0.9997861+ float_data: 0.5403023+ float_data: 0.95041525+ float_data: 0.9950042+ float_data: 0.99950004+ float_data: 0.99995+ float_data: 0.999995+ float_data: 0.004425698+ float_data: -0.9437797+ float_data: 0.45359612+ float_data: 0.9401076+ float_data: 0.9939561+ float_data: 0.9993951+ float_data: 0.9999395+ float_data: 0.9999939+ float_data: 0.84385395+ float_data: -0.79417926+ float_data: 0.36235777+ float_data: 0.9288599+ float_data: 0.99280864+ float_data: 0.9992801+ float_data: 0.999928+ float_data: 0.9999928+ float_data: 0.9074468+ float_data: -0.5658205+ float_data: 0.26749882+ float_data: 0.9166834+ float_data: 0.9915619+ float_data: 0.9991551+ float_data: 0.9999155+ float_data: 0.99999154+ float_data: 0.13673721+ float_data: -0.28134963+ float_data: 0.16996714+ float_data: 0.90359026+ float_data: 0.990216+ float_data: 0.99902016+ float_data: 0.999902+ float_data: 0.9999902+ float_data: -0.7596879+ float_data: 0.031022532+ float_data: 0.0707372+ float_data: 0.8895936+ float_data: 0.9887711+ float_data: 0.9988752+ float_data: 0.9998875+ float_data: 0.99998873+ name: "cos_cache"+ }+ initializer {+ dims: 16+ dims: 8+ data_type: 1+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.84147096+ float_data: 0.3109836+ float_data: 0.099833414+ float_data: 0.031617507+ float_data: 0.009999833+ float_data: 0.0031622723+ float_data: 0.0009999998+ float_data: 0.00031622776+ float_data: 0.9092974+ float_data: 0.5911271+ float_data: 0.19866933+ float_data: 0.063203394+ float_data: 0.019998666+ float_data: 0.0063245133+ float_data: 0.0019999987+ float_data: 0.0006324555+ float_data: 0.14112+ float_data: 0.8126489+ float_data: 0.29552022+ float_data: 0.09472609+ float_data: 0.029995501+ float_data: 0.009486691+ float_data: 0.0029999956+ float_data: 0.0009486832+ float_data: -0.7568025+ float_data: 0.95358074+ float_data: 0.38941833+ float_data: 0.12615407+ float_data: 0.039989334+ float_data: 0.012648773+ float_data: 0.0039999895+ float_data: 0.0012649107+ float_data: -0.9589243+ float_data: 0.99994653+ float_data: 0.47942555+ float_data: 0.15745589+ float_data: 0.04997917+ float_data: 0.01581073+ float_data: 0.0049999794+ float_data: 0.0015811381+ float_data: -0.2794155+ float_data: 0.94714814+ float_data: 0.5646425+ float_data: 0.18860029+ float_data: 0.059964005+ float_data: 0.018972527+ float_data: 0.005999964+ float_data: 0.0018973654+ float_data: 0.6569866+ float_data: 0.80042166+ float_data: 0.64421767+ float_data: 0.2195561+ float_data: 0.06994285+ float_data: 0.022134136+ float_data: 0.006999943+ float_data: 0.0022135926+ float_data: 0.98935825+ float_data: 0.57431775+ float_data: 0.7173561+ float_data: 0.25029236+ float_data: 0.0799147+ float_data: 0.025295522+ float_data: 0.007999915+ float_data: 0.0025298195+ float_data: 0.4121185+ float_data: 0.2912591+ float_data: 0.7833269+ float_data: 0.28077835+ float_data: 0.08987855+ float_data: 0.028456656+ float_data: 0.008999879+ float_data: 0.0028460461+ float_data: -0.5440211+ float_data: -0.02068353+ float_data: 0.84147096+ float_data: 0.3109836+ float_data: 0.099833414+ float_data: 0.031617507+ float_data: 0.009999833+ float_data: 0.0031622723+ float_data: -0.9999902+ float_data: -0.33057502+ float_data: 0.89120734+ float_data: 0.34087786+ float_data: 0.1097783+ float_data: 0.03477804+ float_data: 0.010999778+ float_data: 0.0034784984+ float_data: -0.53657293+ float_data: -0.60768354+ float_data: 0.9320391+ float_data: 0.3704313+ float_data: 0.119712204+ float_data: 0.037938226+ float_data: 0.011999712+ float_data: 0.0037947241+ float_data: 0.42016703+ float_data: -0.82452846+ float_data: 0.9635582+ float_data: 0.39961433+ float_data: 0.12963414+ float_data: 0.041098032+ float_data: 0.012999634+ float_data: 0.0041109496+ float_data: 0.9906074+ float_data: -0.95960534+ float_data: 0.98544973+ float_data: 0.4283978+ float_data: 0.13954312+ float_data: 0.044257425+ float_data: 0.013999542+ float_data: 0.004427174+ float_data: 0.65028787+ float_data: -0.9995187+ float_data: 0.997495+ float_data: 0.45675287+ float_data: 0.14943813+ float_data: 0.047416378+ float_data: 0.014999437+ float_data: 0.0047433986+ name: "sin_cache"+ }+ initializer {+ dims: 1+ data_type: 1+ float_data: 0.05+ name: "k_scale"+ }+ initializer {+ dims: 1+ data_type: 1+ float_data: 0.04+ name: "v_scale"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 0+ name: "zero"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 2+ name: "q_rows"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 5+ name: "kv_rows"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 1+ name: "ax1"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 2+ name: "ax2"+ }+ input {+ name: "query"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 64+ }+ }+ }+ }+ }+ input {+ name: "past_key"+ type {+ tensor_type {+ elem_type: 3+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 8+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "past_value"+ type {+ tensor_type {+ elem_type: 3+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 8+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "seqlens_k"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ input {+ name: "total_sequence_length"+ type {+ tensor_type {+ elem_type: 6+ shape {+ }+ }+ }+ }+ input {+ name: "query_seqlens"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ output {+ name: "output"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+ output {+ name: "present_key"+ type {+ tensor_type {+ elem_type: 3+ }+ }+ }+ output {+ name: "present_value"+ type {+ tensor_type {+ elem_type: 3+ }+ }+ }+}+opset_import {+ domain: ""+ version: 17+}+opset_import {+ domain: "com.microsoft"+ version: 1+}diff --git a/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_position_ids.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_position_ids.prototxtnew file mode 100644index 00000000000..f5683808951--- /dev/null+++ b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_position_ids.prototxt@@ -0,0 +1,513 @@+ir_version: 10+graph {+ node {+ input: "query"+ input: ""+ input: ""+ input: "past_key"+ input: "past_value"+ input: "seqlens_k"+ input: "total_sequence_length"+ input: "cos_cache"+ input: "sin_cache"+ input: "position_ids"+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: "query_seqlens"+ output: "out_full"+ output: "pk_full"+ output: "pv_full"+ name: "GroupQueryAttention_0"+ op_type: "GroupQueryAttention"+ attribute {+ name: "do_rotary"+ i: 1+ type: INT+ }+ attribute {+ name: "kv_num_heads"+ i: 1+ type: INT+ }+ attribute {+ name: "num_heads"+ i: 2+ type: INT+ }+ domain: "com.microsoft"+ }+ node {+ input: "out_full"+ input: "zero"+ input: "q_rows"+ input: "ax1"+ output: "output"+ op_type: "Slice"+ }+ node {+ input: "pk_full"+ input: "zero"+ input: "kv_rows"+ input: "ax2"+ output: "present_key"+ op_type: "Slice"+ }+ node {+ input: "pv_full"+ input: "zero"+ input: "kv_rows"+ input: "ax2"+ output: "present_value"+ op_type: "Slice"+ }+ name: "GroupQueryAttention_Graph"+ initializer {+ dims: 16+ dims: 8+ data_type: 1+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 0.5403023+ float_data: 0.95041525+ float_data: 0.9950042+ float_data: 0.99950004+ float_data: 0.99995+ float_data: 0.999995+ float_data: 0.9999995+ float_data: 0.99999994+ float_data: -0.41614684+ float_data: 0.8065784+ float_data: 0.9800666+ float_data: 0.9980007+ float_data: 0.9998+ float_data: 0.99998+ float_data: 0.999998+ float_data: 0.9999998+ float_data: -0.9899925+ float_data: 0.5827536+ float_data: 0.9553365+ float_data: 0.99550337+ float_data: 0.99955004+ float_data: 0.999955+ float_data: 0.9999955+ float_data: 0.9999995+ float_data: -0.6536436+ float_data: 0.30113748+ float_data: 0.921061+ float_data: 0.99201065+ float_data: 0.9992001+ float_data: 0.99992+ float_data: 0.999992+ float_data: 0.9999992+ float_data: 0.2836622+ float_data: -0.010342319+ float_data: 0.87758255+ float_data: 0.987526+ float_data: 0.99875027+ float_data: 0.999875+ float_data: 0.9999875+ float_data: 0.99999875+ float_data: 0.96017027+ float_data: -0.32079646+ float_data: 0.8253356+ float_data: 0.98205394+ float_data: 0.99820054+ float_data: 0.99982+ float_data: 0.999982+ float_data: 0.9999982+ float_data: 0.75390226+ float_data: -0.5994374+ float_data: 0.7648422+ float_data: 0.9755999+ float_data: 0.997551+ float_data: 0.999755+ float_data: 0.9999755+ float_data: 0.99999756+ float_data: -0.14550003+ float_data: -0.8186325+ float_data: 0.6967067+ float_data: 0.9681703+ float_data: 0.99680173+ float_data: 0.99968004+ float_data: 0.999968+ float_data: 0.9999968+ float_data: -0.91113025+ float_data: -0.9566442+ float_data: 0.62161+ float_data: 0.95977265+ float_data: 0.9959527+ float_data: 0.99959505+ float_data: 0.9999595+ float_data: 0.99999595+ float_data: -0.8390715+ float_data: -0.9997861+ float_data: 0.5403023+ float_data: 0.95041525+ float_data: 0.9950042+ float_data: 0.99950004+ float_data: 0.99995+ float_data: 0.999995+ float_data: 0.004425698+ float_data: -0.9437797+ float_data: 0.45359612+ float_data: 0.9401076+ float_data: 0.9939561+ float_data: 0.9993951+ float_data: 0.9999395+ float_data: 0.9999939+ float_data: 0.84385395+ float_data: -0.79417926+ float_data: 0.36235777+ float_data: 0.9288599+ float_data: 0.99280864+ float_data: 0.9992801+ float_data: 0.999928+ float_data: 0.9999928+ float_data: 0.9074468+ float_data: -0.5658205+ float_data: 0.26749882+ float_data: 0.9166834+ float_data: 0.9915619+ float_data: 0.9991551+ float_data: 0.9999155+ float_data: 0.99999154+ float_data: 0.13673721+ float_data: -0.28134963+ float_data: 0.16996714+ float_data: 0.90359026+ float_data: 0.990216+ float_data: 0.99902016+ float_data: 0.999902+ float_data: 0.9999902+ float_data: -0.7596879+ float_data: 0.031022532+ float_data: 0.0707372+ float_data: 0.8895936+ float_data: 0.9887711+ float_data: 0.9988752+ float_data: 0.9998875+ float_data: 0.99998873+ name: "cos_cache"+ }+ initializer {+ dims: 16+ dims: 8+ data_type: 1+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.84147096+ float_data: 0.3109836+ float_data: 0.099833414+ float_data: 0.031617507+ float_data: 0.009999833+ float_data: 0.0031622723+ float_data: 0.0009999998+ float_data: 0.00031622776+ float_data: 0.9092974+ float_data: 0.5911271+ float_data: 0.19866933+ float_data: 0.063203394+ float_data: 0.019998666+ float_data: 0.0063245133+ float_data: 0.0019999987+ float_data: 0.0006324555+ float_data: 0.14112+ float_data: 0.8126489+ float_data: 0.29552022+ float_data: 0.09472609+ float_data: 0.029995501+ float_data: 0.009486691+ float_data: 0.0029999956+ float_data: 0.0009486832+ float_data: -0.7568025+ float_data: 0.95358074+ float_data: 0.38941833+ float_data: 0.12615407+ float_data: 0.039989334+ float_data: 0.012648773+ float_data: 0.0039999895+ float_data: 0.0012649107+ float_data: -0.9589243+ float_data: 0.99994653+ float_data: 0.47942555+ float_data: 0.15745589+ float_data: 0.04997917+ float_data: 0.01581073+ float_data: 0.0049999794+ float_data: 0.0015811381+ float_data: -0.2794155+ float_data: 0.94714814+ float_data: 0.5646425+ float_data: 0.18860029+ float_data: 0.059964005+ float_data: 0.018972527+ float_data: 0.005999964+ float_data: 0.0018973654+ float_data: 0.6569866+ float_data: 0.80042166+ float_data: 0.64421767+ float_data: 0.2195561+ float_data: 0.06994285+ float_data: 0.022134136+ float_data: 0.006999943+ float_data: 0.0022135926+ float_data: 0.98935825+ float_data: 0.57431775+ float_data: 0.7173561+ float_data: 0.25029236+ float_data: 0.0799147+ float_data: 0.025295522+ float_data: 0.007999915+ float_data: 0.0025298195+ float_data: 0.4121185+ float_data: 0.2912591+ float_data: 0.7833269+ float_data: 0.28077835+ float_data: 0.08987855+ float_data: 0.028456656+ float_data: 0.008999879+ float_data: 0.0028460461+ float_data: -0.5440211+ float_data: -0.02068353+ float_data: 0.84147096+ float_data: 0.3109836+ float_data: 0.099833414+ float_data: 0.031617507+ float_data: 0.009999833+ float_data: 0.0031622723+ float_data: -0.9999902+ float_data: -0.33057502+ float_data: 0.89120734+ float_data: 0.34087786+ float_data: 0.1097783+ float_data: 0.03477804+ float_data: 0.010999778+ float_data: 0.0034784984+ float_data: -0.53657293+ float_data: -0.60768354+ float_data: 0.9320391+ float_data: 0.3704313+ float_data: 0.119712204+ float_data: 0.037938226+ float_data: 0.011999712+ float_data: 0.0037947241+ float_data: 0.42016703+ float_data: -0.82452846+ float_data: 0.9635582+ float_data: 0.39961433+ float_data: 0.12963414+ float_data: 0.041098032+ float_data: 0.012999634+ float_data: 0.0041109496+ float_data: 0.9906074+ float_data: -0.95960534+ float_data: 0.98544973+ float_data: 0.4283978+ float_data: 0.13954312+ float_data: 0.044257425+ float_data: 0.013999542+ float_data: 0.004427174+ float_data: 0.65028787+ float_data: -0.9995187+ float_data: 0.997495+ float_data: 0.45675287+ float_data: 0.14943813+ float_data: 0.047416378+ float_data: 0.014999437+ float_data: 0.0047433986+ name: "sin_cache"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 0+ name: "zero"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 2+ name: "q_rows"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 5+ name: "kv_rows"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 1+ name: "ax1"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 2+ name: "ax2"+ }+ input {+ name: "query"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 64+ }+ }+ }+ }+ }+ input {+ name: "past_key"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 8+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "past_value"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 8+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "seqlens_k"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ input {+ name: "total_sequence_length"+ type {+ tensor_type {+ elem_type: 6+ shape {+ }+ }+ }+ }+ input {+ name: "query_seqlens"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ input {+ name: "position_ids"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ }+ }+ }+ }+ output {+ name: "output"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+ output {+ name: "present_key"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+ output {+ name: "present_value"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+}+opset_import {+ domain: ""+ version: 17+}+opset_import {+ domain: "com.microsoft"+ version: 1+}diff --git a/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_single_token.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_single_token.prototxtnew file mode 100644index 00000000000..c7d8fc5b5f7--- /dev/null+++ b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_single_token.prototxt@@ -0,0 +1,497 @@+ir_version: 10+graph {+ node {+ input: "query"+ input: ""+ input: ""+ input: "past_key"+ input: "past_value"+ input: "seqlens_k"+ input: "total_sequence_length"+ input: "cos_cache"+ input: "sin_cache"+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: "query_seqlens"+ output: "out_full"+ output: "pk_full"+ output: "pv_full"+ name: "GroupQueryAttention_0"+ op_type: "GroupQueryAttention"+ attribute {+ name: "do_rotary"+ i: 1+ type: INT+ }+ attribute {+ name: "kv_num_heads"+ i: 1+ type: INT+ }+ attribute {+ name: "num_heads"+ i: 2+ type: INT+ }+ domain: "com.microsoft"+ }+ node {+ input: "out_full"+ input: "zero"+ input: "q_rows"+ input: "ax1"+ output: "output"+ op_type: "Slice"+ }+ node {+ input: "pk_full"+ input: "zero"+ input: "kv_rows"+ input: "ax2"+ output: "present_key"+ op_type: "Slice"+ }+ node {+ input: "pv_full"+ input: "zero"+ input: "kv_rows"+ input: "ax2"+ output: "present_value"+ op_type: "Slice"+ }+ name: "GroupQueryAttention_Graph"+ initializer {+ dims: 16+ dims: 8+ data_type: 1+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 0.5403023+ float_data: 0.95041525+ float_data: 0.9950042+ float_data: 0.99950004+ float_data: 0.99995+ float_data: 0.999995+ float_data: 0.9999995+ float_data: 0.99999994+ float_data: -0.41614684+ float_data: 0.8065784+ float_data: 0.9800666+ float_data: 0.9980007+ float_data: 0.9998+ float_data: 0.99998+ float_data: 0.999998+ float_data: 0.9999998+ float_data: -0.9899925+ float_data: 0.5827536+ float_data: 0.9553365+ float_data: 0.99550337+ float_data: 0.99955004+ float_data: 0.999955+ float_data: 0.9999955+ float_data: 0.9999995+ float_data: -0.6536436+ float_data: 0.30113748+ float_data: 0.921061+ float_data: 0.99201065+ float_data: 0.9992001+ float_data: 0.99992+ float_data: 0.999992+ float_data: 0.9999992+ float_data: 0.2836622+ float_data: -0.010342319+ float_data: 0.87758255+ float_data: 0.987526+ float_data: 0.99875027+ float_data: 0.999875+ float_data: 0.9999875+ float_data: 0.99999875+ float_data: 0.96017027+ float_data: -0.32079646+ float_data: 0.8253356+ float_data: 0.98205394+ float_data: 0.99820054+ float_data: 0.99982+ float_data: 0.999982+ float_data: 0.9999982+ float_data: 0.75390226+ float_data: -0.5994374+ float_data: 0.7648422+ float_data: 0.9755999+ float_data: 0.997551+ float_data: 0.999755+ float_data: 0.9999755+ float_data: 0.99999756+ float_data: -0.14550003+ float_data: -0.8186325+ float_data: 0.6967067+ float_data: 0.9681703+ float_data: 0.99680173+ float_data: 0.99968004+ float_data: 0.999968+ float_data: 0.9999968+ float_data: -0.91113025+ float_data: -0.9566442+ float_data: 0.62161+ float_data: 0.95977265+ float_data: 0.9959527+ float_data: 0.99959505+ float_data: 0.9999595+ float_data: 0.99999595+ float_data: -0.8390715+ float_data: -0.9997861+ float_data: 0.5403023+ float_data: 0.95041525+ float_data: 0.9950042+ float_data: 0.99950004+ float_data: 0.99995+ float_data: 0.999995+ float_data: 0.004425698+ float_data: -0.9437797+ float_data: 0.45359612+ float_data: 0.9401076+ float_data: 0.9939561+ float_data: 0.9993951+ float_data: 0.9999395+ float_data: 0.9999939+ float_data: 0.84385395+ float_data: -0.79417926+ float_data: 0.36235777+ float_data: 0.9288599+ float_data: 0.99280864+ float_data: 0.9992801+ float_data: 0.999928+ float_data: 0.9999928+ float_data: 0.9074468+ float_data: -0.5658205+ float_data: 0.26749882+ float_data: 0.9166834+ float_data: 0.9915619+ float_data: 0.9991551+ float_data: 0.9999155+ float_data: 0.99999154+ float_data: 0.13673721+ float_data: -0.28134963+ float_data: 0.16996714+ float_data: 0.90359026+ float_data: 0.990216+ float_data: 0.99902016+ float_data: 0.999902+ float_data: 0.9999902+ float_data: -0.7596879+ float_data: 0.031022532+ float_data: 0.0707372+ float_data: 0.8895936+ float_data: 0.9887711+ float_data: 0.9988752+ float_data: 0.9998875+ float_data: 0.99998873+ name: "cos_cache"+ }+ initializer {+ dims: 16+ dims: 8+ data_type: 1+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.84147096+ float_data: 0.3109836+ float_data: 0.099833414+ float_data: 0.031617507+ float_data: 0.009999833+ float_data: 0.0031622723+ float_data: 0.0009999998+ float_data: 0.00031622776+ float_data: 0.9092974+ float_data: 0.5911271+ float_data: 0.19866933+ float_data: 0.063203394+ float_data: 0.019998666+ float_data: 0.0063245133+ float_data: 0.0019999987+ float_data: 0.0006324555+ float_data: 0.14112+ float_data: 0.8126489+ float_data: 0.29552022+ float_data: 0.09472609+ float_data: 0.029995501+ float_data: 0.009486691+ float_data: 0.0029999956+ float_data: 0.0009486832+ float_data: -0.7568025+ float_data: 0.95358074+ float_data: 0.38941833+ float_data: 0.12615407+ float_data: 0.039989334+ float_data: 0.012648773+ float_data: 0.0039999895+ float_data: 0.0012649107+ float_data: -0.9589243+ float_data: 0.99994653+ float_data: 0.47942555+ float_data: 0.15745589+ float_data: 0.04997917+ float_data: 0.01581073+ float_data: 0.0049999794+ float_data: 0.0015811381+ float_data: -0.2794155+ float_data: 0.94714814+ float_data: 0.5646425+ float_data: 0.18860029+ float_data: 0.059964005+ float_data: 0.018972527+ float_data: 0.005999964+ float_data: 0.0018973654+ float_data: 0.6569866+ float_data: 0.80042166+ float_data: 0.64421767+ float_data: 0.2195561+ float_data: 0.06994285+ float_data: 0.022134136+ float_data: 0.006999943+ float_data: 0.0022135926+ float_data: 0.98935825+ float_data: 0.57431775+ float_data: 0.7173561+ float_data: 0.25029236+ float_data: 0.0799147+ float_data: 0.025295522+ float_data: 0.007999915+ float_data: 0.0025298195+ float_data: 0.4121185+ float_data: 0.2912591+ float_data: 0.7833269+ float_data: 0.28077835+ float_data: 0.08987855+ float_data: 0.028456656+ float_data: 0.008999879+ float_data: 0.0028460461+ float_data: -0.5440211+ float_data: -0.02068353+ float_data: 0.84147096+ float_data: 0.3109836+ float_data: 0.099833414+ float_data: 0.031617507+ float_data: 0.009999833+ float_data: 0.0031622723+ float_data: -0.9999902+ float_data: -0.33057502+ float_data: 0.89120734+ float_data: 0.34087786+ float_data: 0.1097783+ float_data: 0.03477804+ float_data: 0.010999778+ float_data: 0.0034784984+ float_data: -0.53657293+ float_data: -0.60768354+ float_data: 0.9320391+ float_data: 0.3704313+ float_data: 0.119712204+ float_data: 0.037938226+ float_data: 0.011999712+ float_data: 0.0037947241+ float_data: 0.42016703+ float_data: -0.82452846+ float_data: 0.9635582+ float_data: 0.39961433+ float_data: 0.12963414+ float_data: 0.041098032+ float_data: 0.012999634+ float_data: 0.0041109496+ float_data: 0.9906074+ float_data: -0.95960534+ float_data: 0.98544973+ float_data: 0.4283978+ float_data: 0.13954312+ float_data: 0.044257425+ float_data: 0.013999542+ float_data: 0.004427174+ float_data: 0.65028787+ float_data: -0.9995187+ float_data: 0.997495+ float_data: 0.45675287+ float_data: 0.14943813+ float_data: 0.047416378+ float_data: 0.014999437+ float_data: 0.0047433986+ name: "sin_cache"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 0+ name: "zero"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 1+ name: "q_rows"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 5+ name: "kv_rows"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 1+ name: "ax1"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 2+ name: "ax2"+ }+ input {+ name: "query"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 64+ }+ }+ }+ }+ }+ input {+ name: "past_key"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 8+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "past_value"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 8+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "seqlens_k"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ input {+ name: "total_sequence_length"+ type {+ tensor_type {+ elem_type: 6+ shape {+ }+ }+ }+ }+ input {+ name: "query_seqlens"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ output {+ name: "output"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+ output {+ name: "present_key"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+ output {+ name: "present_value"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+}+opset_import {+ domain: ""+ version: 17+}+opset_import {+ domain: "com.microsoft"+ version: 1+}diff --git a/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_sliding_window_cache.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_sliding_window_cache.prototxtnew file mode 100644index 00000000000..c2b1eef21c0--- /dev/null+++ b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_sliding_window_cache.prototxt@@ -0,0 +1,239 @@+ir_version: 10+graph {+ node {+ input: "query"+ input: ""+ input: ""+ input: "past_key"+ input: "past_value"+ input: "seqlens_k"+ input: "total_sequence_length"+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: "query_seqlens"+ output: "out_full"+ output: "pk_full"+ output: "pv_full"+ name: "GroupQueryAttention_0"+ op_type: "GroupQueryAttention"+ attribute {+ name: "do_rotary"+ i: 0+ type: INT+ }+ attribute {+ name: "kv_num_heads"+ i: 1+ type: INT+ }+ attribute {+ name: "local_window_size"+ i: 3+ type: INT+ }+ attribute {+ name: "num_heads"+ i: 2+ type: INT+ }+ attribute {+ name: "sliding_window_cache"+ i: 1+ type: INT+ }+ domain: "com.microsoft"+ }+ node {+ input: "out_full"+ input: "zero"+ input: "q_rows"+ input: "ax1"+ output: "output"+ op_type: "Slice"+ }+ node {+ input: "pk_full"+ input: "zero"+ input: "kv_rows"+ input: "ax2"+ output: "present_key"+ op_type: "Slice"+ }+ node {+ input: "pv_full"+ input: "zero"+ input: "kv_rows"+ input: "ax2"+ output: "present_value"+ op_type: "Slice"+ }+ name: "GroupQueryAttention_Graph"+ initializer {+ dims: 1+ data_type: 7+ int64_data: 0+ name: "zero"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 2+ name: "q_rows"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 3+ name: "kv_rows"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 1+ name: "ax1"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 2+ name: "ax2"+ }+ input {+ name: "query"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 64+ }+ }+ }+ }+ }+ input {+ name: "past_key"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "past_value"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "seqlens_k"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ input {+ name: "total_sequence_length"+ type {+ tensor_type {+ elem_type: 6+ shape {+ }+ }+ }+ }+ input {+ name: "query_seqlens"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ output {+ name: "output"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+ output {+ name: "present_key"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+ output {+ name: "present_value"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+}+opset_import {+ domain: ""+ version: 17+}+opset_import {+ domain: "com.microsoft"+ version: 1+}diff --git a/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_sliding_window_decode.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_sliding_window_decode.prototxtnew file mode 100644index 00000000000..40049937c21--- /dev/null+++ b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_sliding_window_decode.prototxt@@ -0,0 +1,428 @@+ir_version: 10+producer_name: "OpenVINO ONNX Frontend"+graph {+ node {+ input: "query"+ input: "key"+ input: "value"+ input: "past_key"+ input: "past_value"+ input: "seqlens_k"+ input: "total_sequence_length"+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: "query_seqlens"+ output: "out_full"+ output: "pk_full"+ output: "pv_full"+ op_type: "GroupQueryAttention"+ attribute {+ name: "kv_num_heads"+ i: 1+ type: INT+ }+ attribute {+ name: "local_window_size"+ i: 4+ type: INT+ }+ attribute {+ name: "num_heads"+ i: 2+ type: INT+ }+ attribute {+ name: "sliding_window_cache"+ i: 1+ type: INT+ }+ domain: "com.microsoft"+ }+ node {+ input: "query"+ output: "q_shape"+ op_type: "Shape"+ }+ node {+ input: "q_shape"+ input: "idx1"+ output: "s_len"+ op_type: "Gather"+ }+ node {+ input: "zero_i"+ input: "s_len"+ input: "one_i"+ output: "q_range"+ op_type: "Range"+ }+ node {+ input: "q_range"+ input: "ax_0_2"+ output: "q_range_3d"+ op_type: "Unsqueeze"+ }+ node {+ input: "query_seqlens"+ output: "qsl_i64"+ op_type: "Cast"+ attribute {+ name: "to"+ i: 7+ type: INT+ }+ }+ node {+ input: "qsl_i64"+ input: "ax_1_2"+ output: "qsl_3d"+ op_type: "Unsqueeze"+ }+ node {+ input: "q_range_3d"+ input: "qsl_3d"+ output: "q_mask"+ op_type: "Less"+ }+ node {+ input: "q_mask"+ input: "out_full"+ input: "zero_f"+ output: "output"+ op_type: "Where"+ }+ node {+ input: "pk_full"+ output: "pk_shape"+ op_type: "Shape"+ }+ node {+ input: "pk_shape"+ input: "idx2"+ output: "kv_len"+ op_type: "Gather"+ }+ node {+ input: "zero_i"+ input: "kv_len"+ input: "one_i"+ output: "kv_range"+ op_type: "Range"+ }+ node {+ input: "kv_range"+ input: "ax_0_1_3"+ output: "kv_range_4d"+ op_type: "Unsqueeze"+ }+ node {+ input: "kv_rows"+ input: "ax_1_2_3"+ output: "kv_rows_4d"+ op_type: "Unsqueeze"+ }+ node {+ input: "kv_range_4d"+ input: "kv_rows_4d"+ output: "kv_mask"+ op_type: "Less"+ }+ node {+ input: "kv_mask"+ input: "pk_full"+ input: "zero_f"+ output: "present_key"+ op_type: "Where"+ }+ node {+ input: "kv_mask"+ input: "pv_full"+ input: "zero_f"+ output: "present_value"+ op_type: "Where"+ }+ name: "GroupQueryAttention_Graph"+ initializer {+ data_type: 7+ int64_data: 0+ name: "zero_i"+ }+ initializer {+ data_type: 7+ int64_data: 1+ name: "one_i"+ }+ initializer {+ data_type: 7+ int64_data: 1+ name: "idx1"+ }+ initializer {+ data_type: 7+ int64_data: 2+ name: "idx2"+ }+ initializer {+ dims: 2+ data_type: 7+ int64_data: 0+ int64_data: 2+ name: "ax_0_2"+ }+ initializer {+ dims: 2+ data_type: 7+ int64_data: 1+ int64_data: 2+ name: "ax_1_2"+ }+ initializer {+ dims: 3+ data_type: 7+ int64_data: 0+ int64_data: 1+ int64_data: 3+ name: "ax_0_1_3"+ }+ initializer {+ dims: 3+ data_type: 7+ int64_data: 1+ int64_data: 2+ int64_data: 3+ name: "ax_1_2_3"+ }+ initializer {+ data_type: 1+ float_data: 0.0+ name: "zero_f"+ }+ input {+ name: "query"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_param: "sequence_length"+ }+ dim {+ dim_value: 32+ }+ }+ }+ }+ }+ input {+ name: "key"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_param: "sequence_length"+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "value"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_param: "sequence_length"+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "past_key"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "past_value"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "seqlens_k"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ input {+ name: "total_sequence_length"+ type {+ tensor_type {+ elem_type: 6+ shape {+ }+ }+ }+ }+ input {+ name: "query_seqlens"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ input {+ name: "kv_rows"+ type {+ tensor_type {+ elem_type: 7+ shape {+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ output {+ name: "output"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "ob"+ }+ dim {+ dim_param: "os"+ }+ dim {+ dim_value: 32+ }+ }+ }+ }+ }+ output {+ name: "present_key"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "kb"+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_param: "kl"+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ output {+ name: "present_value"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_param: "kb"+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_param: "kl"+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+}+opset_import {+ domain: ""+ version: 17+}+opset_import {+ domain: "com.microsoft"+ version: 1+}diff --git a/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_static_cache.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_static_cache.prototxtnew file mode 100644index 00000000000..0a8bd84d7d1--- /dev/null+++ b/src/frontends/onnx/tests/models/com.microsoft/gqa_query_seqlens_static_cache.prototxt@@ -0,0 +1,497 @@+ir_version: 10+graph {+ node {+ input: "query"+ input: ""+ input: ""+ input: "past_key"+ input: "past_value"+ input: "seqlens_k"+ input: "total_sequence_length"+ input: "cos_cache"+ input: "sin_cache"+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: ""+ input: "query_seqlens"+ output: "out_full"+ output: "pk_full"+ output: "pv_full"+ name: "GroupQueryAttention_0"+ op_type: "GroupQueryAttention"+ attribute {+ name: "do_rotary"+ i: 1+ type: INT+ }+ attribute {+ name: "kv_num_heads"+ i: 1+ type: INT+ }+ attribute {+ name: "num_heads"+ i: 2+ type: INT+ }+ domain: "com.microsoft"+ }+ node {+ input: "out_full"+ input: "zero"+ input: "q_rows"+ input: "ax1"+ output: "output"+ op_type: "Slice"+ }+ node {+ input: "pk_full"+ input: "zero"+ input: "kv_rows"+ input: "ax2"+ output: "present_key"+ op_type: "Slice"+ }+ node {+ input: "pv_full"+ input: "zero"+ input: "kv_rows"+ input: "ax2"+ output: "present_value"+ op_type: "Slice"+ }+ name: "GroupQueryAttention_Graph"+ initializer {+ dims: 16+ dims: 8+ data_type: 1+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 1.0+ float_data: 0.5403023+ float_data: 0.95041525+ float_data: 0.9950042+ float_data: 0.99950004+ float_data: 0.99995+ float_data: 0.999995+ float_data: 0.9999995+ float_data: 0.99999994+ float_data: -0.41614684+ float_data: 0.8065784+ float_data: 0.9800666+ float_data: 0.9980007+ float_data: 0.9998+ float_data: 0.99998+ float_data: 0.999998+ float_data: 0.9999998+ float_data: -0.9899925+ float_data: 0.5827536+ float_data: 0.9553365+ float_data: 0.99550337+ float_data: 0.99955004+ float_data: 0.999955+ float_data: 0.9999955+ float_data: 0.9999995+ float_data: -0.6536436+ float_data: 0.30113748+ float_data: 0.921061+ float_data: 0.99201065+ float_data: 0.9992001+ float_data: 0.99992+ float_data: 0.999992+ float_data: 0.9999992+ float_data: 0.2836622+ float_data: -0.010342319+ float_data: 0.87758255+ float_data: 0.987526+ float_data: 0.99875027+ float_data: 0.999875+ float_data: 0.9999875+ float_data: 0.99999875+ float_data: 0.96017027+ float_data: -0.32079646+ float_data: 0.8253356+ float_data: 0.98205394+ float_data: 0.99820054+ float_data: 0.99982+ float_data: 0.999982+ float_data: 0.9999982+ float_data: 0.75390226+ float_data: -0.5994374+ float_data: 0.7648422+ float_data: 0.9755999+ float_data: 0.997551+ float_data: 0.999755+ float_data: 0.9999755+ float_data: 0.99999756+ float_data: -0.14550003+ float_data: -0.8186325+ float_data: 0.6967067+ float_data: 0.9681703+ float_data: 0.99680173+ float_data: 0.99968004+ float_data: 0.999968+ float_data: 0.9999968+ float_data: -0.91113025+ float_data: -0.9566442+ float_data: 0.62161+ float_data: 0.95977265+ float_data: 0.9959527+ float_data: 0.99959505+ float_data: 0.9999595+ float_data: 0.99999595+ float_data: -0.8390715+ float_data: -0.9997861+ float_data: 0.5403023+ float_data: 0.95041525+ float_data: 0.9950042+ float_data: 0.99950004+ float_data: 0.99995+ float_data: 0.999995+ float_data: 0.004425698+ float_data: -0.9437797+ float_data: 0.45359612+ float_data: 0.9401076+ float_data: 0.9939561+ float_data: 0.9993951+ float_data: 0.9999395+ float_data: 0.9999939+ float_data: 0.84385395+ float_data: -0.79417926+ float_data: 0.36235777+ float_data: 0.9288599+ float_data: 0.99280864+ float_data: 0.9992801+ float_data: 0.999928+ float_data: 0.9999928+ float_data: 0.9074468+ float_data: -0.5658205+ float_data: 0.26749882+ float_data: 0.9166834+ float_data: 0.9915619+ float_data: 0.9991551+ float_data: 0.9999155+ float_data: 0.99999154+ float_data: 0.13673721+ float_data: -0.28134963+ float_data: 0.16996714+ float_data: 0.90359026+ float_data: 0.990216+ float_data: 0.99902016+ float_data: 0.999902+ float_data: 0.9999902+ float_data: -0.7596879+ float_data: 0.031022532+ float_data: 0.0707372+ float_data: 0.8895936+ float_data: 0.9887711+ float_data: 0.9988752+ float_data: 0.9998875+ float_data: 0.99998873+ name: "cos_cache"+ }+ initializer {+ dims: 16+ dims: 8+ data_type: 1+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.0+ float_data: 0.84147096+ float_data: 0.3109836+ float_data: 0.099833414+ float_data: 0.031617507+ float_data: 0.009999833+ float_data: 0.0031622723+ float_data: 0.0009999998+ float_data: 0.00031622776+ float_data: 0.9092974+ float_data: 0.5911271+ float_data: 0.19866933+ float_data: 0.063203394+ float_data: 0.019998666+ float_data: 0.0063245133+ float_data: 0.0019999987+ float_data: 0.0006324555+ float_data: 0.14112+ float_data: 0.8126489+ float_data: 0.29552022+ float_data: 0.09472609+ float_data: 0.029995501+ float_data: 0.009486691+ float_data: 0.0029999956+ float_data: 0.0009486832+ float_data: -0.7568025+ float_data: 0.95358074+ float_data: 0.38941833+ float_data: 0.12615407+ float_data: 0.039989334+ float_data: 0.012648773+ float_data: 0.0039999895+ float_data: 0.0012649107+ float_data: -0.9589243+ float_data: 0.99994653+ float_data: 0.47942555+ float_data: 0.15745589+ float_data: 0.04997917+ float_data: 0.01581073+ float_data: 0.0049999794+ float_data: 0.0015811381+ float_data: -0.2794155+ float_data: 0.94714814+ float_data: 0.5646425+ float_data: 0.18860029+ float_data: 0.059964005+ float_data: 0.018972527+ float_data: 0.005999964+ float_data: 0.0018973654+ float_data: 0.6569866+ float_data: 0.80042166+ float_data: 0.64421767+ float_data: 0.2195561+ float_data: 0.06994285+ float_data: 0.022134136+ float_data: 0.006999943+ float_data: 0.0022135926+ float_data: 0.98935825+ float_data: 0.57431775+ float_data: 0.7173561+ float_data: 0.25029236+ float_data: 0.0799147+ float_data: 0.025295522+ float_data: 0.007999915+ float_data: 0.0025298195+ float_data: 0.4121185+ float_data: 0.2912591+ float_data: 0.7833269+ float_data: 0.28077835+ float_data: 0.08987855+ float_data: 0.028456656+ float_data: 0.008999879+ float_data: 0.0028460461+ float_data: -0.5440211+ float_data: -0.02068353+ float_data: 0.84147096+ float_data: 0.3109836+ float_data: 0.099833414+ float_data: 0.031617507+ float_data: 0.009999833+ float_data: 0.0031622723+ float_data: -0.9999902+ float_data: -0.33057502+ float_data: 0.89120734+ float_data: 0.34087786+ float_data: 0.1097783+ float_data: 0.03477804+ float_data: 0.010999778+ float_data: 0.0034784984+ float_data: -0.53657293+ float_data: -0.60768354+ float_data: 0.9320391+ float_data: 0.3704313+ float_data: 0.119712204+ float_data: 0.037938226+ float_data: 0.011999712+ float_data: 0.0037947241+ float_data: 0.42016703+ float_data: -0.82452846+ float_data: 0.9635582+ float_data: 0.39961433+ float_data: 0.12963414+ float_data: 0.041098032+ float_data: 0.012999634+ float_data: 0.0041109496+ float_data: 0.9906074+ float_data: -0.95960534+ float_data: 0.98544973+ float_data: 0.4283978+ float_data: 0.13954312+ float_data: 0.044257425+ float_data: 0.013999542+ float_data: 0.004427174+ float_data: 0.65028787+ float_data: -0.9995187+ float_data: 0.997495+ float_data: 0.45675287+ float_data: 0.14943813+ float_data: 0.047416378+ float_data: 0.014999437+ float_data: 0.0047433986+ name: "sin_cache"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 0+ name: "zero"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 2+ name: "q_rows"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 5+ name: "kv_rows"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 1+ name: "ax1"+ }+ initializer {+ dims: 1+ data_type: 7+ int64_data: 2+ name: "ax2"+ }+ input {+ name: "query"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 4+ }+ dim {+ dim_value: 64+ }+ }+ }+ }+ }+ input {+ name: "past_key"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 8+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "past_value"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 1+ }+ dim {+ dim_value: 8+ }+ dim {+ dim_value: 16+ }+ }+ }+ }+ }+ input {+ name: "seqlens_k"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ input {+ name: "total_sequence_length"+ type {+ tensor_type {+ elem_type: 6+ shape {+ }+ }+ }+ }+ input {+ name: "query_seqlens"+ type {+ tensor_type {+ elem_type: 6+ shape {+ dim {+ dim_value: 1+ }+ }+ }+ }+ }+ output {+ name: "output"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+ output {+ name: "present_key"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+ output {+ name: "present_value"+ type {+ tensor_type {+ elem_type: 1+ }+ }+ }+}+opset_import {+ domain: ""+ version: 17+}+opset_import {+ domain: "com.microsoft"+ version: 1+}diff --git a/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp b/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cppindex 87e8ba61bb8..ed408b7142a 100644--- a/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp+++ b/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp@@ -3,6 +3,7 @@//#include <cmath>+#include <limits>#include <vector>// clang-format off@@ -5691,9 +5692,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_insufficient_inputs_throws) {convert_model("com.microsoft/gqa_oob.onnx");FAIL() << "ONNX Importer did not detect insufficient inputs for GroupQueryAttention";} catch (const ::ov::frontend::OpConversionFailure& e) {- EXPECT_THAT(e.what(), testing::AllOf(testing::HasSubstr("expected"), testing::HasSubstr(" 7 to 16 inputs")));+ EXPECT_THAT(e.what(), testing::AllOf(testing::HasSubstr("expected"), testing::HasSubstr(" 7 to 17 inputs")));} catch (const std::exception& e) {- EXPECT_THAT(e.what(), testing::AllOf(testing::HasSubstr("expected"), testing::HasSubstr(" 7 to 16 inputs")));+ EXPECT_THAT(e.what(), testing::AllOf(testing::HasSubstr("expected"), testing::HasSubstr(" 7 to 17 inputs")));} catch (...) {FAIL() << "Unexpected exception type thrown";}@@ -8810,3 +8811,1293 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_com_microsoft_gather_block_quantized_quantiz// valid when the quantized axis is last, so importing a non-last quantize_axis is disallowed.EXPECT_THROW(convert_model("com.microsoft/gather_block_quantized_quantize_axis_not_last.onnx"), ov::Exception);}++// query_seqlens (input 16): a right-padded chunk of S = 4 rows with Q = 2 valid rows after P = 3 past tokens.+// Padded output rows and cache rows at or beyond the valid length are unspecified, so the models slice them off.+// Expected values are from ONNX Runtime's CPU kernel.+// Static-capacity cache, implicit rotary positions (padded rows use position 0).+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_query_seqlens_static_cache) {+ const auto model = convert_model("com.microsoft/gqa_query_seqlens_static_cache.onnx");+ auto test_case = ov::test::TestCase(model, s_device);+ test_case.add_input<float>(+ Shape{1, 4, 64},+ {0.001230f, 0.298746f, -0.274138f, -0.890592f, -0.454671f, -0.991647f, 0.060144f, 1.340215f, -0.492207f,+ -0.620475f, 0.489842f, 0.356887f, 0.105414f, -0.930468f, -0.029252f, 0.695303f, -1.344215f, -0.457616f,+ -1.901223f, -1.289538f, -1.841735f, -0.235091f, -1.267447f, 0.271264f, 0.156751f, -0.186931f, -2.516760f,+ -0.538693f, -0.048501f, 0.113309f, -1.530136f, -0.477753f, -0.978519f, -0.808837f, 1.060899f, -0.807535f,+ -0.032522f, 0.884390f, -0.583600f, -0.111702f, 0.110464f, 0.063782f, -1.225056f, 0.076140f, 1.358823f,+ -1.547145f, 0.859383f, 0.119354f, -0.641470f, 2.000417f, 0.762260f, -1.199289f, 0.074516f, 0.576690f,+ -0.188782f, 0.682910f, -0.066517f, 0.667248f, 1.438523f, -0.675662f, 0.203139f, -0.463308f, 0.127268f,+ -1.187195f, -0.579302f, -0.196196f, 0.898764f, 1.145222f, -1.323528f, -0.794642f, 0.646903f, -1.992420f,+ -0.463170f, -0.097287f, 1.257015f, 0.689404f, -0.327213f, -0.368576f, -0.250195f, 1.523529f, -0.428025f,+ -0.303680f, 0.352589f, -0.120770f, -0.197284f, -1.114067f, -0.011521f, -0.443581f, 1.166128f, 0.653089f,+ -0.024144f, 0.668381f, -0.339870f, 1.052126f, -0.005400f, 0.583382f, -1.290893f, 0.346680f, -1.688204f,+ -2.035329f, -0.304477f, -0.899928f, 0.164053f, 2.244757f, -0.831723f, -0.623944f, 0.205404f, 0.493013f,+ -0.176406f, -0.205930f, 0.702463f, 0.519908f, -1.033676f, -0.079181f, 0.035287f, -1.054485f, 0.259839f,+ -0.857956f, 0.972067f, 0.192746f, 0.089306f, -0.591028f, -0.118610f, -1.997746f, -1.131407f, 0.362840f,+ -2.128567f, 0.846609f, -1.746096f, 0.756738f, -0.845497f, 0.778991f, 0.130951f, -1.536835f, 1.249149f,+ 1.441707f, -0.065805f, -0.273916f, -0.159867f, -0.975152f, 1.098587f, -0.542892f, -0.051190f, -0.793296f,+ -0.626073f, -1.277725f, 1.257069f, -0.154088f, 0.965922f, 0.013325f, -0.694404f, -0.326685f, -0.560231f,+ 0.007959f, -0.375267f, -0.299922f, -1.378575f, -0.806846f, 1.654058f, -0.671233f, -1.054094f, 0.337326f,+ 1.407272f, -1.454024f, -0.208522f, -0.632053f, -1.761019f, 0.734927f, -0.023444f, 0.071442f, -0.752311f,+ 0.454784f, -0.539297f, -0.142903f, -1.108261f, -1.216103f, 1.335532f, -0.507105f, 0.291680f, -0.033790f,+ -0.441145f, -0.507961f, 0.630083f, -0.301868f, -0.151444f, 0.022222f, 1.176508f, 0.680511f, 0.382600f,+ -0.563571f, -1.381969f, 0.949530f, 0.966447f, -0.140708f, 0.541884f, 0.781443f, 0.831184f, 0.921384f,+ -0.455618f, 1.514973f, -1.246593f, 0.861723f, 0.493932f, 0.873619f, 1.879008f, 1.484445f, -1.145177f,+ -1.688672f, 0.816889f, -1.015012f, -0.012405f, 0.839727f, -1.643797f, -2.109980f, 0.259299f, 0.044386f,+ -0.245803f, 0.038535f, -0.860516f, -1.513494f, -0.166655f, -0.971709f, -1.643481f, 0.505681f, -0.061399f,+ 0.406529f, -0.989295f, -0.658059f, -0.999043f, -0.886642f, 0.195408f, -0.782975f, 0.356066f, 0.339756f,+ 2.025161f, -1.392789f, 0.887902f, -0.089488f, -0.014030f, -1.449864f, -0.460194f, 0.743197f, -0.082478f,+ 0.081054f, -0.290717f, 1.154570f, -0.021473f, -2.200416f, -0.692073f, -1.968797f, -3.251438f, -0.530115f,+ 1.333560f, 0.047120f, -1.172546f, -0.940700f});+ test_case.add_input<float>(+ Shape{1, 1, 8, 16},+ {1.130613f, 0.157627f, 0.047999f, -0.053462f, 0.038400f, 0.805406f, 0.552567f, 0.215705f, -1.042868f,+ 0.511109f, -0.684247f, 1.093846f, -1.271051f, -0.137621f, -0.007358f, -1.324646f, 1.721972f, 1.460407f,+ -0.463584f, 0.771721f, 0.378676f, -2.613559f, 0.250398f, -0.061344f, 0.083217f, -1.076875f, -0.269347f,+ -0.178259f, 1.188094f, 0.334427f, -0.005555f, 1.528970f, -0.555248f, -0.389430f, -1.816755f, 1.569106f,+ 0.964332f, 0.916848f, 0.668898f, 0.110149f, 0.215489f, -0.252007f, -0.203600f, 0.054304f, 1.511829f,+ 0.555688f, -0.058460f, -0.579392f, -0.634999f, 1.602705f, 0.506687f, 0.067551f, -0.346182f, -1.109053f,+ -0.066862f, 0.873658f, -0.392537f, -0.227243f, -0.221034f, 0.109594f, -1.593011f, -0.235398f, -0.854396f,+ 0.884585f, -0.770599f, 0.577047f, 1.524437f, -0.313596f, -0.601576f, 0.191432f, -0.002029f, -0.993616f,+ 0.460919f, 2.015516f, -0.258112f, -0.202876f, -1.044932f, 0.319088f, -1.246976f, -1.106931f, 1.279667f,+ -0.905453f, 1.081358f, 1.524358f, 0.259326f, 0.553391f, 1.952251f, -0.196728f, -0.593006f, -1.353231f,+ 0.041707f, 1.479144f, 0.959595f, -0.942091f, -0.855375f, -0.504171f, 0.292268f, -0.205311f, 0.214454f,+ 0.296739f, -0.298774f, -0.040174f, 0.206592f, -0.083970f, 0.503521f, 1.870876f, 0.591972f, 0.055811f,+ -1.686119f, 0.387957f, -1.946678f, -1.409034f, 0.854639f, 0.706235f, -0.149939f, -1.710011f, -0.371349f,+ -0.678738f, 0.636841f, 2.257730f, 0.216930f, -0.779311f, -1.170552f, -0.056094f, -0.176793f, -1.151519f,+ 0.116355f, -1.150913f});+ test_case.add_input<float>(+ Shape{1, 1, 8, 16},+ {1.112107f, 1.062651f, 1.084751f, -0.474050f, 0.514521f, -0.132069f, -0.388812f, -0.339146f, -1.299715f,+ -1.443864f, 0.794315f, -0.191235f, 0.216425f, 1.001710f, -1.733132f, -0.784130f, 0.175335f, 0.392095f,+ -0.377074f, 1.029179f, 0.210395f, -1.213382f, -0.930764f, 0.805471f, 0.463831f, -1.899061f, 1.347712f,+ 0.598027f, 1.343343f, -0.383701f, -0.295706f, -1.126457f, 2.536930f, -0.175454f, 1.587533f, -0.647292f,+ 0.163841f, -1.671353f, -0.382867f, 0.983755f, -1.251744f, 1.072228f, 0.337238f, -1.043951f, -0.501597f,+ -0.459066f, -0.049519f, -0.536144f, -0.827288f, -0.304588f, -1.026890f, -1.289527f, -0.048176f, 0.882874f,+ -1.529372f, 0.003508f, -0.649956f, -0.977145f, 0.853438f, -0.518170f, 1.498302f, -0.779839f, 0.386502f,+ -0.227283f, -0.754022f, 0.587675f, -0.154983f, 0.603211f, -0.047292f, -1.085816f, -0.102069f, 0.051955f,+ 0.958463f, -0.906269f, -0.039330f, -1.721879f, 0.651493f, -1.081483f, -1.806360f, -0.059217f, 1.105685f,+ -1.524447f, -1.088036f, -0.743275f, -1.129497f, 0.379428f, -0.807367f, -0.721515f, 0.583305f, -0.755515f,+ 0.432780f, -0.971385f, -1.212139f, -1.835449f, 1.861203f, -0.320259f, 0.243933f, -0.031050f, 0.159962f,+ 0.049686f, 1.908217f, -1.038927f, -1.557462f, -1.011960f, -1.334709f, 0.746962f, 0.820378f, -0.961316f,+ -1.390436f, -0.354797f, 1.391124f, -2.819569f, 0.526627f, -1.075755f, 1.040367f, -1.077924f, -0.285416f,+ -1.506279f, -0.977258f, 1.385839f, 0.820579f, -0.401668f, -0.870172f, -1.893807f, -0.393657f, -0.030903f,+ -0.084054f, -0.093792f});+ test_case.add_input<int>(Shape{1}, {4});+ test_case.add_input<int>(Shape{}, {8});+ test_case.add_input<int>(Shape{1}, {2});+ test_case.add_expected_output<float>(+ Shape{1, 2, 32},+ {0.369150f, 0.774297f, 0.271889f, 0.168082f, 0.217853f, -0.724242f, -0.639433f, 0.640326f,+ -0.068942f, -0.975471f, 1.187809f, 0.045251f, 0.752379f, -0.218800f, -0.375785f, -1.032099f,+ 0.422567f, 1.085695f, 0.643532f, -0.333664f, 0.262324f, -0.316173f, -0.464252f, 0.404517f,+ -0.436841f, -0.659428f, 1.107763f, -0.217022f, 0.442986f, 0.039750f, -0.610048f, -0.982513f,+ 0.362801f, 0.546609f, 0.154127f, 0.286173f, 0.221618f, -0.929029f, -0.598242f, 0.660253f,+ 0.006641f, -1.118871f, 1.087424f, 0.004597f, 0.717687f, -0.217921f, -0.480313f, -0.897424f,+ 0.271508f, 0.627111f, 0.261482f, 0.040761f, 0.254372f, -0.757220f, -0.434565f, 0.500512f,+ -0.128949f, -1.071932f, 0.980759f, -0.191822f, 0.506025f, -0.033058f, -0.741793f, -0.761786f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 5, 16},+ {1.130613f, 0.157627f, 0.047999f, -0.053462f, 0.038400f, 0.805406f, 0.552567f, 0.215705f, -1.042868f,+ 0.511109f, -0.684247f, 1.093846f, -1.271051f, -0.137621f, -0.007358f, -1.324646f, 1.721972f, 1.460407f,+ -0.463584f, 0.771721f, 0.378676f, -2.613559f, 0.250398f, -0.061344f, 0.083217f, -1.076875f, -0.269347f,+ -0.178259f, 1.188094f, 0.334427f, -0.005555f, 1.528970f, -0.555248f, -0.389430f, -1.816755f, 1.569106f,+ 0.964332f, 0.916848f, 0.668898f, 0.110149f, 0.215489f, -0.252007f, -0.203600f, 0.054304f, 1.511829f,+ 0.555688f, -0.058460f, -0.579392f, 0.953138f, -0.523185f, 1.375544f, -0.811116f, -0.073266f, 0.899027f,+ -0.586176f, -0.111815f, -0.247447f, -0.620132f, -0.856824f, -0.000697f, 1.357237f, -1.538685f, 0.857628f,+ 0.119248f, 0.214334f, 0.699379f, -1.634927f, -2.081264f, -0.297179f, -0.897251f, 0.161242f, 2.244097f,+ 1.520602f, 0.142695f, -0.468228f, 0.232309f, -0.188441f, -0.217297f, 0.703114f, 0.522747f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 5, 16},+ {1.112107f, 1.062651f, 1.084751f, -0.474050f, 0.514521f, -0.132069f, -0.388812f, -0.339146f, -1.299715f,+ -1.443864f, 0.794315f, -0.191235f, 0.216425f, 1.001710f, -1.733132f, -0.784130f, 0.175335f, 0.392095f,+ -0.377074f, 1.029179f, 0.210395f, -1.213382f, -0.930764f, 0.805471f, 0.463831f, -1.899061f, 1.347712f,+ 0.598027f, 1.343343f, -0.383701f, -0.295706f, -1.126457f, 2.536930f, -0.175454f, 1.587533f, -0.647292f,+ 0.163841f, -1.671353f, -0.382867f, 0.983755f, -1.251744f, 1.072228f, 0.337238f, -1.043951f, -0.501597f,+ -0.459066f, -0.049519f, -0.536144f, -0.641470f, 2.000417f, 0.762260f, -1.199289f, 0.074516f, 0.576690f,+ -0.188782f, 0.682910f, -0.066517f, 0.667248f, 1.438523f, -0.675662f, 0.203139f, -0.463308f, 0.127268f,+ -1.187195f, -1.033676f, -0.079181f, 0.035287f, -1.054485f, 0.259839f, -0.857956f, 0.972067f, 0.192746f,+ 0.089306f, -0.591028f, -0.118610f, -1.997746f, -1.131407f, 0.362840f, -2.128567f, 0.846609f});+ test_case.run_with_tolerance_as_fp();+}++// Growing cache whose past buffer is longer than the valid past (batched path).+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_query_seqlens_growing_cache) {+ const auto model = convert_model("com.microsoft/gqa_query_seqlens_growing_cache.onnx");+ auto test_case = ov::test::TestCase(model, s_device);+ test_case.add_input<float>(+ Shape{1, 4, 64},+ {-1.121810f, -0.066274f, -0.038673f, 1.290562f, 1.866733f, -0.136989f, -0.766306f, -0.064982f, -0.607621f,+ -0.742434f, -0.058650f, -1.043304f, 0.606107f, -0.103916f, 0.250008f, -0.182940f, -0.727254f, -0.947960f,+ -0.237276f, -0.548760f, 0.233901f, -0.004432f, -1.362307f, 0.067121f, -1.342860f, -0.616478f, -0.294354f,+ -2.075273f, 0.091507f, 0.150983f, -0.158024f, -0.424317f, -0.373604f, -0.976539f, -0.269700f, -0.552612f,+ 0.091685f, -1.204136f, 0.235590f, 0.143219f, -0.141563f, -0.439205f, 0.552340f, -1.664602f, 0.460453f,+ 0.243037f, 0.283376f, 0.383313f, -0.653644f, -0.259460f, 0.637058f, 0.430639f, 0.206713f, -1.514320f,+ 0.537887f, 1.169471f, 1.009671f, 0.233878f, -1.557679f, 0.942545f, -0.147255f, -2.532520f, 0.377207f,+ -1.492172f, -1.296441f, -0.634959f, 1.272591f, -0.370845f, 0.270992f, 1.747968f, 1.594030f, -0.103353f,+ -0.241521f, -1.260871f, -0.694458f, 0.425358f, 0.395731f, 0.110238f, 0.994802f, -0.772368f, -0.056077f,+ 0.731243f, 0.584146f, 1.070946f, 0.397020f, -0.309403f, 0.362192f, -1.002595f, -1.639459f, 0.580672f,+ -0.055140f, 0.308410f, -1.697684f, -0.365114f, -0.599857f, -0.864212f, -2.255015f, -0.334873f, 0.897304f,+ 0.380998f, -0.600947f, -0.014876f, 0.756800f, -2.760418f, -0.124537f, 0.543200f, 0.682129f, 1.700730f,+ 1.135046f, 0.312563f, 0.301976f, 0.786945f, -0.539327f, -0.040188f, 0.906239f, 1.957445f, -0.159267f,+ -0.048401f, 0.198480f, 1.343204f, -0.030313f, 1.469359f, -0.966657f, -0.186036f, -0.198165f, 0.786506f,+ 1.045260f, -1.509444f, -0.915118f, 0.336852f, -0.658694f, -1.522428f, 1.038480f, 0.493970f, 0.493178f,+ -0.475446f, 1.028938f, -0.239960f, 1.096435f, -0.911665f, -0.854135f, 0.204663f, -0.702332f, 0.675451f,+ 0.260088f, -0.922971f, 0.072866f, -0.351278f, 0.915833f, -0.632553f, -0.439173f, 1.211237f, 2.238593f,+ 1.999009f, 0.063223f, 0.218855f, 1.533459f, -0.124435f, -0.976349f, 0.116876f, 0.451517f, -0.829150f,+ -1.646231f, -1.436730f, 0.665429f, -0.758377f, -0.141347f, 0.212559f, 0.619141f, -0.334903f, 0.498716f,+ -0.890060f, -0.361714f, -1.024416f, 1.131767f, -0.027083f, -0.739307f, -0.352372f, -0.221728f, 0.700520f,+ -1.595636f, -1.037206f, -0.378107f, 2.532306f, 0.955679f, -0.111452f, 0.712000f, 2.057436f, -0.233744f,+ -0.366413f, 1.211944f, 0.494175f, 0.671333f, -0.508222f, 1.924203f, 1.709591f, 0.565948f, 0.684290f,+ -2.027261f, 0.637710f, -0.194109f, 0.433906f, 0.682459f, -0.341292f, -1.690482f, 0.367875f, -0.741384f,+ -0.330194f, -0.604510f, -0.341574f, -2.309521f, 1.216947f, 0.253346f, 1.111399f, 1.979842f, 0.022593f,+ -1.802436f, -0.893887f, -1.206905f, -0.501875f, 0.079648f, -2.002187f, 0.342476f, -1.510357f, 0.297365f,+ -0.109491f, -0.313631f, -0.073043f, -0.539778f, -0.612471f, -1.682756f, -0.029627f, 1.845534f, 1.980495f,+ 1.321818f, 0.705802f, -0.676480f, 1.442751f, -0.056128f, -0.068876f, -0.291227f, 0.091962f, -0.435215f,+ -0.083782f, -1.084599f, -0.373664f, 2.280556f, -0.069594f, -0.238661f, 0.532374f, 0.708122f, -1.113769f,+ -0.207159f, 0.918276f, 0.269838f, 0.121954f});+ test_case.add_input<float>(+ Shape{1, 1, 5, 16},+ {1.554018f, -0.677773f, 0.082746f, -0.520059f, 1.490308f, -1.951860f, -0.670142f, -0.529157f, 0.663540f,+ 0.606275f, 1.395194f, -1.574033f, 0.750475f, -0.293280f, -0.665625f, 0.539569f, -0.920140f, -2.076913f,+ -0.370218f, -1.497771f, -0.648916f, 0.371555f, 0.312000f, 1.586899f, -0.199655f, -1.533332f, -0.756097f,+ -0.919384f, -1.217825f, 0.435367f, -0.645232f, -1.977373f, 0.696923f, -0.111427f, 0.356837f, 0.105722f,+ 0.631655f, 0.038019f, 1.236202f, 0.424983f, 0.392068f, 0.409867f, -1.456638f, -0.164636f, -0.259317f,+ 0.207547f, -1.358694f, 1.634115f, 0.104389f, -1.211318f, -1.708887f, -0.281287f, -0.089675f, -0.718292f,+ 0.092114f, -0.641176f, 0.551658f, -0.724542f, -0.038500f, 0.978839f, 2.571669f, -1.007643f, -0.464508f,+ -0.839836f, 0.784328f, -1.148099f, -0.484357f, -0.029601f, -0.978679f, -0.957325f, -0.475623f, -2.100440f,+ -1.445478f, -0.413034f, 0.148231f, -0.185760f, -1.773969f, -0.463786f, 0.798438f, 0.555866f});+ test_case.add_input<float>(+ Shape{1, 1, 5, 16},+ {-0.078748f, -0.887370f, 0.631216f, -0.578929f, -1.169248f, -0.802186f, 1.448345f, 0.220180f, 1.159247f,+ -0.479336f, 0.938149f, -0.601504f, -0.157427f, 2.486350f, 0.767149f, -0.501170f, -0.084819f, 0.326223f,+ 1.210458f, -0.489133f, -1.741319f, -0.279642f, 0.015385f, 0.109538f, 1.316690f, 0.316687f, 0.812917f,+ -1.101114f, 0.867902f, 2.096220f, 0.772909f, 0.253556f, 0.153988f, 1.787142f, -0.927181f, -0.111102f,+ 0.460208f, 0.744001f, -0.437328f, 0.307321f, -0.277921f, 0.120471f, -0.132092f, -1.141594f, -0.021114f,+ 0.877152f, -0.967018f, -0.241092f, 0.664780f, -1.069865f, 0.182638f, -1.060130f, 1.134630f, 2.312821f,+ 2.022255f, -0.219181f, 0.740199f, 0.120998f, 0.102106f, 1.547757f, -1.319180f, 1.055295f, -0.048976f,+ 1.408541f, 0.187233f, -0.672672f, 0.277140f, 0.735967f, 0.035764f, 0.488038f, -0.521675f, -2.133884f,+ 0.900024f, 0.699160f, 0.148178f, 0.068411f, 1.036296f, -0.457107f, -0.706534f, -0.188550f});+ test_case.add_input<int>(Shape{1}, {4});+ test_case.add_input<int>(Shape{}, {7});+ test_case.add_input<int>(Shape{1}, {2});+ test_case.add_expected_output<float>(+ Shape{1, 2, 32},+ {-0.178732f, -0.297319f, 0.422433f, -0.269993f, -0.626637f, -0.719076f, 0.901388f, 0.450894f,+ 0.916384f, -0.193607f, 0.190867f, -0.339633f, -0.096398f, 1.059231f, 0.418243f, -0.665876f,+ -0.237471f, -0.193914f, 0.650993f, -0.212608f, -0.760048f, -0.772600f, 0.677371f, 0.489993f,+ 1.039287f, -0.022730f, 0.062632f, -0.293056f, 0.103740f, 0.734824f, 0.514026f, -0.601162f,+ -0.351924f, 0.255150f, 0.602023f, 1.004309f, -0.281695f, -0.132022f, 0.157811f, 0.931908f,+ 0.274035f, 0.871087f, -0.557105f, -0.374733f, -0.014513f, 0.718059f, 0.590605f, -1.007496f,+ -0.229404f, 0.266082f, 0.513777f, 0.446859f, -0.500134f, -0.181140f, 0.260673f, 0.660372f,+ 0.490630f, 0.509133f, -0.147213f, -0.554391f, 0.077510f, 1.078335f, 0.457093f, -0.697130f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 5, 16},+ {1.554018f, -0.677773f, 0.082746f, -0.520059f, 1.490308f, -1.951860f, -0.670142f, -0.529157f, 0.663540f,+ 0.606275f, 1.395194f, -1.574033f, 0.750475f, -0.293280f, -0.665625f, 0.539569f, -0.920140f, -2.076913f,+ -0.370218f, -1.497771f, -0.648916f, 0.371555f, 0.312000f, 1.586899f, -0.199655f, -1.533332f, -0.756097f,+ -0.919384f, -1.217825f, 0.435367f, -0.645232f, -1.977373f, 0.696923f, -0.111427f, 0.356837f, 0.105722f,+ 0.631655f, 0.038019f, 1.236202f, 0.424983f, 0.392068f, 0.409867f, -1.456638f, -0.164636f, -0.259317f,+ 0.207547f, -1.358694f, 1.634115f, 0.389842f, -0.212163f, -0.420882f, -0.392446f, 0.077833f, -1.206388f,+ 0.234739f, 0.142855f, 0.087423f, -1.049532f, 0.447969f, -1.709463f, 0.462996f, 0.231603f, 0.284082f,+ 0.383448f, 1.379727f, -0.618828f, 0.560839f, 0.163400f, -0.645856f, -0.018828f, 0.755586f, -2.761411f,+ 1.788003f, -0.155751f, 0.977709f, 1.735207f, 1.110106f, 0.312350f, 0.305001f, 0.783453f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 5, 16},+ {-0.078748f, -0.887370f, 0.631216f, -0.578929f, -1.169248f, -0.802186f, 1.448345f, 0.220180f, 1.159247f,+ -0.479336f, 0.938149f, -0.601504f, -0.157427f, 2.486350f, 0.767149f, -0.501170f, -0.084819f, 0.326223f,+ 1.210458f, -0.489133f, -1.741319f, -0.279642f, 0.015385f, 0.109538f, 1.316690f, 0.316687f, 0.812917f,+ -1.101114f, 0.867902f, 2.096220f, 0.772909f, 0.253556f, 0.153988f, 1.787142f, -0.927181f, -0.111102f,+ 0.460208f, 0.744001f, -0.437328f, 0.307321f, -0.277921f, 0.120471f, -0.132092f, -1.141594f, -0.021114f,+ 0.877152f, -0.967018f, -0.241092f, -0.653644f, -0.259460f, 0.637058f, 0.430639f, 0.206713f, -1.514320f,+ 0.537887f, 1.169471f, 1.009671f, 0.233878f, -1.557679f, 0.942545f, -0.147255f, -2.532520f, 0.377207f,+ -1.492172f, -0.539327f, -0.040188f, 0.906239f, 1.957445f, -0.159267f, -0.048401f, 0.198480f, 1.343204f,+ -0.030313f, 1.469359f, -0.966657f, -0.186036f, -0.198165f, 0.786506f, 1.045260f, -1.509444f});+ test_case.run_with_tolerance_as_fp();+}++// Windowed cache (staging) that evicts while appending a padded chunk.+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_query_seqlens_sliding_window_cache) {+ const auto model = convert_model("com.microsoft/gqa_query_seqlens_sliding_window_cache.onnx");+ auto test_case = ov::test::TestCase(model, s_device);+ test_case.add_input<float>(+ Shape{1, 4, 64},+ {1.189097f, -1.387113f, 1.191830f, -0.639253f, -1.100744f, 1.260062f, -0.096890f, -1.300234f, -0.358733f,+ 0.931052f, 1.192074f, -0.427099f, 0.406321f, 0.714085f, -0.644626f, 0.355036f, -0.031878f, -0.536024f,+ -0.492148f, 0.067034f, 0.029853f, -0.565490f, -0.425945f, 1.113337f, 0.213827f, 0.885094f, 1.201822f,+ 0.588842f, 2.270886f, -0.825304f, 0.808410f, -0.318144f, 1.855783f, 1.700440f, -1.954211f, -0.968866f,+ 0.664313f, 0.789867f, 0.736564f, -0.070865f, 0.455121f, 0.653021f, -0.077871f, 1.027302f, -2.259497f,+ 0.633794f, -1.034053f, 0.958678f, -0.228684f, -0.888787f, 0.373902f, -0.911334f, -0.912768f, -1.567294f,+ -0.026708f, 0.496824f, 1.023026f, -0.141728f, 1.047855f, 0.017961f, -0.093288f, 0.573563f, 1.058393f,+ -0.341434f, -0.243762f, -0.160831f, 0.082769f, -0.900408f, 1.028006f, -0.400410f, 0.462443f, -0.825473f,+ 0.358804f, 0.391593f, -0.420681f, 2.020890f, 0.371040f, 1.776929f, 0.959139f, -0.662275f, -0.382187f,+ 0.436102f, 0.061173f, 0.049461f, -0.286205f, -1.808476f, -0.225433f, -2.218122f, 0.371820f, -0.726058f,+ -0.715417f, -0.219304f, 0.272672f, -1.432006f, -1.748601f, -1.066066f, -2.041728f, -0.966850f, 1.590883f,+ -1.056586f, 0.651405f, -1.371635f, 0.299120f, -0.319734f, -0.059813f, 0.568778f, 1.756240f, 0.194706f,+ 0.124359f, -0.973368f, 0.583340f, -0.246072f, 0.832007f, -0.043706f, 1.740856f, -1.982916f, -0.296599f,+ 0.881482f, -0.350692f, -0.792173f, -0.265881f, -1.379929f, 0.118954f, 2.440462f, 1.145031f, -1.109009f,+ -0.873341f, -0.404728f, 1.004416f, -0.821487f, -0.690231f, 0.884749f, 0.864653f, -0.373815f, -1.117763f,+ -1.549745f, -0.698990f, -2.230529f, 0.749820f, -0.630031f, 0.481294f, 1.868325f, 1.172996f, -1.151135f,+ 0.869249f, 1.157857f, -0.746357f, -0.953297f, -0.109692f, -1.601423f, 1.470735f, -2.405364f, -1.106807f,+ -0.269565f, -0.227087f, 0.166124f, 0.271449f, -0.213612f, 1.136886f, -2.139376f, -0.000165f, -0.714584f,+ 0.132513f, 0.220760f, -0.911829f, -0.640949f, 0.792587f, 0.349056f, -0.680248f, 2.039891f, 2.309178f,+ -1.462462f, 0.301795f, 2.508994f, 0.783899f, 0.221060f, -0.208057f, -0.541194f, -0.212515f, -0.550729f,+ 0.744908f, -0.398154f, -0.441151f, -1.202161f, -0.049590f, -0.894122f, -0.180750f, 1.041816f, 0.365925f,+ 0.504725f, 0.356091f, 0.059176f, -0.127328f, -0.307806f, 0.759117f, -1.084240f, 1.340723f, 0.034078f,+ -0.748700f, -0.489146f, -0.676990f, 0.160206f, -0.717843f, 1.142131f, -0.781639f, -2.272522f, -0.730999f,+ -2.008521f, -0.039869f, 1.059158f, 0.647760f, -1.337590f, -0.762255f, 1.778634f, 0.318511f, 0.004119f,+ 1.056063f, 2.452741f, 1.296573f, 0.139415f, 0.354688f, 0.617080f, -0.612698f, -1.058720f, 0.052449f,+ -0.947211f, -0.061462f, 0.096123f, 2.341037f, -0.851050f, -0.121789f, -0.164303f, 0.437311f, 1.046724f,+ -0.490483f, -0.821352f, -1.640711f, -0.926205f, 0.536441f, 0.045647f, -1.015434f, -0.372767f, 0.031473f,+ 0.503679f, -0.593394f, -0.250440f, -1.818435f, -1.151386f, 1.617716f, -2.188141f, -0.337803f, 0.219198f,+ -0.374349f, -0.808158f, -0.061079f, -0.004965f});+ test_case.add_input<float>(+ Shape{1, 1, 4, 16},+ {-0.082117f, -1.877712f, -0.147404f, -0.855113f, -0.547736f, 0.226975f, 0.640729f, 0.896777f,+ -0.496413f, 0.924003f, 1.173728f, 1.136638f, 1.389768f, -0.145682f, -0.174132f, 0.825051f,+ -1.366524f, 0.209429f, -0.530559f, -0.368789f, -1.741514f, -0.890544f, -0.020494f, 0.888453f,+ 0.990027f, -0.080326f, -0.189288f, -0.830679f, 0.402357f, -0.247578f, 0.605885f, 1.751687f,+ -0.032375f, -1.497355f, -0.860850f, -1.458147f, -1.197110f, 1.305271f, 0.226660f, -1.520174f,+ 0.653632f, 1.260375f, -0.359875f, -0.675991f, -0.337378f, 0.284607f, 0.639970f, 1.182217f,+ 1.212478f, 1.185404f, 1.361921f, 0.661388f, -1.530907f, -0.130964f, 0.313920f, -0.383126f,+ 0.911261f, -0.360214f, -0.925747f, 1.444299f, 0.666004f, 0.219254f, 0.926709f, 1.062534f});+ test_case.add_input<float>(+ Shape{1, 1, 4, 16},+ {0.341036f, -2.457661f, -0.675589f, -0.456579f, -0.984201f, 0.198677f, 1.192202f, -0.484906f,+ -1.134833f, 2.028035f, -0.451438f, -1.232965f, 0.237677f, 0.425683f, -0.705050f, 0.790454f,+ -0.487319f, -0.922951f, 0.178591f, 0.770769f, -0.633851f, 0.330626f, -0.093492f, 2.824434f,+ -0.708560f, 1.384172f, -0.052346f, -0.126762f, 0.721665f, 0.893991f, 1.267016f, 0.328652f,+ -0.600396f, -0.537646f, 0.509653f, 0.580900f, 1.398051f, 0.418430f, 1.060168f, 1.516771f,+ 0.164801f, -1.485559f, -1.179277f, -1.437803f, 1.591590f, -0.847409f, 1.231842f, 0.585732f,+ 1.715269f, 1.003094f, -0.102370f, -0.200030f, 0.085168f, 0.175261f, -0.530744f, -0.032628f,+ 1.609320f, -1.702138f, 0.258488f, -0.906953f, 0.187037f, 0.839856f, -0.057610f, 0.772987f});+ test_case.add_input<int>(Shape{1}, {4});+ test_case.add_input<int>(Shape{}, {5});+ test_case.add_input<int>(Shape{1}, {2});+ test_case.add_expected_output<float>(+ Shape{1, 2, 32},+ {-0.559081f, -0.593799f, 0.476747f, 0.454630f, 1.059493f, 0.229467f, 0.888757f, 1.502893f,+ 0.190434f, -1.184874f, -0.904102f, -1.222614f, 1.382345f, -0.608973f, 1.217970f, 0.484215f,+ -0.495275f, -0.824073f, 0.276560f, 0.591490f, -0.148409f, 0.203754f, 0.199781f, 2.315466f,+ -0.354753f, 0.548052f, -0.247456f, -0.442746f, 0.874970f, 0.434091f, 1.241878f, 0.340304f,+ 0.076472f, -0.473163f, 0.931005f, -0.922030f, -0.062140f, -0.104921f, 0.139470f, 0.277413f,+ 0.303132f, -0.971709f, 0.100351f, 0.553192f, 0.827624f, -0.446319f, 0.368459f, -0.118472f,+ 0.379341f, -0.282278f, 1.273438f, -1.314993f, -0.083014f, 0.372785f, -0.028856f, -0.134907f,+ 0.037130f, -1.186791f, 0.033946f, 1.292179f, 1.016173f, -0.770148f, -0.143908f, -0.207037f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 3, 16},+ {-0.032375f, -1.497355f, -0.860850f, -1.458147f, -1.197110f, 1.305271f, 0.226660f, -1.520174f,+ 0.653632f, 1.260375f, -0.359875f, -0.675991f, -0.337378f, 0.284607f, 0.639970f, 1.182217f,+ 1.855783f, 1.700440f, -1.954211f, -0.968866f, 0.664313f, 0.789867f, 0.736564f, -0.070865f,+ 0.455121f, 0.653021f, -0.077871f, 1.027302f, -2.259497f, 0.633794f, -1.034053f, 0.958678f,+ -2.041728f, -0.966850f, 1.590883f, -1.056586f, 0.651405f, -1.371635f, 0.299120f, -0.319734f,+ -0.059813f, 0.568778f, 1.756240f, 0.194706f, 0.124359f, -0.973368f, 0.583340f, -0.246072f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 3, 16},+ {-0.600396f, -0.537646f, 0.509653f, 0.580900f, 1.398051f, 0.418430f, 1.060168f, 1.516771f,+ 0.164801f, -1.485559f, -1.179277f, -1.437803f, 1.591590f, -0.847409f, 1.231842f, 0.585732f,+ -0.228684f, -0.888787f, 0.373902f, -0.911334f, -0.912768f, -1.567294f, -0.026708f, 0.496824f,+ 1.023026f, -0.141728f, 1.047855f, 0.017961f, -0.093288f, 0.573563f, 1.058393f, -0.341434f,+ 0.832007f, -0.043706f, 1.740856f, -1.982916f, -0.296599f, 0.881482f, -0.350692f, -0.792173f,+ -0.265881f, -1.379929f, 0.118954f, 2.440462f, 1.145031f, -1.109009f, -0.873341f, -0.404728f});+ test_case.run_with_tolerance_as_fp();+}++// A single-token step with query_seqlens wired ignores it and equals the plain decode.+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_query_seqlens_single_token) {+ const auto model = convert_model("com.microsoft/gqa_query_seqlens_single_token.onnx");+ auto test_case = ov::test::TestCase(model, s_device);+ test_case.add_input<float>(+ Shape{1, 1, 64},+ {0.001230f, 0.298746f, -0.274138f, -0.890592f, -0.454671f, -0.991647f, 0.060144f, 1.340215f,+ -0.492207f, -0.620475f, 0.489842f, 0.356887f, 0.105414f, -0.930468f, -0.029252f, 0.695303f,+ -1.344215f, -0.457616f, -1.901223f, -1.289538f, -1.841735f, -0.235091f, -1.267447f, 0.271264f,+ 0.156751f, -0.186931f, -2.516760f, -0.538693f, -0.048501f, 0.113309f, -1.530136f, -0.477753f,+ -0.978519f, -0.808837f, 1.060899f, -0.807535f, -0.032522f, 0.884390f, -0.583600f, -0.111702f,+ 0.110464f, 0.063782f, -1.225056f, 0.076140f, 1.358823f, -1.547145f, 0.859383f, 0.119354f,+ -0.641470f, 2.000417f, 0.762260f, -1.199289f, 0.074516f, 0.576690f, -0.188782f, 0.682910f,+ -0.066517f, 0.667248f, 1.438523f, -0.675662f, 0.203139f, -0.463308f, 0.127268f, -1.187195f});+ test_case.add_input<float>(+ Shape{1, 1, 8, 16},+ {-0.579302f, -0.196196f, 0.898764f, 1.145222f, -1.323528f, -0.794642f, 0.646903f, -1.992420f, -0.463170f,+ -0.097287f, 1.257015f, 0.689404f, -0.327213f, -0.368576f, -0.250195f, 1.523529f, -0.428025f, -0.303680f,+ 0.352589f, -0.120770f, -0.197284f, -1.114067f, -0.011521f, -0.443581f, 1.166128f, 0.653089f, -0.024144f,+ 0.668381f, -0.339870f, 1.052126f, -0.005400f, 0.583382f, -1.290893f, 0.346680f, -1.688204f, -2.035329f,+ -0.304477f, -0.899928f, 0.164053f, 2.244757f, -0.831723f, -0.623944f, 0.205404f, 0.493013f, -0.176406f,+ -0.205930f, 0.702463f, 0.519908f, -1.033676f, -0.079181f, 0.035287f, -1.054485f, 0.259839f, -0.857956f,+ 0.972067f, 0.192746f, 0.089306f, -0.591028f, -0.118610f, -1.997746f, -1.131407f, 0.362840f, -2.128567f,+ 0.846609f, -1.746096f, 0.756738f, -0.845497f, 0.778991f, 0.130951f, -1.536835f, 1.249149f, 1.441707f,+ -0.065805f, -0.273916f, -0.159867f, -0.975152f, 1.098587f, -0.542892f, -0.051190f, -0.793296f, -0.626073f,+ -1.277725f, 1.257069f, -0.154088f, 0.965922f, 0.013325f, -0.694404f, -0.326685f, -0.560231f, 0.007959f,+ -0.375267f, -0.299922f, -1.378575f, -0.806846f, 1.654058f, -0.671233f, -1.054094f, 0.337326f, 1.407272f,+ -1.454024f, -0.208522f, -0.632053f, -1.761019f, 0.734927f, -0.023444f, 0.071442f, -0.752311f, 0.454784f,+ -0.539297f, -0.142903f, -1.108261f, -1.216103f, 1.335532f, -0.507105f, 0.291680f, -0.033790f, -0.441145f,+ -0.507961f, 0.630083f, -0.301868f, -0.151444f, 0.022222f, 1.176508f, 0.680511f, 0.382600f, -0.563571f,+ -1.381969f, 0.949530f});+ test_case.add_input<float>(+ Shape{1, 1, 8, 16},+ {0.966447f, -0.140708f, 0.541884f, 0.781443f, 0.831184f, 0.921384f, -0.455618f, 1.514973f, -1.246593f,+ 0.861723f, 0.493932f, 0.873619f, 1.879008f, 1.484445f, -1.145177f, -1.688672f, 0.816889f, -1.015012f,+ -0.012405f, 0.839727f, -1.643797f, -2.109980f, 0.259299f, 0.044386f, -0.245803f, 0.038535f, -0.860516f,+ -1.513494f, -0.166655f, -0.971709f, -1.643481f, 0.505681f, -0.061399f, 0.406529f, -0.989295f, -0.658059f,+ -0.999043f, -0.886642f, 0.195408f, -0.782975f, 0.356066f, 0.339756f, 2.025161f, -1.392789f, 0.887902f,+ -0.089488f, -0.014030f, -1.449864f, -0.460194f, 0.743197f, -0.082478f, 0.081054f, -0.290717f, 1.154570f,+ -0.021473f, -2.200416f, -0.692073f, -1.968797f, -3.251438f, -0.530115f, 1.333560f, 0.047120f, -1.172546f,+ -0.940700f, 1.130613f, 0.157627f, 0.047999f, -0.053462f, 0.038400f, 0.805406f, 0.552567f, 0.215705f,+ -1.042868f, 0.511109f, -0.684247f, 1.093846f, -1.271051f, -0.137621f, -0.007358f, -1.324646f, 1.721972f,+ 1.460407f, -0.463584f, 0.771721f, 0.378676f, -2.613559f, 0.250398f, -0.061344f, 0.083217f, -1.076875f,+ -0.269347f, -0.178259f, 1.188094f, 0.334427f, -0.005555f, 1.528970f, -0.555248f, -0.389430f, -1.816755f,+ 1.569106f, 0.964332f, 0.916848f, 0.668898f, 0.110149f, 0.215489f, -0.252007f, -0.203600f, 0.054304f,+ 1.511829f, 0.555688f, -0.058460f, -0.579392f, -0.634999f, 1.602705f, 0.506687f, 0.067551f, -0.346182f,+ -1.109053f, -0.066862f, 0.873658f, -0.392537f, -0.227243f, -0.221034f, 0.109594f, -1.593011f, -0.235398f,+ -0.854396f, 0.884585f});+ test_case.add_input<int>(Shape{1}, {4});+ test_case.add_input<int>(Shape{}, {8});+ test_case.add_input<int>(Shape{1}, {1});+ test_case.add_expected_output<float>(+ Shape{1, 1, 32},+ {-0.011559f, 0.419000f, -0.502666f, -0.354335f, -0.736718f, -0.458506f, 0.090823f, -0.611447f,+ -0.001530f, 0.049210f, 0.837274f, -1.058545f, 0.858180f, -0.077582f, -0.403621f, -1.181695f,+ -0.212542f, 0.746908f, 0.018113f, -0.270141f, -0.482250f, 0.150647f, -0.000228f, -0.724647f,+ -0.285596f, -0.463897f, -0.577716f, -0.827129f, 0.739121f, -0.226836f, -0.679666f, -0.906488f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 5, 16},+ {-0.579302f, -0.196196f, 0.898764f, 1.145222f, -1.323528f, -0.794642f, 0.646903f, -1.992420f, -0.463170f,+ -0.097287f, 1.257015f, 0.689404f, -0.327213f, -0.368576f, -0.250195f, 1.523529f, -0.428025f, -0.303680f,+ 0.352589f, -0.120770f, -0.197284f, -1.114067f, -0.011521f, -0.443581f, 1.166128f, 0.653089f, -0.024144f,+ 0.668381f, -0.339870f, 1.052126f, -0.005400f, 0.583382f, -1.290893f, 0.346680f, -1.688204f, -2.035329f,+ -0.304477f, -0.899928f, 0.164053f, 2.244757f, -0.831723f, -0.623944f, 0.205404f, 0.493013f, -0.176406f,+ -0.205930f, 0.702463f, 0.519908f, -1.033676f, -0.079181f, 0.035287f, -1.054485f, 0.259839f, -0.857956f,+ 0.972067f, 0.192746f, 0.089306f, -0.591028f, -0.118610f, -1.997746f, -1.131407f, 0.362840f, -2.128567f,+ 0.846609f, 0.723202f, -0.304392f, 1.454212f, -0.810688f, -0.086834f, 0.903889f, -0.587033f, -0.111853f,+ 0.668342f, -0.752085f, -0.715218f, -0.026342f, 1.356436f, -1.535834f, 0.857041f, 0.119213f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 5, 16},+ {0.966447f, -0.140708f, 0.541884f, 0.781443f, 0.831184f, 0.921384f, -0.455618f, 1.514973f, -1.246593f,+ 0.861723f, 0.493932f, 0.873619f, 1.879008f, 1.484445f, -1.145177f, -1.688672f, 0.816889f, -1.015012f,+ -0.012405f, 0.839727f, -1.643797f, -2.109980f, 0.259299f, 0.044386f, -0.245803f, 0.038535f, -0.860516f,+ -1.513494f, -0.166655f, -0.971709f, -1.643481f, 0.505681f, -0.061399f, 0.406529f, -0.989295f, -0.658059f,+ -0.999043f, -0.886642f, 0.195408f, -0.782975f, 0.356066f, 0.339756f, 2.025161f, -1.392789f, 0.887902f,+ -0.089488f, -0.014030f, -1.449864f, -0.460194f, 0.743197f, -0.082478f, 0.081054f, -0.290717f, 1.154570f,+ -0.021473f, -2.200416f, -0.692073f, -1.968797f, -3.251438f, -0.530115f, 1.333560f, 0.047120f, -1.172546f,+ -0.940700f, -0.641470f, 2.000417f, 0.762260f, -1.199289f, 0.074516f, 0.576690f, -0.188782f, 0.682910f,+ -0.066517f, 0.667248f, 1.438523f, -0.675662f, 0.203139f, -0.463308f, 0.127268f, -1.187195f});+ test_case.run_with_tolerance_as_fp();+}++// Explicit position_ids are honored for every row of a padded chunk.+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_query_seqlens_position_ids) {+ const auto model = convert_model("com.microsoft/gqa_query_seqlens_position_ids.onnx");+ auto test_case = ov::test::TestCase(model, s_device);+ test_case.add_input<float>(+ Shape{1, 4, 64},+ {-0.770599f, 0.577047f, 1.524437f, -0.313596f, -0.601576f, 0.191432f, -0.002029f, -0.993616f, 0.460919f,+ 2.015516f, -0.258112f, -0.202876f, -1.044932f, 0.319088f, -1.246976f, -1.106931f, 1.279667f, -0.905453f,+ 1.081358f, 1.524358f, 0.259326f, 0.553391f, 1.952251f, -0.196728f, -0.593006f, -1.353231f, 0.041707f,+ 1.479144f, 0.959595f, -0.942091f, -0.855375f, -0.504171f, 0.292268f, -0.205311f, 0.214454f, 0.296739f,+ -0.298774f, -0.040174f, 0.206592f, -0.083970f, 0.503521f, 1.870876f, 0.591972f, 0.055811f, -1.686119f,+ 0.387957f, -1.946678f, -1.409034f, 0.854639f, 0.706235f, -0.149939f, -1.710011f, -0.371349f, -0.678738f,+ 0.636841f, 2.257730f, 0.216930f, -0.779311f, -1.170552f, -0.056094f, -0.176793f, -1.151519f, 0.116355f,+ -1.150913f, 1.112107f, 1.062651f, 1.084751f, -0.474050f, 0.514521f, -0.132069f, -0.388812f, -0.339146f,+ -1.299715f, -1.443864f, 0.794315f, -0.191235f, 0.216425f, 1.001710f, -1.733132f, -0.784130f, 0.175335f,+ 0.392095f, -0.377074f, 1.029179f, 0.210395f, -1.213382f, -0.930764f, 0.805471f, 0.463831f, -1.899061f,+ 1.347712f, 0.598027f, 1.343343f, -0.383701f, -0.295706f, -1.126457f, 2.536930f, -0.175454f, 1.587533f,+ -0.647292f, 0.163841f, -1.671353f, -0.382867f, 0.983755f, -1.251744f, 1.072228f, 0.337238f, -1.043951f,+ -0.501597f, -0.459066f, -0.049519f, -0.536144f, -0.827288f, -0.304588f, -1.026890f, -1.289527f, -0.048176f,+ 0.882874f, -1.529372f, 0.003508f, -0.649956f, -0.977145f, 0.853438f, -0.518170f, 1.498302f, -0.779839f,+ 0.386502f, -0.227283f, -0.754022f, 0.587675f, -0.154983f, 0.603211f, -0.047292f, -1.085816f, -0.102069f,+ 0.051955f, 0.958463f, -0.906269f, -0.039330f, -1.721879f, 0.651493f, -1.081483f, -1.806360f, -0.059217f,+ 1.105685f, -1.524447f, -1.088036f, -0.743275f, -1.129497f, 0.379428f, -0.807367f, -0.721515f, 0.583305f,+ -0.755515f, 0.432780f, -0.971385f, -1.212139f, -1.835449f, 1.861203f, -0.320259f, 0.243933f, -0.031050f,+ 0.159962f, 0.049686f, 1.908217f, -1.038927f, -1.557462f, -1.011960f, -1.334709f, 0.746962f, 0.820378f,+ -0.961316f, -1.390436f, -0.354797f, 1.391124f, -2.819569f, 0.526627f, -1.075755f, 1.040367f, -1.077924f,+ -0.285416f, -1.506279f, -0.977258f, 1.385839f, 0.820579f, -0.401668f, -0.870172f, -1.893807f, -0.393657f,+ -0.030903f, -0.084054f, -0.093792f, -1.121810f, -0.066274f, -0.038673f, 1.290562f, 1.866733f, -0.136989f,+ -0.766306f, -0.064982f, -0.607621f, -0.742434f, -0.058650f, -1.043304f, 0.606107f, -0.103916f, 0.250008f,+ -0.182940f, -0.727254f, -0.947960f, -0.237276f, -0.548760f, 0.233901f, -0.004432f, -1.362307f, 0.067121f,+ -1.342860f, -0.616478f, -0.294354f, -2.075273f, 0.091507f, 0.150983f, -0.158024f, -0.424317f, -0.373604f,+ -0.976539f, -0.269700f, -0.552612f, 0.091685f, -1.204136f, 0.235590f, 0.143219f, -0.141563f, -0.439205f,+ 0.552340f, -1.664602f, 0.460453f, 0.243037f, 0.283376f, 0.383313f, -0.653644f, -0.259460f, 0.637058f,+ 0.430639f, 0.206713f, -1.514320f, 0.537887f, 1.169471f, 1.009671f, 0.233878f, -1.557679f, 0.942545f,+ -0.147255f, -2.532520f, 0.377207f, -1.492172f});+ test_case.add_input<float>(+ Shape{1, 1, 8, 16},+ {-1.296441f, -0.634959f, 1.272591f, -0.370845f, 0.270992f, 1.747968f, 1.594030f, -0.103353f, -0.241521f,+ -1.260871f, -0.694458f, 0.425358f, 0.395731f, 0.110238f, 0.994802f, -0.772368f, -0.056077f, 0.731243f,+ 0.584146f, 1.070946f, 0.397020f, -0.309403f, 0.362192f, -1.002595f, -1.639459f, 0.580672f, -0.055140f,+ 0.308410f, -1.697684f, -0.365114f, -0.599857f, -0.864212f, -2.255015f, -0.334873f, 0.897304f, 0.380998f,+ -0.600947f, -0.014876f, 0.756800f, -2.760418f, -0.124537f, 0.543200f, 0.682129f, 1.700730f, 1.135046f,+ 0.312563f, 0.301976f, 0.786945f, -0.539327f, -0.040188f, 0.906239f, 1.957445f, -0.159267f, -0.048401f,+ 0.198480f, 1.343204f, -0.030313f, 1.469359f, -0.966657f, -0.186036f, -0.198165f, 0.786506f, 1.045260f,+ -1.509444f, -0.915118f, 0.336852f, -0.658694f, -1.522428f, 1.038480f, 0.493970f, 0.493178f, -0.475446f,+ 1.028938f, -0.239960f, 1.096435f, -0.911665f, -0.854135f, 0.204663f, -0.702332f, 0.675451f, 0.260088f,+ -0.922971f, 0.072866f, -0.351278f, 0.915833f, -0.632553f, -0.439173f, 1.211237f, 2.238593f, 1.999009f,+ 0.063223f, 0.218855f, 1.533459f, -0.124435f, -0.976349f, 0.116876f, 0.451517f, -0.829150f, -1.646231f,+ -1.436730f, 0.665429f, -0.758377f, -0.141347f, 0.212559f, 0.619141f, -0.334903f, 0.498716f, -0.890060f,+ -0.361714f, -1.024416f, 1.131767f, -0.027083f, -0.739307f, -0.352372f, -0.221728f, 0.700520f, -1.595636f,+ -1.037206f, -0.378107f, 2.532306f, 0.955679f, -0.111452f, 0.712000f, 2.057436f, -0.233744f, -0.366413f,+ 1.211944f, 0.494175f});+ test_case.add_input<float>(+ Shape{1, 1, 8, 16},+ {0.671333f, -0.508222f, 1.924203f, 1.709591f, 0.565948f, 0.684290f, -2.027261f, 0.637710f, -0.194109f,+ 0.433906f, 0.682459f, -0.341292f, -1.690482f, 0.367875f, -0.741384f, -0.330194f, -0.604510f, -0.341574f,+ -2.309521f, 1.216947f, 0.253346f, 1.111399f, 1.979842f, 0.022593f, -1.802436f, -0.893887f, -1.206905f,+ -0.501875f, 0.079648f, -2.002187f, 0.342476f, -1.510357f, 0.297365f, -0.109491f, -0.313631f, -0.073043f,+ -0.539778f, -0.612471f, -1.682756f, -0.029627f, 1.845534f, 1.980495f, 1.321818f, 0.705802f, -0.676480f,+ 1.442751f, -0.056128f, -0.068876f, -0.291227f, 0.091962f, -0.435215f, -0.083782f, -1.084599f, -0.373664f,+ 2.280556f, -0.069594f, -0.238661f, 0.532374f, 0.708122f, -1.113769f, -0.207159f, 0.918276f, 0.269838f,+ 0.121954f, 1.554018f, -0.677773f, 0.082746f, -0.520059f, 1.490308f, -1.951860f, -0.670142f, -0.529157f,+ 0.663540f, 0.606275f, 1.395194f, -1.574033f, 0.750475f, -0.293280f, -0.665625f, 0.539569f, -0.920140f,+ -2.076913f, -0.370218f, -1.497771f, -0.648916f, 0.371555f, 0.312000f, 1.586899f, -0.199655f, -1.533332f,+ -0.756097f, -0.919384f, -1.217825f, 0.435367f, -0.645232f, -1.977373f, 0.696923f, -0.111427f, 0.356837f,+ 0.105722f, 0.631655f, 0.038019f, 1.236202f, 0.424983f, 0.392068f, 0.409867f, -1.456638f, -0.164636f,+ -0.259317f, 0.207547f, -1.358694f, 1.634115f, 0.104389f, -1.211318f, -1.708887f, -0.281287f, -0.089675f,+ -0.718292f, 0.092114f, -0.641176f, 0.551658f, -0.724542f, -0.038500f, 0.978839f, 2.571669f, -1.007643f,+ -0.464508f, -0.839836f});+ test_case.add_input<int>(Shape{1}, {4});+ test_case.add_input<int>(Shape{}, {8});+ test_case.add_input<int>(Shape{1}, {2});+ test_case.add_input<int64_t>(Shape{1, 4}, {3, 4, 0, 0});+ test_case.add_expected_output<float>(+ Shape{1, 2, 32},+ {0.480797f, 0.353083f, -0.539372f, -0.774849f, -0.204506f, -0.217490f, 0.616267f, 1.504923f,+ -0.111071f, -0.521438f, -0.887553f, -0.104609f, -0.232368f, -1.054121f, 0.111634f, -1.102562f,+ 0.416136f, -0.265776f, 0.521952f, 0.742107f, 0.021773f, 0.097970f, -1.426967f, 0.378976f,+ 0.569329f, 0.931217f, 0.714675f, 0.108191f, -1.039746f, 0.563690f, -0.318633f, -0.353182f,+ -0.088015f, -0.080761f, -0.711836f, -0.437286f, -0.138204f, 0.240495f, -0.566889f, 0.477281f,+ -0.041463f, -0.106162f, 0.204846f, -0.114037f, 0.182618f, -0.444895f, 0.143657f, -0.598372f,+ -0.218831f, -0.155625f, -1.046108f, -0.034697f, -0.022419f, 0.485243f, -0.005367f, 0.371880f,+ -0.506620f, -0.339945f, -0.119682f, -0.234825f, 0.169054f, -0.835658f, 0.181688f, -0.806471f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 5, 16},+ {-1.296441f, -0.634959f, 1.272591f, -0.370845f, 0.270992f, 1.747968f, 1.594030f, -0.103353f, -0.241521f,+ -1.260871f, -0.694458f, 0.425358f, 0.395731f, 0.110238f, 0.994802f, -0.772368f, -0.056077f, 0.731243f,+ 0.584146f, 1.070946f, 0.397020f, -0.309403f, 0.362192f, -1.002595f, -1.639459f, 0.580672f, -0.055140f,+ 0.308410f, -1.697684f, -0.365114f, -0.599857f, -0.864212f, -2.255015f, -0.334873f, 0.897304f, 0.380998f,+ -0.600947f, -0.014876f, 0.756800f, -2.760418f, -0.124537f, 0.543200f, 0.682129f, 1.700730f, 1.135046f,+ 0.312563f, 0.301976f, 0.786945f, -0.360400f, -1.640011f, 0.029936f, 0.290118f, -0.248063f, -0.043853f,+ 0.212431f, -0.082633f, -0.457237f, 0.923413f, 0.628908f, 0.083669f, -1.694322f, 0.387559f, -1.946050f,+ -1.409113f, -2.605571f, -1.075291f, 1.330888f, -0.510422f, 0.183769f, -1.665412f, -0.382666f, 0.984432f,+ -1.101760f, 0.155578f, 0.928831f, -1.117269f, -0.494644f, -0.480170f, -0.051050f, -0.534899f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 5, 16},+ {0.671333f, -0.508222f, 1.924203f, 1.709591f, 0.565948f, 0.684290f, -2.027261f, 0.637710f, -0.194109f,+ 0.433906f, 0.682459f, -0.341292f, -1.690482f, 0.367875f, -0.741384f, -0.330194f, -0.604510f, -0.341574f,+ -2.309521f, 1.216947f, 0.253346f, 1.111399f, 1.979842f, 0.022593f, -1.802436f, -0.893887f, -1.206905f,+ -0.501875f, 0.079648f, -2.002187f, 0.342476f, -1.510357f, 0.297365f, -0.109491f, -0.313631f, -0.073043f,+ -0.539778f, -0.612471f, -1.682756f, -0.029627f, 1.845534f, 1.980495f, 1.321818f, 0.705802f, -0.676480f,+ 1.442751f, -0.056128f, -0.068876f, 0.854639f, 0.706235f, -0.149939f, -1.710011f, -0.371349f, -0.678738f,+ 0.636841f, 2.257730f, 0.216930f, -0.779311f, -1.170552f, -0.056094f, -0.176793f, -1.151519f, 0.116355f,+ -1.150913f, -0.827288f, -0.304588f, -1.026890f, -1.289527f, -0.048176f, 0.882874f, -1.529372f, 0.003508f,+ -0.649956f, -0.977145f, 0.853438f, -0.518170f, 1.498302f, -0.779839f, 0.386502f, -0.227283f});+ test_case.run_with_tolerance_as_fp();+}++// A padded chunk appended to an int8 per-tensor quantized cache.+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_query_seqlens_i8kv) {+ const auto model = convert_model("com.microsoft/gqa_query_seqlens_i8kv.onnx");+ auto test_case = ov::test::TestCase(model, s_device);+ test_case.add_input<float>(+ Shape{1, 4, 64},+ {0.784328f, -1.148099f, -0.484357f, -0.029601f, -0.978679f, -0.957325f, -0.475623f, -2.100440f, -1.445478f,+ -0.413034f, 0.148231f, -0.185760f, -1.773969f, -0.463786f, 0.798438f, 0.555866f, -0.078748f, -0.887370f,+ 0.631216f, -0.578929f, -1.169248f, -0.802186f, 1.448345f, 0.220180f, 1.159247f, -0.479336f, 0.938149f,+ -0.601504f, -0.157427f, 2.486350f, 0.767149f, -0.501170f, -0.084819f, 0.326223f, 1.210458f, -0.489133f,+ -1.741319f, -0.279642f, 0.015385f, 0.109538f, 1.316690f, 0.316687f, 0.812917f, -1.101114f, 0.867902f,+ 2.096220f, 0.772909f, 0.253556f, 0.153988f, 1.787142f, -0.927181f, -0.111102f, 0.460208f, 0.744001f,+ -0.437328f, 0.307321f, -0.277921f, 0.120471f, -0.132092f, -1.141594f, -0.021114f, 0.877152f, -0.967018f,+ -0.241092f, 0.664780f, -1.069865f, 0.182638f, -1.060130f, 1.134630f, 2.312821f, 2.022255f, -0.219181f,+ 0.740199f, 0.120998f, 0.102106f, 1.547757f, -1.319180f, 1.055295f, -0.048976f, 1.408541f, 0.187233f,+ -0.672672f, 0.277140f, 0.735967f, 0.035764f, 0.488038f, -0.521675f, -2.133884f, 0.900024f, 0.699160f,+ 0.148178f, 0.068411f, 1.036296f, -0.457107f, -0.706534f, -0.188550f, 1.189097f, -1.387113f, 1.191830f,+ -0.639253f, -1.100744f, 1.260062f, -0.096890f, -1.300234f, -0.358733f, 0.931052f, 1.192074f, -0.427099f,+ 0.406321f, 0.714085f, -0.644626f, 0.355036f, -0.031878f, -0.536024f, -0.492148f, 0.067034f, 0.029853f,+ -0.565490f, -0.425945f, 1.113337f, 0.213827f, 0.885094f, 1.201822f, 0.588842f, 2.270886f, -0.825304f,+ 0.808410f, -0.318144f, 1.855783f, 1.700440f, -1.954211f, -0.968866f, 0.664313f, 0.789867f, 0.736564f,+ -0.070865f, 0.455121f, 0.653021f, -0.077871f, 1.027302f, -2.259497f, 0.633794f, -1.034053f, 0.958678f,+ -0.228684f, -0.888787f, 0.373902f, -0.911334f, -0.912768f, -1.567294f, -0.026708f, 0.496824f, 1.023026f,+ -0.141728f, 1.047855f, 0.017961f, -0.093288f, 0.573563f, 1.058393f, -0.341434f, -0.243762f, -0.160831f,+ 0.082769f, -0.900408f, 1.028006f, -0.400410f, 0.462443f, -0.825473f, 0.358804f, 0.391593f, -0.420681f,+ 2.020890f, 0.371040f, 1.776929f, 0.959139f, -0.662275f, -0.382187f, 0.436102f, 0.061173f, 0.049461f,+ -0.286205f, -1.808476f, -0.225433f, -2.218122f, 0.371820f, -0.726058f, -0.715417f, -0.219304f, 0.272672f,+ -1.432006f, -1.748601f, -1.066066f, -2.041728f, -0.966850f, 1.590883f, -1.056586f, 0.651405f, -1.371635f,+ 0.299120f, -0.319734f, -0.059813f, 0.568778f, 1.756240f, 0.194706f, 0.124359f, -0.973368f, 0.583340f,+ -0.246072f, 0.832007f, -0.043706f, 1.740856f, -1.982916f, -0.296599f, 0.881482f, -0.350692f, -0.792173f,+ -0.265881f, -1.379929f, 0.118954f, 2.440462f, 1.145031f, -1.109009f, -0.873341f, -0.404728f, 1.004416f,+ -0.821487f, -0.690231f, 0.884749f, 0.864653f, -0.373815f, -1.117763f, -1.549745f, -0.698990f, -2.230529f,+ 0.749820f, -0.630031f, 0.481294f, 1.868325f, 1.172996f, -1.151135f, 0.869249f, 1.157857f, -0.746357f,+ -0.953297f, -0.109692f, -1.601423f, 1.470735f, -2.405364f, -1.106807f, -0.269565f, -0.227087f, 0.166124f,+ 0.271449f, -0.213612f, 1.136886f, -2.139376f});+ test_case.add_input<int8_t>(+ Shape{1, 1, 8, 16},+ {96, -74, 85, -42, -81, 63, -99, 98, -59, 22, -51, 74, 41, 96, 57, 48, 88, 28, -58, -56, 31, -26,+ 51, 24, -93, 85, 94, -40, -44, -21, 62, -96, -65, 39, -17, -12, 87, 59, -78, -54, -48, 31, -15, 34,+ -56, -8, -27, -63, -60, -20, 35, 49, 54, -63, 15, -82, -74, -8, 39, -54, -66, 60, 19, 63, -83, 89,+ 61, 67, -80, 29, 8, -63, 83, 64, 65, 45, -65, 49, -8, 39, 18, 66, 3, -41, 32, 34, -42, 3,+ 33, -33, -66, -35, 66, -69, -22, -2, 58, -27, 98, -16, -8, 70, -10, 36, -30, 36, 19, 96, -21, -57,+ -73, 1, 0, -82, -98, -22, -93, 90, 58, -83, 55, 51, 45, 73, 41, 1, 45, 59});+ test_case.add_input<int8_t>(+ Shape{1, 1, 8, 16},+ {16, -12, 14, -30, -20, 1, 49, -62, -14, -39, -70, -39, -40, 97, -23, -33, -21, -55, 82, 87, -22, -73,+ -97, 93, 66, 70, 17, 29, 53, -15, 65, -61, -12, -79, 54, -80, 0, -31, 98, -19, -72, 84, 10, 7,+ 26, 98, -95, 44, -10, -71, 81, 10, 82, -69, 35, -93, 97, 88, 76, -33, 39, -63, 68, -80, 46, 30,+ -42, -8, -6, -98, -90, 43, 37, -49, -11, 56, 35, -3, 72, 7, -99, -9, -52, 35, -80, 98, 21, 59,+ -8, -87, -13, -2, -17, -54, -59, -80, -1, -61, 25, -51, -13, 91, 4, 48, 36, 70, -89, 39, -53, -37,+ 81, -22, 3, -12, -79, -42, -70, -16, -100, 54, 7, -85, 98, -45, -31, -5, 6, 35});+ test_case.add_input<int>(Shape{1}, {4});+ test_case.add_input<int>(Shape{}, {8});+ test_case.add_input<int>(Shape{1}, {2});+ test_case.add_expected_output<float>(+ Shape{1, 2, 32},+ {-0.237889f, -1.204533f, 0.997294f, -1.802284f, 0.154402f, -0.512115f, 1.995614f, -0.219333f,+ -1.700204f, 2.067301f, 0.190382f, -0.258940f, 0.641438f, 2.612902f, -2.498350f, 0.846755f,+ -0.297680f, -0.649239f, 1.516247f, 1.620020f, -0.426287f, -1.289483f, -1.900889f, 1.702731f,+ 1.218885f, 1.289549f, -0.091277f, 0.006667f, 0.871538f, 0.541237f, 0.923631f, -1.558998f,+ 0.174793f, -1.083731f, 0.809747f, -1.136271f, -0.425556f, -0.475437f, 1.576236f, -1.027104f,+ -0.766763f, 0.260158f, -1.087754f, -0.607927f, -0.064723f, 2.696358f, -1.074354f, -0.469418f,+ -0.164269f, -1.358267f, 0.665469f, -1.247103f, -0.007257f, -0.703820f, 1.367056f, 0.110627f,+ -1.061940f, 1.656631f, 0.470577f, 0.161980f, 1.291597f, 1.533085f, -1.268812f, 0.395558f});+ test_case.add_expected_output<int8_t>(+ Shape{1, 1, 5, 16},+ {96, -74, 85, -42, -81, 63, -99, 98, -59, 22, -51, 74, 41, 96, 57, 48, 88, 28, -58, -56,+ 31, -26, 51, 24, -93, 85, 94, -40, -44, -21, 62, -96, -65, 39, -17, -12, 87, 59, -78, -54,+ -48, 31, -15, 34, -56, -8, -27, -63, -2, -1, 18, -8, -35, -6, 0, 2, -26, 9, 23, -23,+ 16, 42, 15, 5, -21, -26, 13, -12, -22, 25, -2, -26, -13, -21, 31, -10, 7, 15, -13, 7});+ test_case.add_expected_output<int8_t>(+ Shape{1, 1, 5, 16},+ {16, -12, 14, -30, -20, 1, 49, -62, -14, -39, -70, -39, -40, 97, -23, -33, -21, -55, 82, 87,+ -22, -73, -97, 93, 66, 70, 17, 29, 53, -15, 65, -61, -12, -79, 54, -80, 0, -31, 98, -19,+ -72, 84, 10, 7, 26, 98, -95, 44, 4, 45, -23, -3, 12, 19, -11, 8, -7, 3, -3, -29,+ -1, 22, -24, -6, -1, -13, -12, 2, 1, -14, -11, 28, 5, 22, 30, 15, 57, -21, 20, -8});+ // Mixed float output + int8 present KV: run() compares floats by ULP tolerance and int8 exactly.+ test_case.run(11);+}++// Batched right-padded chunk with an idle entry (query_seqlens = 0); padded rows hold NaN.+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_query_seqlens_batched_idle) {+ const auto model = convert_model("com.microsoft/gqa_query_seqlens_batched.onnx");+ const auto nan = std::numeric_limits<float>::quiet_NaN();+ auto test_case = ov::test::TestCase(model, s_device);+ test_case.add_input<float>(+ Shape{2, 4, 32},+ {nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, 0.627583f, -1.084430f, 0.055814f, -1.277818f, 0.231998f, 1.647910f, -0.172957f,+ 1.359424f, -1.600115f, 2.134274f, -2.971158f, 0.622260f, -0.841129f, -1.072953f, 0.765743f, -0.163608f,+ -1.348036f, -1.298054f, 0.830849f, 0.954459f, -1.946272f, -1.216022f, -0.003901f, 0.320825f, -0.958855f,+ 0.604223f, -0.807813f, 0.670475f, -1.206352f, 0.051947f, 1.438376f, 0.247253f, 0.904643f, -0.161498f,+ 1.438733f, -0.611369f, 1.512368f, 1.571866f, -0.151854f, -0.912376f, 0.647697f, -0.310405f, 2.378684f,+ -0.942145f, -1.192622f, -0.399063f, -1.092622f, -0.875352f, 1.468700f, -0.706115f, -1.660713f, 0.967802f,+ -1.480169f, 0.391352f, 0.951978f, 0.032083f, -1.298855f, -0.031191f, -1.177737f, -0.906339f, 0.260105f,+ 1.147592f, 1.150346f, 0.344794f, 0.141982f, 0.381490f, 0.300530f, -1.672457f, -0.102131f, 1.023091f,+ 1.038048f, 0.736590f, 0.699660f, 0.079104f, -1.398341f, 1.754016f, -1.047113f, -1.869314f, 0.153887f,+ 0.963321f, 0.678485f, 0.899094f, 0.873073f, -0.935734f, -0.961026f, 0.850472f, 0.115032f, -0.033284f,+ 0.515541f, 0.306654f, -0.399698f, -0.245016f, -0.670706f, -2.161640f, 1.162963f, 0.350501f, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan});+ test_case.add_input<float>(+ Shape{2, 4, 16},+ {nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, -1.277717f, 0.064969f, 1.935086f, -0.738080f, -0.769135f, 1.156467f, 0.063278f, 0.844337f,+ -0.781741f, 1.327423f, -0.868364f, 2.634666f, 0.038407f, -0.763211f, 0.464049f, -1.021760f, -0.252319f,+ 1.415258f, -0.212612f, 1.357791f, -0.644688f, 1.264983f, 0.649355f, -1.285782f, 1.359606f, -0.098327f,+ 0.979355f, -0.476365f, -0.560153f, 1.435775f, 1.474877f, 0.210710f, -0.112544f, 0.337719f, -0.683429f,+ -1.527180f, 0.284003f, 0.158164f, -0.829711f, 2.458812f, -0.924805f, 0.970822f, -0.256810f, -0.181181f,+ 1.425436f, -0.161151f, -0.375925f, 1.793497f, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan});+ test_case.add_input<float>(+ Shape{2, 4, 16},+ {nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, -0.938097f, 0.464903f, 1.274344f, 1.403334f, -0.593315f, -1.210150f, 0.443523f, 0.414333f,+ 1.259510f, -0.551336f, 0.341828f, -0.134858f, -0.029113f, -0.284486f, 0.321988f, -0.054041f, 0.012957f,+ -0.821149f, 0.232938f, 0.575662f, -0.080995f, 0.534905f, -1.528792f, -1.140938f, -0.032850f, 1.060905f,+ 1.049808f, 0.162549f, -1.463569f, -0.974470f, -0.594493f, -1.062120f, 0.294280f, -1.103680f, 0.248770f,+ 0.302905f, 1.254501f, -0.475798f, -0.072084f, 0.083599f, 1.448213f, 0.079610f, 1.019727f, 0.584843f,+ 1.670715f, -0.625137f, -0.642078f, 0.670149f, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan});+ test_case.add_input<float>(+ Shape{2, 1, 5, 16},+ {-0.511205f, -1.111018f, -2.462320f, -0.326595f, -0.464009f, 2.903030f, 0.291360f, -0.616991f, 0.743773f,+ -0.577394f, -0.172800f, 0.288573f, 0.721756f, -0.350520f, -0.135002f, -0.131167f, 0.094104f, 0.471609f,+ 0.866374f, 0.305524f, -0.015318f, -1.433897f, -0.980780f, -1.015014f, -0.394550f, -0.550969f, -0.021278f,+ -1.565433f, -0.253018f, 1.744814f, -1.458913f, -2.096403f, 1.103139f, -0.057034f, -0.148587f, -2.199657f,+ -0.764494f, -0.109801f, -0.425466f, -1.333040f, 1.188575f, -0.080616f, 0.409905f, -0.950821f, 0.616899f,+ 1.789201f, -0.139751f, -1.778920f, 0.110473f, -0.611510f, 0.942737f, 0.317008f, -0.119781f, 1.371076f,+ -0.591885f, 1.128812f, 1.042205f, -0.563407f, 0.923709f, 0.070868f, -1.119710f, 0.624527f, -0.170855f,+ -0.427253f, -1.305803f, 0.342596f, 0.613372f, -0.370633f, -0.237514f, 1.259947f, 0.576387f, -0.539290f,+ 0.279723f, -0.922129f, -0.577066f, -0.592719f, 0.282746f, 0.796443f, 0.079377f, 1.073426f, -0.700698f,+ -0.908032f, -1.407391f, -0.130937f, -1.671010f, -0.724550f, -0.764592f, -0.228320f, -0.265246f, -1.418591f,+ 0.148525f, 0.972405f, -0.172964f, -0.853541f, -1.076120f, 0.082400f, -0.942367f, -0.344998f, 0.187861f,+ -0.862812f, 2.572519f, 0.191176f, 0.266507f, 0.400071f, 0.994523f, 0.732837f, -2.042581f, -1.321684f,+ -0.806037f, -0.486001f, 0.081835f, -0.158579f, -0.252363f, -0.627884f, -1.396542f, 1.144202f, -1.597330f,+ 1.099560f, 0.444554f, 0.839281f, 0.989798f, -0.018508f, -1.600855f, 1.189198f, 1.225343f, 0.850102f,+ -0.594068f, 0.135608f, -0.419056f, -0.924331f, -0.568140f, -0.109493f, 1.256546f, 0.396976f, -0.887680f,+ 0.430411f, 0.222682f, 0.455237f, -1.206042f, -0.025644f, 0.452048f, -0.137201f, -0.038327f, 1.882840f,+ -0.284287f, 0.130666f, 0.585303f, -0.479755f, 2.033162f, 0.612182f, -0.796909f, 1.976198f, 0.419397f,+ -0.591710f, 0.031488f, -0.910026f, 0.591449f, -0.729250f, 0.021588f, -0.271043f});+ test_case.add_input<float>(+ Shape{2, 1, 5, 16},+ {0.363905f, 0.200671f, 0.310363f, 1.223833f, -0.853505f, 0.146866f, 0.738539f, -1.186998f, -0.795309f,+ -1.894371f, 0.787998f, 0.082593f, -0.070293f, 0.338638f, 0.043960f, 0.011803f, -0.940971f, 0.841867f,+ 1.890052f, 1.247161f, 1.156469f, 0.530849f, -0.443898f, -0.475561f, 1.184736f, 1.325320f, 1.826884f,+ 1.036709f, -0.977984f, 0.705794f, 0.914985f, 0.959402f, 0.283160f, -1.068116f, -0.329709f, 0.938934f,+ -0.050084f, 0.052404f, 0.160460f, -0.981746f, -0.531402f, 1.457362f, 1.428440f, -0.744108f, -1.758031f,+ 0.626554f, 1.011795f, -0.003543f, 1.052688f, 1.303132f, -0.250341f, -0.205145f, -1.083779f, -0.389304f,+ 0.952091f, -2.372132f, 1.375824f, -0.693316f, 0.372338f, -0.209892f, -0.829117f, 0.332872f, -1.553573f,+ -1.408258f, -0.216259f, 0.270738f, -0.492838f, -1.753799f, 0.193557f, 0.743155f, -0.142120f, 0.167535f,+ -3.211583f, -1.843829f, 0.026833f, -1.376183f, 0.106814f, 0.244252f, 0.517525f, -0.237695f, 0.059491f,+ -2.113070f, -1.319839f, 0.048570f, 0.444067f, 0.258691f, 1.314001f, -0.508106f, 1.161978f, -2.508150f,+ -0.861987f, -0.133281f, 0.266409f, 0.119750f, 0.088658f, 0.573527f, -1.096743f, -0.593098f, -1.154963f,+ 1.997887f, 1.454263f, -0.767290f, 0.561065f, -3.093713f, 0.595659f, 0.101808f, -1.404396f, 0.175946f,+ 0.793123f, 0.414152f, -1.021556f, 0.600332f, -0.576813f, -0.634421f, -0.487799f, 0.651074f, -1.202819f,+ -0.364433f, -0.882963f, 0.028797f, 0.050445f, 0.318090f, -0.237107f, -1.434925f, 1.078616f, 1.137225f,+ 0.757764f, 0.318817f, -1.799017f, -0.757017f, 0.092697f, 1.547193f, -0.325719f, 0.468540f, 0.221006f,+ 0.201294f, -0.892791f, 1.298464f, 0.425970f, -0.715854f, -0.037225f, 2.365024f, 0.503439f, 0.150343f,+ 1.175496f, 0.856425f, 0.159570f, -0.662578f, 1.019598f, -1.821482f, -0.606499f, 1.383888f, 0.052074f,+ 1.236229f, -0.191401f, 0.927311f, 1.517998f, 0.288448f, -1.983133f, 0.727477f});+ test_case.add_input<int32_t>(Shape{2}, {4, 6});+ test_case.add_input<int32_t>(Shape{}, {9});+ test_case.add_input<int32_t>(Shape{2}, {0, 3});+ test_case.add_input<int64_t>(Shape{2}, {5, 7});+ test_case.add_expected_output<float>(+ Shape{2, 4, 32},+ {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, -1.042166f, -0.162571f, 0.117662f, 1.561583f, 0.165028f, -0.796981f, 0.409284f,+ -0.919437f, 0.728022f, -0.119625f, -0.340472f, -0.154110f, 0.335475f, 0.329530f, -0.126767f, 0.238554f,+ -0.711011f, -0.366941f, 0.274234f, 1.013152f, -0.399151f, -0.656192f, 0.383212f, 0.017701f, 0.897985f,+ -0.695744f, -0.071679f, -0.382759f, 0.259053f, 0.204044f, 0.311686f, 0.176880f, -0.503150f, -0.753556f,+ -0.131860f, 1.002721f, 0.193824f, -0.003971f, -0.361251f, -1.145710f, 0.315541f, 0.267854f, 0.154385f,+ -0.013060f, -0.445949f, -0.137413f, -0.371025f, -0.272281f, -0.527671f, -0.856775f, -0.404858f, 0.729138f,+ -0.524556f, -0.058363f, -0.519742f, -0.423030f, 0.136618f, 0.167230f, -0.051865f, -0.767988f, 0.323661f,+ 0.638530f, 0.271501f, 0.069025f, -0.856127f, -0.002159f, 0.671148f, 1.317004f, -0.156206f, -0.892520f,+ 0.356922f, -0.111045f, 0.996588f, -0.308137f, 0.148297f, -0.112721f, 0.237540f, -0.008135f, 0.085836f,+ 0.116135f, -0.717878f, -0.245881f, 0.474148f, 1.165147f, -0.076243f, -0.628681f, 0.157787f, -0.272460f,+ 0.830215f, -0.173084f, 0.213142f, -0.090197f, 0.096810f, -0.042427f, -0.008405f, 0.027927f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f});+ test_case.add_expected_output<float>(+ Shape{2, 1, 9, 16},+ {-0.511205f, -1.111018f, -2.462320f, -0.326595f, -0.464009f, 2.903030f, 0.291360f, -0.616991f, 0.743773f,+ -0.577394f, -0.172800f, 0.288573f, 0.721756f, -0.350520f, -0.135002f, -0.131167f, 0.094104f, 0.471609f,+ 0.866374f, 0.305524f, -0.015318f, -1.433897f, -0.980780f, -1.015014f, -0.394550f, -0.550969f, -0.021278f,+ -1.565433f, -0.253018f, 1.744814f, -1.458913f, -2.096403f, 1.103139f, -0.057034f, -0.148587f, -2.199657f,+ -0.764494f, -0.109801f, -0.425466f, -1.333040f, 1.188575f, -0.080616f, 0.409905f, -0.950821f, 0.616899f,+ 1.789201f, -0.139751f, -1.778920f, 0.110473f, -0.611510f, 0.942737f, 0.317008f, -0.119781f, 1.371076f,+ -0.591885f, 1.128812f, 1.042205f, -0.563407f, 0.923709f, 0.070868f, -1.119710f, 0.624527f, -0.170855f,+ -0.427253f, -1.305803f, 0.342596f, 0.613372f, -0.370633f, -0.237514f, 1.259947f, 0.576387f, -0.539290f,+ 0.279723f, -0.922129f, -0.577066f, -0.592719f, 0.282746f, 0.796443f, 0.079377f, 1.073426f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ -0.700698f, -0.908032f, -1.407391f, -0.130937f, -1.671010f, -0.724550f, -0.764592f, -0.228320f, -0.265246f,+ -1.418591f, 0.148525f, 0.972405f, -0.172964f, -0.853541f, -1.076120f, 0.082400f, -0.942367f, -0.344998f,+ 0.187861f, -0.862812f, 2.572519f, 0.191176f, 0.266507f, 0.400071f, 0.994523f, 0.732837f, -2.042581f,+ -1.321684f, -0.806037f, -0.486001f, 0.081835f, -0.158579f, -0.252363f, -0.627884f, -1.396542f, 1.144202f,+ -1.597330f, 1.099560f, 0.444554f, 0.839281f, 0.989798f, -0.018508f, -1.600855f, 1.189198f, 1.225343f,+ 0.850102f, -0.594068f, 0.135608f, -0.419056f, -0.924331f, -0.568140f, -0.109493f, 1.256546f, 0.396976f,+ -0.887680f, 0.430411f, 0.222682f, 0.455237f, -1.206042f, -0.025644f, 0.452048f, -0.137201f, -0.038327f,+ 1.882840f, 0.243549f, -1.246241f, 2.120489f, -1.064557f, -0.770056f, 1.166028f, 0.061421f, 0.845629f,+ 1.477959f, 0.461689f, -0.046259f, 2.520506f, 0.007619f, -0.748522f, 0.464298f, -1.020691f, 1.232186f,+ 0.083685f, -0.656113f, 1.415860f, -0.615886f, 1.242124f, 0.641973f, -1.286114f, 0.627623f, 1.416200f,+ 0.757534f, -0.256631f, -0.591674f, 1.455596f, 1.478106f, 0.208677f, -0.366467f, -1.027851f, -0.419053f,+ -1.465602f, 0.198017f, 0.161193f, -0.827441f, 2.455405f, -0.856523f, 0.008434f, -0.597847f, -0.465956f,+ 1.439902f, -0.158121f, -0.380897f, 1.798158f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f});+ test_case.add_expected_output<float>(+ Shape{2, 1, 9, 16},+ {0.363905f, 0.200671f, 0.310363f, 1.223833f, -0.853505f, 0.146866f, 0.738539f, -1.186998f, -0.795309f,+ -1.894371f, 0.787998f, 0.082593f, -0.070293f, 0.338638f, 0.043960f, 0.011803f, -0.940971f, 0.841867f,+ 1.890052f, 1.247161f, 1.156469f, 0.530849f, -0.443898f, -0.475561f, 1.184736f, 1.325320f, 1.826884f,+ 1.036709f, -0.977984f, 0.705794f, 0.914985f, 0.959402f, 0.283160f, -1.068116f, -0.329709f, 0.938934f,+ -0.050084f, 0.052404f, 0.160460f, -0.981746f, -0.531402f, 1.457362f, 1.428440f, -0.744108f, -1.758031f,+ 0.626554f, 1.011795f, -0.003543f, 1.052688f, 1.303132f, -0.250341f, -0.205145f, -1.083779f, -0.389304f,+ 0.952091f, -2.372132f, 1.375824f, -0.693316f, 0.372338f, -0.209892f, -0.829117f, 0.332872f, -1.553573f,+ -1.408258f, -0.216259f, 0.270738f, -0.492838f, -1.753799f, 0.193557f, 0.743155f, -0.142120f, 0.167535f,+ -3.211583f, -1.843829f, 0.026833f, -1.376183f, 0.106814f, 0.244252f, 0.517525f, -0.237695f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.059491f, -2.113070f, -1.319839f, 0.048570f, 0.444067f, 0.258691f, 1.314001f, -0.508106f, 1.161978f,+ -2.508150f, -0.861987f, -0.133281f, 0.266409f, 0.119750f, 0.088658f, 0.573527f, -1.096743f, -0.593098f,+ -1.154963f, 1.997887f, 1.454263f, -0.767290f, 0.561065f, -3.093713f, 0.595659f, 0.101808f, -1.404396f,+ 0.175946f, 0.793123f, 0.414152f, -1.021556f, 0.600332f, -0.576813f, -0.634421f, -0.487799f, 0.651074f,+ -1.202819f, -0.364433f, -0.882963f, 0.028797f, 0.050445f, 0.318090f, -0.237107f, -1.434925f, 1.078616f,+ 1.137225f, 0.757764f, 0.318817f, -1.799017f, -0.757017f, 0.092697f, 1.547193f, -0.325719f, 0.468540f,+ 0.221006f, 0.201294f, -0.892791f, 1.298464f, 0.425970f, -0.715854f, -0.037225f, 2.365024f, 0.503439f,+ 0.150343f, -0.938097f, 0.464903f, 1.274344f, 1.403334f, -0.593315f, -1.210150f, 0.443523f, 0.414333f,+ 1.259510f, -0.551336f, 0.341828f, -0.134858f, -0.029113f, -0.284486f, 0.321988f, -0.054041f, 0.012957f,+ -0.821149f, 0.232938f, 0.575662f, -0.080995f, 0.534905f, -1.528792f, -1.140938f, -0.032850f, 1.060905f,+ 1.049808f, 0.162549f, -1.463569f, -0.974470f, -0.594493f, -1.062120f, 0.294280f, -1.103680f, 0.248770f,+ 0.302905f, 1.254501f, -0.475798f, -0.072084f, 0.083599f, 1.448213f, 0.079610f, 1.019727f, 0.584843f,+ 1.670715f, -0.625137f, -0.642078f, 0.670149f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f});+ test_case.run_with_tolerance_as_fp();+}++// Batched right-padded chunk whose entries share a total but not a past length.+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_query_seqlens_batched_equal_total) {+ const auto model = convert_model("com.microsoft/gqa_query_seqlens_batched.onnx");+ const auto nan = std::numeric_limits<float>::quiet_NaN();+ auto test_case = ov::test::TestCase(model, s_device);+ test_case.add_input<float>(+ Shape{2, 4, 32},+ {0.799336f, 0.639296f, 0.369664f, 1.366581f, 0.102758f, 0.421161f, 1.314459f, 0.993461f, 2.982421f,+ 0.663358f, -0.552885f, -1.995703f, -0.503966f, -0.684025f, -1.899127f, -0.855519f, 0.782774f, -0.449516f,+ -1.405567f, 1.330850f, 0.616035f, -1.178591f, -0.878775f, -0.258759f, -1.087008f, -0.796769f, -1.076120f,+ -1.133555f, -1.318536f, 1.634362f, -1.049642f, 0.260752f, 1.076478f, -1.522349f, 0.250009f, -0.655856f,+ 1.107075f, -0.015577f, 0.910967f, 0.731746f, -0.044568f, 0.022181f, 1.085181f, 0.519164f, 0.249937f,+ -0.501459f, -0.989026f, -0.441378f, 0.013422f, 0.890763f, -0.003336f, -0.190950f, 1.130102f, 0.812109f,+ 0.251403f, -0.796811f, -1.177349f, -0.357119f, 1.400273f, -0.177506f, -0.486167f, -0.224781f, -0.317241f,+ -0.759100f, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, -1.712544f, -1.337416f, -0.085172f, 0.118896f, -1.836614f, 0.065985f, -1.588328f,+ 0.755805f, -1.574318f, 0.117926f, 0.216860f, 0.605993f, -2.120103f, 0.808513f, -0.233131f, -0.837084f,+ -0.121566f, 0.154545f, -0.165773f, -0.478912f, -0.434539f, -0.437219f, -0.840085f, 0.286454f, -0.175045f,+ -1.683337f, -0.106287f, -0.366002f, 0.252838f, -1.233296f, 0.980933f, -1.573991f, 2.194240f, -0.003756f,+ 0.465519f, -0.475125f, -1.094199f, -1.928828f, -1.376338f, -1.612162f, 0.235840f, -0.958133f, -0.798376f,+ 1.807506f, -0.324459f, 0.138947f, -0.636959f, 0.515283f, -1.335855f, 1.466483f, 0.194803f, -0.509818f,+ -0.445119f, 1.034373f, -0.364005f, -1.467811f, -0.575798f, 0.921528f, 0.737331f, -0.351682f, -0.253521f,+ 1.248457f, 0.698952f, -0.506225f, -0.010272f, 0.066928f, -0.192454f, 1.335010f, 0.059294f, 1.062187f,+ 0.282426f, -1.068169f, -0.386979f, 1.473923f, -0.171877f, -0.221543f, -2.057154f, -1.428162f, -0.357336f,+ -1.392759f, -0.253422f, -0.723605f, 0.555441f, -1.035901f, -1.790575f, 1.061504f, -0.276269f, -0.473246f,+ 1.497816f, -1.597512f, 0.188011f, 0.996729f, 0.505291f, 1.809920f, -0.685409f, 1.294125f, -0.336084f,+ -1.598295f, -0.760187f, 0.177124f, -1.213929f, 0.149817f, -1.053003f, -0.022097f, 0.511724f, -0.305676f,+ -0.395968f, 1.394930f, -0.614026f, -0.757313f, -0.005752f, 0.358235f, -0.145902f, -0.870642f, -0.361018f,+ 0.429880f, -0.532919f, -2.170854f, -0.475937f, 1.970700f, -0.943716f, -1.991804f, -0.063224f, -0.429139f,+ 0.807235f, -0.447836f, -0.662835f, 0.497149f});+ test_case.add_input<float>(+ Shape{2, 4, 16},+ {-0.108515f, -0.635214f, -0.432965f, -0.535427f, -0.222332f, 0.589621f, 1.001497f, 0.274753f, 0.227033f,+ -0.298098f, 0.869261f, -1.158165f, 0.364062f, 0.150962f, 0.261057f, 0.312262f, -1.517422f, 0.865735f,+ 1.349362f, 1.607994f, -0.191347f, -0.122108f, -0.368497f, 0.038378f, 0.445814f, -0.257303f, 1.395007f,+ -0.391311f, 0.196809f, -1.473772f, 1.216926f, 0.267709f, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, -1.223372f, -1.044511f, -0.299918f, -0.135825f, 1.696364f, 1.372309f, -0.140952f, 1.152840f,+ -0.216296f, -0.856566f, 0.123757f, 1.434757f, -2.813667f, 0.673455f, 0.055292f, -2.152194f, -0.342247f,+ 1.572814f, -0.179963f, -0.865744f, -1.440364f, 0.209285f, 1.125044f, -0.665307f, 0.652494f, 1.336406f,+ -1.555515f, 0.742909f, 1.653920f, 2.816646f, 1.003738f, 0.186971f, 1.224997f, -1.996685f, -0.201470f,+ 0.582868f, -0.710101f, -0.237040f, -0.180787f, 1.102691f, 0.776152f, 0.960795f, 0.538313f, -1.529168f,+ 0.503427f, 1.107709f, 1.677029f, -0.987831f, 0.026781f, 0.787987f, -0.925033f, 0.319635f, -1.304553f,+ -0.532623f, 0.731064f, 0.266766f, 0.183252f, 1.901974f, 0.434234f, -0.337545f, -1.909434f, -0.294698f,+ -0.460179f, 1.122997f});+ test_case.add_input<float>(+ Shape{2, 4, 16},+ {1.552252f, 0.504466f, -0.358871f, -0.470560f, 0.142873f, -0.074559f, -1.984425f, 1.759444f, 0.283436f,+ -0.756823f, 1.300155f, 0.285017f, -0.460724f, 0.304319f, 0.665398f, 0.106218f, -0.619022f, 1.177669f,+ 1.020832f, 1.491789f, -0.319185f, -0.641918f, -0.952757f, 0.920450f, -0.697297f, -0.528508f, -1.062007f,+ -0.550486f, 0.431216f, -0.523434f, 1.189562f, 0.993324f, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, 1.245743f, 0.963390f, -0.521244f, -0.263426f, -0.934838f, 0.737059f, -1.958452f, -1.129389f,+ -0.210205f, 0.816176f, -0.713699f, 0.932476f, 0.272728f, 0.128908f, 0.089615f, -1.619567f, -1.034602f,+ -1.105259f, -0.837421f, -1.595997f, -1.124961f, -0.823921f, -1.058998f, 2.543515f, 0.175851f, -1.747310f,+ -0.149982f, 0.492619f, -1.876786f, -0.176303f, -0.227766f, -2.460019f, 0.303992f, 1.070014f, -1.948833f,+ -1.618643f, 0.085711f, 0.202638f, 1.075168f, -0.425619f, -1.036989f, 0.411772f, 0.923300f, -0.631160f,+ 0.890819f, -1.589622f, -0.597455f, -1.206115f, -0.091276f, 0.206890f, -1.620112f, -0.006529f, -2.734750f,+ 0.517161f, -0.998644f, 0.107642f, -1.468731f, 1.938765f, -0.419800f, -0.272170f, 0.624675f, -0.053541f,+ 1.285483f, -0.739477f});+ test_case.add_input<float>(+ Shape{2, 1, 4, 16},+ {0.246353f, -0.589912f, 1.335224f, -0.349555f, -1.543527f, -0.305454f, 1.845854f, 1.030314f, -1.628789f,+ 1.361035f, 0.096167f, 0.274649f, -1.451915f, 1.847030f, -0.010783f, -0.633438f, 0.648672f, -1.516726f,+ 0.798394f, 1.466992f, -0.524788f, 1.644632f, 0.663062f, 0.869494f, -0.870055f, 0.059500f, -0.283858f,+ -1.420535f, 1.310055f, 0.228459f, 1.111601f, 1.011162f, 0.492877f, -0.877540f, -0.984611f, -0.380290f,+ 1.023063f, -0.241803f, 1.552244f, -0.201137f, 2.105137f, -0.594395f, 3.464591f, 0.177961f, 1.615815f,+ -2.019973f, -2.553787f, 0.182181f, 0.066723f, 0.391486f, 0.016803f, -0.091022f, 0.105855f, -1.168956f,+ 2.439018f, -1.735603f, 0.378061f, -1.935516f, -2.684984f, -0.860360f, -1.443966f, 1.962323f, -0.468830f,+ -0.580931f, 1.463257f, 0.847709f, -1.288231f, -0.854059f, -1.242186f, -1.291215f, -2.417477f, 0.370665f,+ 0.104130f, -2.510457f, -0.052518f, 0.833229f, -0.619547f, -1.210869f, -0.933082f, -0.604589f, -0.261072f,+ 1.566016f, 0.745562f, -0.794557f, -0.296542f, -0.201270f, 0.051325f, -0.082961f, 1.226945f, -0.426811f,+ -0.466124f, 2.118793f, 0.011601f, -0.343068f, 1.029888f, -0.404932f, 0.288311f, -0.326500f, 0.258756f,+ -0.469894f, 0.196865f, -0.423739f, 0.238281f, 0.244181f, -1.151139f, -0.193437f, 1.039640f, -0.672687f,+ 0.938471f, -0.536645f, -0.231600f, -0.753068f, -1.278348f, 0.097768f, -0.169611f, -1.769277f, 0.061613f,+ -0.151382f, 0.812703f, 0.922426f, -1.505440f, 0.612162f, -0.584857f, 0.461560f, -0.111730f, 0.585090f,+ 0.892416f, -1.645464f});+ test_case.add_input<float>(+ Shape{2, 1, 4, 16},+ {0.815233f, 0.582380f, 0.552011f, -0.889895f, 0.539294f, -1.696579f, -0.168277f, 0.543036f, -0.166921f,+ 0.340706f, 0.368700f, 1.857739f, -0.442941f, 0.246522f, -0.177945f, -0.328699f, -1.311529f, 0.543626f,+ -0.192845f, 0.720253f, 1.525757f, -0.061315f, 0.291492f, -1.935481f, 0.082734f, 0.221339f, -0.420950f,+ -1.906978f, -0.725680f, -2.070925f, -0.257850f, -0.430699f, 0.091395f, -0.277796f, -0.258153f, -0.786015f,+ 2.085963f, 1.216636f, 2.243356f, -1.375092f, -0.695531f, -0.837692f, -1.425228f, -0.562252f, 1.100849f,+ -0.430284f, -0.740766f, 0.102489f, 0.362744f, 0.149401f, 0.730695f, 1.002242f, 0.719580f, 0.005334f,+ -0.378974f, -0.620733f, 0.611619f, 1.052801f, 0.053094f, 0.115679f, 1.780252f, -1.228139f, -0.763922f,+ -1.458714f, -0.364173f, 2.809377f, 0.367676f, 1.248446f, 0.379627f, 0.524988f, 1.314870f, 1.201205f,+ 0.542081f, -1.046838f, 0.171216f, 0.393689f, 2.222930f, -2.700082f, 1.746509f, -1.381937f, -0.515029f,+ -0.294065f, 0.404377f, 0.536476f, 1.421982f, -1.328565f, -0.625700f, -2.372205f, -0.835616f, 0.231419f,+ -0.920885f, 0.687599f, 0.457109f, 1.637552f, -1.270200f, -3.944848f, 0.880671f, -0.846719f, -0.809194f,+ 1.107796f, 0.739615f, -0.963579f, 1.296803f, 0.842159f, -0.193386f, 0.259680f, 0.738756f, -1.100498f,+ 0.047191f, 0.505015f, 0.154047f, -2.484051f, -0.314955f, -1.454358f, -0.847165f, -0.488240f, -1.003350f,+ 0.545386f, 1.187579f, -0.310944f, 0.598569f, 1.027070f, -1.211900f, 0.004198f, 0.205683f, 0.368391f,+ -0.768828f, 0.799421f});+ test_case.add_input<int32_t>(Shape{2}, {5, 5});+ test_case.add_input<int32_t>(Shape{}, {8});+ test_case.add_input<int32_t>(Shape{2}, {2, 4});+ test_case.add_input<int64_t>(Shape{2}, {6, 6});+ test_case.add_expected_output<float>(+ Shape{2, 4, 32},+ {0.012965f, 0.491541f, 0.183299f, -0.118219f, 0.960576f, -0.711729f, -0.036937f, -0.460582f, -0.008493f,+ 0.212581f, 0.039207f, 0.104090f, -0.318006f, -0.748850f, -0.213256f, -0.396443f, 0.384787f, 0.180605f,+ 0.665384f, 0.873996f, 0.717318f, -0.048546f, -0.397619f, -0.531268f, 0.557080f, 0.942045f, 0.087780f,+ 0.138068f, 1.580329f, -1.138649f, -0.687053f, -1.340369f, 0.241042f, -0.039245f, -0.126614f, -0.522245f,+ 1.601787f, 0.726349f, 1.290157f, -0.818101f, -0.440686f, -0.595117f, -0.867004f, -0.341860f, 0.780991f,+ -0.425629f, -0.474847f, -0.013947f, 0.189336f, 0.269968f, 0.109602f, -0.127536f, 1.074840f, 0.233630f,+ 0.491018f, -0.272242f, -0.364174f, -0.465740f, -0.610737f, -0.224522f, 0.521089f, -0.416818f, -0.090704f,+ 0.090681f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.349607f, 1.933799f, -0.027252f, 0.563250f, -0.187132f, 0.587038f, -0.175593f,+ 0.101782f, 0.183291f, -0.195509f, -0.241614f, 0.638574f, 1.324301f, -1.365547f, 0.956589f, -1.532373f,+ -0.206818f, 2.032829f, 0.272315f, 0.945361f, 0.418389f, 0.212092f, 0.586055f, 0.283522f, 0.205065f,+ -0.600414f, -0.129063f, 0.509011f, 1.677789f, -1.586144f, 1.007447f, -1.875517f, -0.462740f, 1.004261f,+ 0.244693f, 0.616977f, 0.663288f, -0.426116f, 0.147419f, -0.299612f, -0.121308f, -0.509517f, -0.364001f,+ 0.545508f, 0.989956f, -0.465010f, 0.177031f, -2.630252f, -0.731308f, -0.671523f, -0.646144f, -1.157879f,+ -0.816277f, -0.660079f, -1.018734f, 1.674335f, 0.059143f, -1.281720f, -0.264511f, 0.550913f, -1.289412f,+ -0.078209f, -0.214159f, -2.468417f, 0.882358f, 0.972484f, -0.535365f, -0.259040f, -0.602462f, 0.504227f,+ -1.349856f, -0.900848f, -0.264385f, 0.553683f, -0.504998f, 0.727907f, 0.427110f, -0.131847f, 0.047178f,+ -1.736008f, -0.573540f, 0.367190f, -0.366035f, -0.417244f, -0.276765f, -0.358439f, -0.249614f, 1.141637f,+ 0.061747f, -1.024841f, -0.132716f, 0.453963f, -0.113048f, -0.726125f, 0.203981f, -2.230448f, -0.240584f,+ 2.036299f, 0.132802f, 0.865283f, 0.242938f, 0.268321f, 0.662678f, 0.473964f, 0.160065f, -0.565411f,+ -0.052403f, 0.415552f, 1.675277f, -1.722610f, 1.110283f, -1.718759f, -0.281038f, 1.879751f, -0.041541f,+ 0.640575f, 0.286118f, 0.179745f, 0.759095f, 0.419462f, 0.034083f, -0.528495f, 0.042666f, 0.300193f,+ 1.578804f, -1.676846f, 0.916133f, -1.745548f});+ test_case.add_expected_output<float>(+ Shape{2, 1, 8, 16},+ {0.246353f, -0.589912f, 1.335224f, -0.349555f, -1.543527f, -0.305454f, 1.845854f, 1.030314f, -1.628789f,+ 1.361035f, 0.096167f, 0.274649f, -1.451915f, 1.847030f, -0.010783f, -0.633438f, 0.648672f, -1.516726f,+ 0.798394f, 1.466992f, -0.524788f, 1.644632f, 0.663062f, 0.869494f, -0.870055f, 0.059500f, -0.283858f,+ -1.420535f, 1.310055f, 0.228459f, 1.111601f, 1.011162f, 0.492877f, -0.877540f, -0.984611f, -0.380290f,+ 1.023063f, -0.241803f, 1.552244f, -0.201137f, 2.105137f, -0.594395f, 3.464591f, 0.177961f, 1.615815f,+ -2.019973f, -2.553787f, 0.182181f, 0.066723f, 0.391486f, 0.016803f, -0.091022f, 0.105855f, -1.168956f,+ 2.439018f, -1.735603f, 0.378061f, -1.935516f, -2.684984f, -0.860360f, -1.443966f, 1.962323f, -0.468830f,+ -0.580931f, 0.242749f, 0.092974f, -0.737293f, -0.385042f, -0.236713f, 0.587664f, 1.000445f, 0.274358f,+ -0.066274f, -0.695496f, 0.632038f, -1.216459f, 0.354880f, 0.158408f, 0.265061f, 0.312609f, -0.002933f,+ 0.248336f, 0.515375f, 1.649550f, -0.200944f, -0.098791f, -0.374577f, 0.037955f, 1.581553f, 0.868350f,+ 1.871154f, -0.133241f, 0.187000f, -1.475518f, 1.215069f, 0.267769f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 1.463257f, 0.847709f, -1.288231f, -0.854059f, -1.242186f, -1.291215f, -2.417477f,+ 0.370665f, 0.104130f, -2.510457f, -0.052518f, 0.833229f, -0.619547f, -1.210869f, -0.933082f, -0.604589f,+ -0.261072f, 1.566016f, 0.745562f, -0.794557f, -0.296542f, -0.201270f, 0.051325f, -0.082961f, 1.226945f,+ -0.426811f, -0.466124f, 2.118793f, 0.011601f, -0.343068f, 1.029888f, -0.404932f, 0.705780f, -0.336140f,+ -0.318526f, -0.226234f, 1.752295f, 1.368022f, -0.141062f, 1.154200f, -1.022398f, -1.308326f, 0.061706f,+ 1.423304f, -2.779179f, 0.682121f, 0.055010f, -2.151465f, 0.246742f, -0.169465f, 0.287761f, -0.932224f,+ -1.489327f, 0.182554f, 1.122028f, -0.665484f, -0.694262f, 2.056942f, -1.539222f, 0.657560f, 1.609971f,+ 2.818505f, 1.007109f, 0.186340f, -0.213319f, -1.517472f, -0.395195f, 0.771122f, -0.729664f, -0.251032f,+ -0.187494f, 1.103940f, -1.434407f, -1.614670f, 0.417363f, -1.443420f, 0.474628f, 1.104622f, 1.676293f,+ -0.986435f, 0.183321f, -1.910023f, -1.019976f, 0.368796f, -1.207491f, -0.527897f, 0.733356f, 0.264990f,+ 0.026301f, 0.768275f, -0.062408f, -0.283006f, -1.972247f, -0.303082f, -0.456518f, 1.123418f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f});+ test_case.add_expected_output<float>(+ Shape{2, 1, 8, 16},+ {0.815233f, 0.582380f, 0.552011f, -0.889895f, 0.539294f, -1.696579f, -0.168277f, 0.543036f, -0.166921f,+ 0.340706f, 0.368700f, 1.857739f, -0.442941f, 0.246522f, -0.177945f, -0.328699f, -1.311529f, 0.543626f,+ -0.192845f, 0.720253f, 1.525757f, -0.061315f, 0.291492f, -1.935481f, 0.082734f, 0.221339f, -0.420950f,+ -1.906978f, -0.725680f, -2.070925f, -0.257850f, -0.430699f, 0.091395f, -0.277796f, -0.258153f, -0.786015f,+ 2.085963f, 1.216636f, 2.243356f, -1.375092f, -0.695531f, -0.837692f, -1.425228f, -0.562252f, 1.100849f,+ -0.430284f, -0.740766f, 0.102489f, 0.362744f, 0.149401f, 0.730695f, 1.002242f, 0.719580f, 0.005334f,+ -0.378974f, -0.620733f, 0.611619f, 1.052801f, 0.053094f, 0.115679f, 1.780252f, -1.228139f, -0.763922f,+ -1.458714f, 1.552252f, 0.504466f, -0.358871f, -0.470560f, 0.142873f, -0.074559f, -1.984425f, 1.759444f,+ 0.283436f, -0.756823f, 1.300155f, 0.285017f, -0.460724f, 0.304319f, 0.665398f, 0.106218f, -0.619022f,+ 1.177669f, 1.020832f, 1.491789f, -0.319185f, -0.641918f, -0.952757f, 0.920450f, -0.697297f, -0.528508f,+ -1.062007f, -0.550486f, 0.431216f, -0.523434f, 1.189562f, 0.993324f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, -0.364173f, 2.809377f, 0.367676f, 1.248446f, 0.379627f, 0.524988f, 1.314870f,+ 1.201205f, 0.542081f, -1.046838f, 0.171216f, 0.393689f, 2.222930f, -2.700082f, 1.746509f, -1.381937f,+ -0.515029f, -0.294065f, 0.404377f, 0.536476f, 1.421982f, -1.328565f, -0.625700f, -2.372205f, -0.835616f,+ 0.231419f, -0.920885f, 0.687599f, 0.457109f, 1.637552f, -1.270200f, -3.944848f, 1.245743f, 0.963390f,+ -0.521244f, -0.263426f, -0.934838f, 0.737059f, -1.958452f, -1.129389f, -0.210205f, 0.816176f, -0.713699f,+ 0.932476f, 0.272728f, 0.128908f, 0.089615f, -1.619567f, -1.034602f, -1.105259f, -0.837421f, -1.595997f,+ -1.124961f, -0.823921f, -1.058998f, 2.543515f, 0.175851f, -1.747310f, -0.149982f, 0.492619f, -1.876786f,+ -0.176303f, -0.227766f, -2.460019f, 0.303992f, 1.070014f, -1.948833f, -1.618643f, 0.085711f, 0.202638f,+ 1.075168f, -0.425619f, -1.036989f, 0.411772f, 0.923300f, -0.631160f, 0.890819f, -1.589622f, -0.597455f,+ -1.206115f, -0.091276f, 0.206890f, -1.620112f, -0.006529f, -2.734750f, 0.517161f, -0.998644f, 0.107642f,+ -1.468731f, 1.938765f, -0.419800f, -0.272170f, 0.624675f, -0.053541f, 1.285483f, -0.739477f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f});+ test_case.run_with_tolerance_as_fp();+}++// Single-token step with query_seqlens: an idle entry keeps its cache unchanged.+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_query_seqlens_idle_decode) {+ const auto model = convert_model("com.microsoft/gqa_query_seqlens_batched.onnx");+ const auto nan = std::numeric_limits<float>::quiet_NaN();+ auto test_case = ov::test::TestCase(model, s_device);+ test_case.add_input<float>(+ Shape{2, 1, 32},+ {nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan,+ 0.367904f, 0.406843f, 0.530082f, 0.884275f, -0.444825f, -0.392821f, 0.540196f, -0.073339f,+ 1.151752f, 1.908892f, 1.595358f, 1.335406f, 0.985475f, 0.941507f, 0.862632f, -0.020987f,+ 0.702372f, -0.041503f, 0.108975f, -0.052415f, -0.818977f, 0.997583f, -0.537027f, 0.388820f,+ 0.674418f, 0.525002f, 0.250159f, 1.165749f, -0.595102f, 1.520357f, 0.626611f, -1.533934f});+ test_case.add_input<float>(+ Shape{2, 1, 16},+ {nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan,+ -0.056977f, -1.076869f, 1.760405f, 0.507966f, 0.619269f, -0.345664f, -1.448232f, 0.138537f,+ 0.308242f, -1.398425f, 0.003546f, 0.317233f, -1.328463f, -0.400741f, 0.147916f, -0.672578f});+ test_case.add_input<float>(+ Shape{2, 1, 16},+ {nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan,+ -0.605500f, -0.556759f, -1.741645f, 1.483158f, 1.015569f, -1.269729f, -0.459088f, 1.614606f,+ 0.263957f, 2.027716f, -0.693600f, -0.635652f, 0.880623f, -1.126104f, -0.854420f, 0.035484f});+ test_case.add_input<float>(+ Shape{2, 1, 6, 16},+ {1.275024f, -0.812245f, -0.542313f, 0.749648f, 0.545369f, 0.070925f, 0.471956f, -1.363787f, 2.407830f,+ -2.142386f, 1.302553f, 3.378363f, 0.687877f, -1.185211f, 1.670577f, -0.962410f, -0.334826f, -0.522956f,+ 0.353223f, 1.455764f, 1.353745f, 1.045708f, -0.359332f, -0.191585f, -0.342627f, 0.686132f, 0.872864f,+ 1.095530f, -1.672361f, 0.165164f, -0.713202f, 0.905043f, 0.995493f, -0.110472f, -0.767061f, -0.134948f,+ -0.638231f, -0.673460f, 1.668942f, -1.240141f, -0.668144f, 0.447847f, -1.265060f, 0.144273f, -2.539755f,+ 1.092407f, 1.675443f, 0.693876f, 0.139870f, -0.614094f, 0.741214f, 0.313412f, 1.496415f, 0.741528f,+ 1.941468f, -0.633559f, 1.356501f, -0.236596f, -2.066535f, 1.490293f, 0.504847f, -0.213407f, 0.138077f,+ 2.092520f, -0.378638f, -0.479433f, 0.282109f, 0.420421f, 0.578601f, -0.827534f, -1.057137f, -1.707744f,+ 1.080002f, 0.833275f, 0.654531f, 0.201106f, -0.483115f, -1.611566f, 0.323874f, -0.213647f, -0.646369f,+ 0.226717f, -1.804664f, 0.016471f, -0.854171f, 0.598878f, 2.486366f, -1.219703f, 0.569407f, -0.587293f,+ -1.855960f, 1.113158f, -0.223386f, 0.013885f, -1.783310f, -0.044372f, 0.438845f, -0.648128f, 1.073442f,+ -0.273293f, -0.464913f, -0.243260f, -0.452986f, -1.725154f, -1.311847f, -0.333947f, 0.268144f, -2.358638f,+ 1.145367f, -2.474153f, -1.011840f, -0.109856f, -0.568023f, 1.372194f, 1.760667f, 0.892158f, 0.067302f,+ 0.918245f, 1.931988f, 1.236039f, 0.433323f, -0.212353f, 1.690878f, 0.097497f, -1.367717f, 1.185016f,+ 0.267758f, -1.029415f, 1.100571f, -0.238973f, -0.426142f, 1.357641f, 0.971457f, -0.702997f, 1.501098f,+ 1.400526f, -0.537457f, 0.707064f, -0.689078f, 0.488712f, 0.242408f, 1.762604f, 1.096596f, 0.211981f,+ -0.050298f, 0.200390f, -1.293308f, 0.292216f, -1.214751f, 0.498863f, -1.492733f, -1.235152f, -0.225115f,+ -0.727480f, 0.999360f, 1.600033f, 0.674497f, -1.272651f, 2.095673f, 0.117753f, 0.120974f, 0.688193f,+ -0.094003f, -0.649669f, -0.479761f, 1.536859f, -1.354322f, -0.712195f, 0.066348f, 0.816977f, -0.666364f,+ -0.567504f, -1.089522f, -1.644422f, 1.109130f, 0.169357f, -0.234812f, 0.864817f, -0.420304f, 0.304565f,+ 0.352500f, 1.004058f, 0.264515f, -1.468116f, -0.119449f, -0.867522f, -1.572752f, -0.076581f, -1.177887f,+ 0.087733f, 0.046017f, 0.723135f});+ test_case.add_input<float>(+ Shape{2, 1, 6, 16},+ {-0.685991f, -0.602044f, -0.678653f, 0.082147f, 0.535397f, 0.690880f, 2.203624f, 0.258709f, -0.782121f,+ -0.169026f, 1.572640f, -2.204850f, 0.035475f, 1.455926f, -0.389976f, 0.057275f, 0.512134f, -1.073511f,+ 1.652816f, 0.156937f, -1.491666f, 1.408677f, -0.928610f, 1.504478f, -1.128435f, 1.082783f, -1.021420f,+ 2.116989f, 0.845145f, 1.833844f, -0.423084f, -0.425380f, 0.448387f, -0.712317f, 1.068330f, 0.107709f,+ -0.827633f, -0.334834f, -0.434023f, -0.230353f, 0.387177f, -0.728370f, 0.197996f, 0.078423f, -0.319137f,+ -1.617330f, 0.738758f, -0.723663f, -2.345493f, 0.853263f, 0.105235f, -0.258354f, 1.127409f, 2.999391f,+ -0.518910f, 1.944899f, -1.203207f, -1.123397f, 1.530601f, -0.286479f, -0.324314f, 1.867617f, 0.218157f,+ 0.141700f, 0.059535f, -1.217214f, 1.339954f, -0.481047f, 0.390373f, -0.170348f, -2.081453f, -0.241503f,+ -0.699831f, 3.040822f, 0.188978f, 0.619830f, -0.035367f, -1.556886f, -1.432997f, -1.121109f, 0.025690f,+ -0.968089f, -0.186637f, -0.726573f, 1.099623f, -1.423556f, -1.688020f, 0.184428f, -1.591965f, -0.971829f,+ -0.007637f, 0.532748f, -2.170492f, -1.821158f, 1.135972f, 0.084437f, 0.010473f, -1.095812f, -0.226064f,+ -0.425841f, -0.162053f, -1.170929f, 0.788263f, 1.593899f, -1.381148f, -0.119685f, -0.820775f, 0.488714f,+ 1.784580f, 1.880445f, -1.324462f, -1.154620f, -2.035255f, -1.007266f, 0.769484f, -2.595685f, 1.726362f,+ 1.714479f, 0.243105f, 0.215127f, 0.925098f, 0.466374f, 3.242254f, -1.589451f, -0.174766f, 1.841549f,+ 1.406225f, -1.406864f, 0.279213f, -0.825242f, 1.467296f, -0.297104f, 1.621692f, -0.729274f, -2.285827f,+ 0.023184f, -0.350618f, 0.573175f, -1.123489f, -0.506550f, -0.775737f, 1.363714f, -1.197976f, -1.085498f,+ 0.094936f, 0.395905f, 0.584635f, -0.267187f, 2.056289f, -0.501958f, -0.410833f, -0.041318f, 0.760315f,+ -0.018580f, -0.663263f, -2.975389f, 0.994211f, -1.152212f, -1.648420f, -1.654954f, -0.093160f, 2.703855f,+ -0.613348f, -1.056465f, 1.377396f, 0.284885f, 1.917743f, -0.292255f, -0.254493f, -0.659562f, -0.313390f,+ 0.006556f, -0.815581f, 2.180922f, -0.047599f, -0.150770f, 0.525306f, 0.193513f, -0.644901f, -0.887710f,+ -0.981003f, -2.048927f, 0.256401f, -3.232565f, -2.108511f, 1.050398f, -0.097115f, -0.837919f, -0.774198f,+ 1.051759f, 1.655747f, -0.096147f});+ test_case.add_input<int32_t>(Shape{2}, {4, 6});+ test_case.add_input<int32_t>(Shape{}, {7});+ test_case.add_input<int32_t>(Shape{2}, {0, 1});+ test_case.add_input<int64_t>(Shape{2}, {5, 7});+ test_case.add_expected_output<float>(+ Shape{2, 1, 32},+ {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ -0.144478f, -0.237336f, 0.711069f, -0.535928f, 1.651922f, -0.374727f, -0.852582f, 0.041705f,+ 0.216992f, 0.351200f, -0.297006f, -1.627405f, 0.174881f, 0.308194f, -0.926486f, -1.259599f,+ -0.583189f, -0.159735f, 0.217206f, -0.824776f, 1.395585f, -0.056766f, -0.237110f, 0.040226f,+ 0.187145f, 0.537626f, 0.466646f, -1.282028f, 0.024292f, 0.712578f, -0.142065f, -0.954660f});+ test_case.add_expected_output<float>(+ Shape{2, 1, 7, 16},+ {1.275024f, -0.812245f, -0.542313f, 0.749648f, 0.545369f, 0.070925f, 0.471956f, -1.363787f, 2.407830f,+ -2.142386f, 1.302553f, 3.378363f, 0.687877f, -1.185211f, 1.670577f, -0.962410f, -0.334826f, -0.522956f,+ 0.353223f, 1.455764f, 1.353745f, 1.045708f, -0.359332f, -0.191585f, -0.342627f, 0.686132f, 0.872864f,+ 1.095530f, -1.672361f, 0.165164f, -0.713202f, 0.905043f, 0.995493f, -0.110472f, -0.767061f, -0.134948f,+ -0.638231f, -0.673460f, 1.668942f, -1.240141f, -0.668144f, 0.447847f, -1.265060f, 0.144273f, -2.539755f,+ 1.092407f, 1.675443f, 0.693876f, 0.139870f, -0.614094f, 0.741214f, 0.313412f, 1.496415f, 0.741528f,+ 1.941468f, -0.633559f, 1.356501f, -0.236596f, -2.066535f, 1.490293f, 0.504847f, -0.213407f, 0.138077f,+ 2.092520f, -0.378638f, -0.479433f, 0.282109f, 0.420421f, 0.578601f, -0.827534f, -1.057137f, -1.707744f,+ 1.080002f, 0.833275f, 0.654531f, 0.201106f, -0.483115f, -1.611566f, 0.323874f, -0.213647f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.438845f, -0.648128f, 1.073442f, -0.273293f, -0.464913f,+ -0.243260f, -0.452986f, -1.725154f, -1.311847f, -0.333947f, 0.268144f, -2.358638f, 1.145367f, -2.474153f,+ -1.011840f, -0.109856f, -0.568023f, 1.372194f, 1.760667f, 0.892158f, 0.067302f, 0.918245f, 1.931988f,+ 1.236039f, 0.433323f, -0.212353f, 1.690878f, 0.097497f, -1.367717f, 1.185016f, 0.267758f, -1.029415f,+ 1.100571f, -0.238973f, -0.426142f, 1.357641f, 0.971457f, -0.702997f, 1.501098f, 1.400526f, -0.537457f,+ 0.707064f, -0.689078f, 0.488712f, 0.242408f, 1.762604f, 1.096596f, 0.211981f, -0.050298f, 0.200390f,+ -1.293308f, 0.292216f, -1.214751f, 0.498863f, -1.492733f, -1.235152f, -0.225115f, -0.727480f, 0.999360f,+ 1.600033f, 0.674497f, -1.272651f, 2.095673f, 0.117753f, 0.120974f, 0.688193f, -0.094003f, -0.649669f,+ -0.479761f, 1.536859f, -1.354322f, -0.712195f, 0.066348f, 0.816977f, -0.666364f, -0.567504f, -1.089522f,+ -1.644422f, 1.109130f, 0.169357f, -0.234812f, 0.864817f, -0.420304f, 0.304565f, 0.352500f, 1.004058f,+ 0.264515f, -1.468116f, -0.119449f, -0.867522f, -1.572752f, -0.076581f, -1.177887f, 0.087733f, 0.046017f,+ 0.723135f, 0.031420f, 1.669971f, 1.450923f, 0.439020f, 0.697815f, -0.337999f, -1.449093f, 0.139813f,+ 0.311885f, -0.571345f, 0.996925f, 0.407342f, -1.288939f, -0.407227f, 0.139224f, -0.672314f});+ test_case.add_expected_output<float>(+ Shape{2, 1, 7, 16},+ {-0.685991f, -0.602044f, -0.678653f, 0.082147f, 0.535397f, 0.690880f, 2.203624f, 0.258709f, -0.782121f,+ -0.169026f, 1.572640f, -2.204850f, 0.035475f, 1.455926f, -0.389976f, 0.057275f, 0.512134f, -1.073511f,+ 1.652816f, 0.156937f, -1.491666f, 1.408677f, -0.928610f, 1.504478f, -1.128435f, 1.082783f, -1.021420f,+ 2.116989f, 0.845145f, 1.833844f, -0.423084f, -0.425380f, 0.448387f, -0.712317f, 1.068330f, 0.107709f,+ -0.827633f, -0.334834f, -0.434023f, -0.230353f, 0.387177f, -0.728370f, 0.197996f, 0.078423f, -0.319137f,+ -1.617330f, 0.738758f, -0.723663f, -2.345493f, 0.853263f, 0.105235f, -0.258354f, 1.127409f, 2.999391f,+ -0.518910f, 1.944899f, -1.203207f, -1.123397f, 1.530601f, -0.286479f, -0.324314f, 1.867617f, 0.218157f,+ 0.141700f, 0.059535f, -1.217214f, 1.339954f, -0.481047f, 0.390373f, -0.170348f, -2.081453f, -0.241503f,+ -0.699831f, 3.040822f, 0.188978f, 0.619830f, -0.035367f, -1.556886f, -1.432997f, -1.121109f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.010473f, -1.095812f, -0.226064f, -0.425841f, -0.162053f,+ -1.170929f, 0.788263f, 1.593899f, -1.381148f, -0.119685f, -0.820775f, 0.488714f, 1.784580f, 1.880445f,+ -1.324462f, -1.154620f, -2.035255f, -1.007266f, 0.769484f, -2.595685f, 1.726362f, 1.714479f, 0.243105f,+ 0.215127f, 0.925098f, 0.466374f, 3.242254f, -1.589451f, -0.174766f, 1.841549f, 1.406225f, -1.406864f,+ 0.279213f, -0.825242f, 1.467296f, -0.297104f, 1.621692f, -0.729274f, -2.285827f, 0.023184f, -0.350618f,+ 0.573175f, -1.123489f, -0.506550f, -0.775737f, 1.363714f, -1.197976f, -1.085498f, 0.094936f, 0.395905f,+ 0.584635f, -0.267187f, 2.056289f, -0.501958f, -0.410833f, -0.041318f, 0.760315f, -0.018580f, -0.663263f,+ -2.975389f, 0.994211f, -1.152212f, -1.648420f, -1.654954f, -0.093160f, 2.703855f, -0.613348f, -1.056465f,+ 1.377396f, 0.284885f, 1.917743f, -0.292255f, -0.254493f, -0.659562f, -0.313390f, 0.006556f, -0.815581f,+ 2.180922f, -0.047599f, -0.150770f, 0.525306f, 0.193513f, -0.644901f, -0.887710f, -0.981003f, -2.048927f,+ 0.256401f, -3.232565f, -2.108511f, 1.050398f, -0.097115f, -0.837919f, -0.774198f, 1.051759f, 1.655747f,+ -0.096147f, -0.605500f, -0.556759f, -1.741645f, 1.483158f, 1.015569f, -1.269729f, -0.459088f, 1.614606f,+ 0.263957f, 2.027716f, -0.693600f, -0.635652f, 0.880623f, -1.126104f, -0.854420f, 0.035484f});+ test_case.run_with_tolerance_as_fp();+}++// Windowed cache: an idle single-token step (query_seqlens = 0) leaves the resident rows unchanged.+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_query_seqlens_sliding_window_idle_decode) {+ const auto model = convert_model("com.microsoft/gqa_query_seqlens_sliding_window_decode.onnx");+ const auto nan = std::numeric_limits<float>::quiet_NaN();+ auto test_case = ov::test::TestCase(model, s_device);+ test_case.add_input<float>(Shape{1, 1, 32},+ {nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,+ nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan});+ test_case.add_input<float>(Shape{1, 1, 16},+ {nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan});+ test_case.add_input<float>(Shape{1, 1, 16},+ {nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan});+ test_case.add_input<float>(+ Shape{1, 1, 4, 16},+ {-0.735420f, -2.352132f, -0.105137f, 1.058446f, -1.056985f, -0.165748f, 0.647240f, -1.235289f,+ 0.307702f, 0.490687f, 0.112803f, 1.337835f, -2.229840f, 0.321195f, 0.280433f, 1.232413f,+ 0.566844f, 0.583737f, -0.219653f, 0.986352f, -0.710385f, -0.033704f, 0.179886f, -1.599906f,+ -0.944826f, -0.852998f, 0.895438f, 0.967439f, -1.170174f, 0.796356f, 0.496066f, -0.226459f,+ -1.925212f, -0.496356f, 0.931818f, -0.335165f, 0.735086f, 0.545687f, 0.096996f, -0.792602f,+ 0.794702f, -0.860949f, 0.370744f, 1.322762f, 0.250633f, -0.445592f, 0.159246f, 3.811251f,+ 0.397137f, 0.677802f, -1.006077f, 0.055329f, 0.165066f, 1.507033f, -1.276394f, 0.375566f,+ -1.035591f, 0.051493f, 0.332971f, 0.468763f, -0.816297f, -2.428651f, 0.139713f, -0.221144f});+ test_case.add_input<float>(+ Shape{1, 1, 4, 16},+ {0.790308f, -0.037426f, -1.177983f, 1.017233f, 1.122269f, -0.455284f, 2.127623f, -0.566481f,+ -0.779623f, 1.210476f, -0.470101f, 0.892839f, 0.498565f, -0.779827f, -0.383811f, -0.570419f,+ 1.625311f, -0.479224f, -0.379097f, 1.021150f, -0.029792f, 0.594879f, -0.633937f, -0.599054f,+ -0.255425f, -0.345669f, -0.474950f, 1.139714f, -1.321009f, 0.779937f, -1.800832f, 0.592629f,+ 0.581112f, -0.211427f, -1.929929f, 1.669991f, 0.020253f, -2.344744f, 0.016774f, 0.929871f,+ -0.871827f, -0.308090f, 0.201969f, -1.408947f, -0.710237f, 0.466852f, 2.080658f, 1.048191f,+ 1.833178f, 0.142558f, -1.732681f, 0.134535f, -1.289570f, 1.197219f, 0.574528f, -1.396965f,+ 0.237134f, -0.214781f, 0.406789f, -1.228678f, -0.795671f, -2.198250f, -0.345258f, -3.070871f});+ test_case.add_input<int32_t>(Shape{1}, {5});+ test_case.add_input<int32_t>(Shape{}, {6});+ test_case.add_input<int32_t>(Shape{1}, {0});+ test_case.add_input<int64_t>(Shape{1}, {4});+ test_case.add_expected_output<float>(+ Shape{1, 1, 32},+ {0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,+ 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 4, 16},+ {-0.735420f, -2.352132f, -0.105137f, 1.058446f, -1.056985f, -0.165748f, 0.647240f, -1.235289f,+ 0.307702f, 0.490687f, 0.112803f, 1.337835f, -2.229840f, 0.321195f, 0.280433f, 1.232413f,+ 0.566844f, 0.583737f, -0.219653f, 0.986352f, -0.710385f, -0.033704f, 0.179886f, -1.599906f,+ -0.944826f, -0.852998f, 0.895438f, 0.967439f, -1.170174f, 0.796356f, 0.496066f, -0.226459f,+ -1.925212f, -0.496356f, 0.931818f, -0.335165f, 0.735086f, 0.545687f, 0.096996f, -0.792602f,+ 0.794702f, -0.860949f, 0.370744f, 1.322762f, 0.250633f, -0.445592f, 0.159246f, 3.811251f,+ 0.397137f, 0.677802f, -1.006077f, 0.055329f, 0.165066f, 1.507033f, -1.276394f, 0.375566f,+ -1.035591f, 0.051493f, 0.332971f, 0.468763f, -0.816297f, -2.428651f, 0.139713f, -0.221144f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 4, 16},+ {0.790308f, -0.037426f, -1.177983f, 1.017233f, 1.122269f, -0.455284f, 2.127623f, -0.566481f,+ -0.779623f, 1.210476f, -0.470101f, 0.892839f, 0.498565f, -0.779827f, -0.383811f, -0.570419f,+ 1.625311f, -0.479224f, -0.379097f, 1.021150f, -0.029792f, 0.594879f, -0.633937f, -0.599054f,+ -0.255425f, -0.345669f, -0.474950f, 1.139714f, -1.321009f, 0.779937f, -1.800832f, 0.592629f,+ 0.581112f, -0.211427f, -1.929929f, 1.669991f, 0.020253f, -2.344744f, 0.016774f, 0.929871f,+ -0.871827f, -0.308090f, 0.201969f, -1.408947f, -0.710237f, 0.466852f, 2.080658f, 1.048191f,+ 1.833178f, 0.142558f, -1.732681f, 0.134535f, -1.289570f, 1.197219f, 0.574528f, -1.396965f,+ 0.237134f, -0.214781f, 0.406789f, -1.228678f, -0.795671f, -2.198250f, -0.345258f, -3.070871f});+ test_case.run_with_tolerance_as_fp();+}++// Windowed cache: a single-token step with query_seqlens = 1 evicts and appends as a plain decode.+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_query_seqlens_sliding_window_decode) {+ const auto model = convert_model("com.microsoft/gqa_query_seqlens_sliding_window_decode.onnx");+ auto test_case = ov::test::TestCase(model, s_device);+ test_case.add_input<float>(+ Shape{1, 1, 32},+ {-1.176010f, -1.675877f, 1.189677f, -1.353264f, -1.603776f, -0.274002f, 1.012435f, -1.225247f,+ -0.637407f, 1.079155f, 1.345773f, 0.951369f, -0.327242f, -1.291195f, 1.052862f, -0.268626f,+ 0.892798f, 1.159710f, -0.419051f, -0.647760f, -0.047990f, 1.529014f, -0.667146f, -0.483604f,+ 0.379366f, -1.095309f, -1.155251f, -1.242736f, -0.888099f, 0.316417f, -0.771018f, 1.978663f});+ test_case.add_input<float>(Shape{1, 1, 16},+ {0.325534f,+ 0.017473f,+ 0.728808f,+ -0.048721f,+ 1.790936f,+ 1.145783f,+ 0.128518f,+ 0.350996f,+ 1.885239f,+ -1.291963f,+ 0.896549f,+ 0.394587f,+ -0.040936f,+ -0.674270f,+ -0.762355f,+ 1.215289f});+ test_case.add_input<float>(Shape{1, 1, 16},+ {1.560570f,+ -0.975584f,+ 0.238936f,+ -1.246308f,+ 0.369837f,+ 1.207849f,+ 1.782179f,+ 1.478890f,+ 1.051573f,+ -0.464264f,+ -0.082366f,+ 0.321527f,+ 0.057996f,+ -0.504767f,+ 1.920703f,+ -1.825270f});+ test_case.add_input<float>(+ Shape{1, 1, 4, 16},+ {0.842282f, 0.083647f, -0.717136f, -0.215149f, 1.909177f, 1.032557f, 1.380312f, 0.138083f,+ 0.123940f, 1.115519f, -1.300065f, 0.957614f, -1.152128f, -0.454451f, -0.980611f, 0.421597f,+ -0.604289f, 1.044649f, 2.138226f, 1.231245f, 0.068712f, -0.095559f, 1.804814f, -0.167775f,+ 0.648008f, 1.802481f, 0.871171f, -1.274905f, -1.776615f, 0.543686f, -0.945830f, -0.781297f,+ -0.704354f, -0.660872f, -0.866482f, -1.893691f, -0.740046f, -0.355779f, -0.103283f, -0.384233f,+ -0.147975f, 2.460142f, -0.683049f, 1.256650f, 1.867264f, -0.969937f, 0.166815f, 0.057893f,+ -0.657577f, 0.406426f, -2.004004f, -0.323489f, -0.156990f, 0.548061f, 0.317949f, -0.541432f,+ -0.652277f, -0.234219f, 0.849777f, -0.576473f, -0.269792f, -1.331634f, 0.269876f, -0.311019f});+ test_case.add_input<float>(+ Shape{1, 1, 4, 16},+ {-0.413233f, -0.135634f, -0.267258f, 0.405678f, 1.213868f, -1.489697f, 0.306468f, -0.167148f,+ -1.027391f, 0.123602f, -0.662085f, -0.336829f, -0.343122f, 0.224783f, -1.076613f, 1.108196f,+ 0.505042f, 0.374535f, -0.757373f, 0.476053f, -0.851154f, 0.001054f, 2.007378f, -0.040888f,+ 1.054849f, 0.061097f, -2.260695f, 0.127462f, 1.119862f, 0.711444f, -0.449443f, 0.739543f,+ 1.075486f, 0.964970f, 0.380224f, -1.182293f, 0.795458f, 0.763872f, -0.387267f, -0.154403f,+ -0.045802f, -0.112358f, 0.125178f, 0.117042f, -1.107254f, -0.558209f, 0.337880f, -1.393851f,+ 2.286380f, 0.123591f, -0.071135f, -0.759327f, 1.076743f, 0.284443f, -0.423837f, -0.640758f,+ -1.705208f, -0.715107f, -0.971080f, 0.951486f, 1.820630f, -0.710128f, 2.163108f, 1.241169f});+ test_case.add_input<int32_t>(Shape{1}, {6});+ test_case.add_input<int32_t>(Shape{}, {7});+ test_case.add_input<int32_t>(Shape{1}, {1});+ test_case.add_input<int64_t>(Shape{1}, {4});+ test_case.add_expected_output<float>(+ Shape{1, 1, 32},+ {1.167511f, 0.723988f, 0.162383f, -0.902348f, 0.595709f, 0.609000f, -0.007650f, -0.159122f,+ -0.082006f, -0.176173f, -0.348796f, 0.232208f, -0.391942f, -0.402972f, 0.508891f, -0.771347f,+ 1.589237f, -0.510469f, 0.078163f, -0.964567f, 0.420461f, 0.865420f, 1.224496f, 0.789720f,+ 0.402342f, -0.449399f, -0.484362f, 0.429119f, 0.492517f, -0.429609f, 1.660927f, -0.881997f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 4, 16},+ {-0.604289f, 1.044649f, 2.138226f, 1.231245f, 0.068712f, -0.095559f, 1.804814f, -0.167775f,+ 0.648008f, 1.802481f, 0.871171f, -1.274905f, -1.776615f, 0.543686f, -0.945830f, -0.781297f,+ -0.704354f, -0.660872f, -0.866482f, -1.893691f, -0.740046f, -0.355779f, -0.103283f, -0.384233f,+ -0.147975f, 2.460142f, -0.683049f, 1.256650f, 1.867264f, -0.969937f, 0.166815f, 0.057893f,+ -0.657577f, 0.406426f, -2.004004f, -0.323489f, -0.156990f, 0.548061f, 0.317949f, -0.541432f,+ -0.652277f, -0.234219f, 0.849777f, -0.576473f, -0.269792f, -1.331634f, 0.269876f, -0.311019f,+ 0.325534f, 0.017473f, 0.728808f, -0.048721f, 1.790936f, 1.145783f, 0.128518f, 0.350996f,+ 1.885239f, -1.291963f, 0.896549f, 0.394587f, -0.040936f, -0.674270f, -0.762355f, 1.215289f});+ test_case.add_expected_output<float>(+ Shape{1, 1, 4, 16},+ {0.505042f, 0.374535f, -0.757373f, 0.476053f, -0.851154f, 0.001054f, 2.007378f, -0.040888f,+ 1.054849f, 0.061097f, -2.260695f, 0.127462f, 1.119862f, 0.711444f, -0.449443f, 0.739543f,+ 1.075486f, 0.964970f, 0.380224f, -1.182293f, 0.795458f, 0.763872f, -0.387267f, -0.154403f,+ -0.045802f, -0.112358f, 0.125178f, 0.117042f, -1.107254f, -0.558209f, 0.337880f, -1.393851f,+ 2.286380f, 0.123591f, -0.071135f, -0.759327f, 1.076743f, 0.284443f, -0.423837f, -0.640758f,+ -1.705208f, -0.715107f, -0.971080f, 0.951486f, 1.820630f, -0.710128f, 2.163108f, 1.241169f,+ 1.560570f, -0.975584f, 0.238936f, -1.246308f, 0.369837f, 1.207849f, 1.782179f, 1.478890f,+ 1.051573f, -0.464264f, -0.082366f, 0.321527f, 0.057996f, -0.504767f, 1.920703f, -1.825270f});+ test_case.run_with_tolerance_as_fp();+}diff --git a/src/plugins/intel_gpu/src/plugin/transformations/group_query_attention_decomposition.cpp b/src/plugins/intel_gpu/src/plugin/transformations/group_query_attention_decomposition.cppindex 9baeb725f7f..e64844e9b95 100644--- a/src/plugins/intel_gpu/src/plugin/transformations/group_query_attention_decomposition.cpp+++ b/src/plugins/intel_gpu/src/plugin/transformations/group_query_attention_decomposition.cpp@@ -10,6 +10,7 @@#include "intel_gpu/op/sdpa.hpp"#include "intel_gpu/op/stateless_kv.hpp"+#include "openvino/op/add.hpp"#include "openvino/op/broadcast.hpp"#include "openvino/op/convert.hpp"#include "openvino/op/group_query_attention.hpp"@@ -126,6 +127,15 @@ ov::Output<ov::Node> GroupQueryAttentionDecomposition::make_qk_norm(const ov::Oureturn register_new_node<ov::op::internal::RMS>(input, weight, epsilon, input.get_element_type());}+namespace {+// StatelessKV has nothing to append to for a 0-row past; a free predicate (vs. an inline shape probe) keeps the+// fallback condition self-documenting and easy to narrow once StatelessKV can roll a 0-row past with query_seqlens.+bool has_empty_past(const ov::Output<ov::Node>& past_key) {+ const auto& past_ps = past_key.get_partial_shape();+ return past_ps.rank().is_static() && past_ps[2].is_static() && past_ps[2].get_length() == 0;+}+} // namespace+GroupQueryAttentionDecomposition::KVCacheOutputs GroupQueryAttentionDecomposition::construct_kvcache(const std::shared_ptr<ov::op::internal::GroupQueryAttention>& node,const ov::Output<ov::Node>& past_key,@@ -142,6 +152,25 @@ GroupQueryAttentionDecomposition::KVCacheOutputs GroupQueryAttentionDecompositioauto& metadata = static_cast<StatelessKVMetadata&>(metadata_);+ // StatelessKV rolls a windowed cache by its present length, which a right-padded chunk (query_seqlens) would+ // overstate; the generic staging path writes back only the valid rows.+ const bool query_seqlens = node->has_query_seqlens();+ if (query_seqlens && node->get_sliding_window_cache()) {+ // GPU SDPA broadcasts the KV heads natively; the explicit chain groups them itself.+ metadata.should_broadcast_kv = false;+ return ov::pass::GroupQueryAttentionDecomposition::construct_kvcache(node, past_key, past_value, key, value, seqlens_1d, kv_seqlen,+ past_seqlen, current_seqlen_scalar, metadata_);+ }+ // A padded chunk with an empty past has nothing for StatelessKV to append to; keep the generic present sizing.+ // A declared fixed capacity has the same problem when total_sequence_length exceeds it: StatelessKV's own+ // shape inference only grows past a static past_rows when its update offset folds to a constant (it almost+ // never does for a runtime seqlens_k), so it would silently keep producing a past_rows-sized buffer while the+ // op's own shape inference (fixed up for this case) declares max(past_rows, total_sequence_length).+ if (query_seqlens && (has_empty_past(past_key) || node->has_fixed_kv_capacity())) {+ return ov::pass::GroupQueryAttentionDecomposition::construct_kvcache(node, past_key, past_value, key, value, seqlens_1d, kv_seqlen,+ past_seqlen, current_seqlen_scalar, metadata_);+ }+const bool need_qk_output = node->get_qk_output() != ov::op::internal::GroupQueryAttentionQKOutput::NONE;const bool use_explicit_attention = node->get_softcap() > 0.0f || need_qk_output;bool can_fuse_transpose_v = m_sdpa_support_immad && !use_explicit_attention;@@ -160,8 +189,12 @@ GroupQueryAttentionDecomposition::KVCacheOutputs GroupQueryAttentionDecompositioKVCacheOutputs outputs;const bool sliding_window = node->get_sliding_window_cache();const int64_t window_size = sliding_window ? node->get_local_window_size() : 0;+ // StatelessKV takes the present length and writes the S new rows at present - S. A right-padded chunk writes them+ // at its past P = total - Q, so it passes P + S; SDPA's lower-right causal mask then lets row s see keys <= P + s.+ const ov::Output<ov::Node> present_len =+ query_seqlens ? register_new_node<v1::Add>(past_seqlen, current_seqlen_scalar)->output(0) : seqlens_1d;const auto make_stateless_kv = [&](const ov::Output<ov::Node>& past, const ov::Output<ov::Node>& current, int64_t concat_axis) {- return register_new_node<op::StatelessKV>(past, current, seqlens_1d, concat_axis, true, window_size);+ return register_new_node<op::StatelessKV>(past, current, present_len, concat_axis, true, window_size);};const auto key_cache = make_stateless_kv(past_key, key, 2);diff --git a/src/plugins/intel_gpu/tests/unit/transformations/group_query_attention_decomposition_test.cpp b/src/plugins/intel_gpu/tests/unit/transformations/group_query_attention_decomposition_test.cppindex 0ea87fcbc32..a6e27dbee29 100644--- a/src/plugins/intel_gpu/tests/unit/transformations/group_query_attention_decomposition_test.cpp+++ b/src/plugins/intel_gpu/tests/unit/transformations/group_query_attention_decomposition_test.cpp@@ -13,8 +13,9 @@#include "intel_gpu/op/sdpa.hpp"#include "intel_gpu/op/stateless_kv.hpp"-#include "openvino/op/broadcast.hpp"#include "openvino/core/model.hpp"+#include "openvino/op/add.hpp"+#include "openvino/op/broadcast.hpp"#include "openvino/op/constant.hpp"#include "openvino/op/group_query_attention.hpp"#include "openvino/op/matmul.hpp"@@ -59,15 +60,19 @@ struct GQAConfig {QKOutput qk_output = QKOutput::NONE;ov::PartialShape key_scale_shape{1};ov::PartialShape value_scale_shape{1};+ // Right-padded query chunk (ONNX query_seqlens, input 16): when set, query/key/value get sequence_length+ // rows (S > 1) and a query_seqlens Parameter is wired in, exercising the StatelessKV P+S present-length path.+ bool query_seqlens = false;+ int64_t sequence_length = 1;};std::shared_ptr<ov::Model> make_gqa_model(const GQAConfig& cfg) {const auto f32 = ov::element::f32;const auto past_len = cfg.static_past_cache ? ov::Dimension{128} : ov::Dimension::dynamic();- auto query = std::make_shared<ov::op::v0::Parameter>(f32, ov::PartialShape{1, num_heads, 1, head_size});- auto key = std::make_shared<ov::op::v0::Parameter>(f32, ov::PartialShape{1, kv_num_heads, 1, head_size});- auto value = std::make_shared<ov::op::v0::Parameter>(f32, ov::PartialShape{1, kv_num_heads, 1, head_size});+ auto query = std::make_shared<ov::op::v0::Parameter>(f32, ov::PartialShape{1, num_heads, cfg.sequence_length, head_size});+ auto key = std::make_shared<ov::op::v0::Parameter>(f32, ov::PartialShape{1, kv_num_heads, cfg.sequence_length, head_size});+ auto value = std::make_shared<ov::op::v0::Parameter>(f32, ov::PartialShape{1, kv_num_heads, cfg.sequence_length, head_size});const auto cache_type = cfg.kv_cache_bit_width ? cfg.cache_type : f32;const auto cache_head_size = cfg.kv_cache_bit_width == 4 ? head_size / 2 : head_size;auto past_key = std::make_shared<ov::op::v0::Parameter>(cache_type, ov::PartialShape{1, kv_num_heads, past_len, cache_head_size});@@ -82,7 +87,9 @@ std::shared_ptr<ov::Model> make_gqa_model(const GQAConfig& cfg) {auto seqlens_k = std::make_shared<ov::op::v0::Parameter>(ov::element::i32, ov::PartialShape{1});auto total_sequence_length = std::make_shared<ov::op::v0::Parameter>(ov::element::i32, ov::PartialShape{});- ov::OutputVector inputs(14);+ // query_seqlens (input 16) is appended only when wired, matching the ONNX FE: models without it keep a+ // 16-input op instead of a 17-input op with an empty placeholder at 16.+ ov::OutputVector inputs(cfg.query_seqlens ? 17 : 16);inputs[0] = query;inputs[1] = key;inputs[2] = value;@@ -90,11 +97,17 @@ std::shared_ptr<ov::Model> make_gqa_model(const GQAConfig& cfg) {inputs[4] = gqa_past_value;inputs[5] = seqlens_k;inputs[6] = total_sequence_length;- for (size_t i = 7; i <= 13; ++i) {+ for (size_t i = 7; i <= 15; ++i) {inputs[i] = ov::op::v0::Constant::create(f32, ov::Shape{0}, {});}ov::ParameterVector parameters{query, key, value, past_key, past_value, seqlens_k, total_sequence_length};+ if (cfg.query_seqlens) {+ auto query_seqlens = std::make_shared<ov::op::v0::Parameter>(ov::element::i32, ov::PartialShape{1});+ inputs[16] = query_seqlens;+ parameters.push_back(query_seqlens);+ }+if (cfg.attention_bias) {auto attention_bias = std::make_shared<ov::op::v0::Parameter>(f32, ov::PartialShape{1, 1, 1, past_len});inputs[10] = attention_bias;@@ -343,6 +356,72 @@ TEST(GQADecompositionTest, dynamic_input_uses_stateless_kv) {expect_stateless_kv_cache_connections(cfg);}+// Right-padded query chunk (query_seqlens, S=4 > Q): a static single batch stays on StatelessKV's P + S+// present-length path (construct_kvcache), not the generic windowed/dynamic-batch fallback. Guards against the+// present length silently reverting to plain seqlens_1d and losing the padded-tail offset.+TEST(GQADecompositionTest, padded_query_uses_stateless_kv_present_length) {+ GQAConfig cfg;+ // A declared fixed (static) capacity instead falls back to the generic writer (see+ // padded_query_fixed_capacity_falls_back_to_generic_cache below) -- keep the past dynamic here so this+ // config stays on the path it is meant to exercise.+ cfg.query_seqlens = true;+ cfg.sequence_length = 4;++ const auto model = decompose_gqa_model(cfg);++ std::shared_ptr<ov::intel_gpu::op::SDPA> sdpa;+ std::vector<std::shared_ptr<ov::intel_gpu::op::StatelessKV>> statelesskvs;+ for (const auto& node : model->get_ordered_ops()) {+ if (auto current_sdpa = ov::as_type_ptr<ov::intel_gpu::op::SDPA>(node)) {+ sdpa = current_sdpa;+ }+ if (auto stateless_kv = ov::as_type_ptr<ov::intel_gpu::op::StatelessKV>(node)) {+ statelesskvs.emplace_back(std::move(stateless_kv));+ }+ }+ ASSERT_NE(sdpa, nullptr);+ EXPECT_TRUE(sdpa->get_causal());+ EXPECT_EQ(sdpa->get_causal_mask_alignment(), ov::intel_gpu::op::SDPA::CausalMaskAlignment::LOWER_RIGHT);++ ASSERT_EQ(statelesskvs.size(), 2u);+ for (const auto& stateless_kv : statelesskvs) {+ // present_len (input 2) must be P + S (an Add), not the plain total seqlens_1d a non-padded chunk uses;+ // StatelessKV would otherwise roll the cache by the full chunk length and drop the padded-tail offset.+ EXPECT_TRUE(ov::is_type<ov::op::v1::Add>(stateless_kv->input_value(2).get_node()))+ << "StatelessKV present length is not P + S for a right-padded query chunk";+ }+}++// A declared fixed (static) capacity falls back to the generic (non-StatelessKV) cache writer instead: the+// capacity can need growing past its static size (ORT's max(past_rows, total_sequence_length)), which+// StatelessKV's own shape inference does not do for a runtime present length. The generic writer's present+// buffer can then hold capacity slack beyond the true past + current total, so this must also take an+// explicit (mask-based) SDPA rather than the native is_causal + LOWER_RIGHT alignment, which assumes the+// query sits at the buffer's tail -- untrue once there is capacity slack.+TEST(GQADecompositionTest, padded_query_fixed_capacity_falls_back_to_generic_cache) {+ GQAConfig cfg;+ cfg.static_past_cache = true;+ cfg.query_seqlens = true;+ cfg.sequence_length = 4;++ const auto model = decompose_gqa_model(cfg);++ std::shared_ptr<ov::intel_gpu::op::SDPA> sdpa;+ size_t statelesskv_count = 0;+ for (const auto& node : model->get_ordered_ops()) {+ if (auto current_sdpa = ov::as_type_ptr<ov::intel_gpu::op::SDPA>(node)) {+ sdpa = current_sdpa;+ }+ if (ov::is_type<ov::intel_gpu::op::StatelessKV>(node)) {+ ++statelesskv_count;+ }+ }+ EXPECT_EQ(statelesskv_count, 0u) << "a fixed-capacity padded chunk must not use StatelessKV's present-length path";++ ASSERT_NE(sdpa, nullptr);+ EXPECT_FALSE(sdpa->get_causal()) << "a fixed-capacity padded chunk must take an explicit mask, not the native LOWER_RIGHT alignment";+}+TEST(GQADecompositionTest, transpose_v_fused) {GQAConfig cfg;cfg.transpose_v = true;