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
[ONNX FE][Transformation] GroupQueryAttention refine work for static shape, make valid kv left aligned [use scatter update] (#34980)
bopeng1234d978369b0120
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 556893fd52c..58a805b7826 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@@ -21,6 +21,7 @@#include "openvino/op/range.hpp"#include "openvino/op/reshape.hpp"#include "openvino/op/scaled_dot_product_attention.hpp"+#include "openvino/op/scatter_update.hpp"#include "openvino/op/select.hpp"#include "openvino/op/shape_of.hpp"#include "openvino/op/slice.hpp"@@ -125,27 +126,33 @@ ov::OutputVector ov::pass::GroupQueryAttentionDecomposition::decompose(}const auto is_static_input = K.get_partial_shape().is_static() && past_key.get_partial_shape().is_static();- 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);- };if (is_static_input) {- // Cache memory layout for static shapes:- // - Keys: [0, ..., 0, past_key[0], ..., past_key[N-1], K[0], ..., K[M-1]]- // - Values: [0, ..., 0, past_value[0], ..., past_value[N-1], V[0], ..., V[M-1]]- // Here, padding 0 are lay on front of the buffer.- // M = current_seqlen, which is always 1 for the KV cache model.- const auto current_kv_len_const = register_new_node(- v0::Constant::create(ov::element::i64, ov::Shape{1}, {K.get_partial_shape()[2].get_length()}));- const auto past_kv_len_const = register_new_node(- v0::Constant::create(ov::element::i64, ov::Shape{1}, {past_key.get_partial_shape()[2].get_length()}));- past_key = register_new_node<v8::Slice>(past_key, current_kv_len_const, past_kv_len_const, one, two);- past_value = register_new_node<v8::Slice>(past_value, current_kv_len_const, past_kv_len_const, one, two);+ // static design for GQA (KV cache is static max length, valid KVs are left align)+ // inputs are:+ // 1. past_key/past_value: [1, num_heads, max_seq_len, head_size], data is in the front along axis 2, [P0, P1,+ // ..., Pn, 0, 0, ...]+ // 2. current K/V: [1, num_heads, current_kv_len, head_size], data is in the front along axis 2, [C0, C1, ...,+ // Ck, 0, 0, ...]+ // Output present_key/present_value has the same shape with past_key/past_value, but with data in order [P0, P1,+ // ..., Pn, C0, C1, ..., Ck, 0, 0, ...]+ //+ // Use ScatterUpdate to scatter insert Current into Past+ // Insert current K/V at the correct position [past_seqlen, past_seqlen+curr_seqlen].+ std::shared_ptr<ov::Node> scatter_idx =+ register_new_node<v4::Range>(zero_without_shape, curr_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}));+ K = register_new_node<v3::ScatterUpdate>(past_key, scatter_idx, K, scatter_axis);+ V = register_new_node<v3::ScatterUpdate>(past_value, scatter_idx, V, scatter_axis);} 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);+ };past_key = register_new_node<v8::Slice>(past_key, zero, past_seqlen, one, two);past_value = register_new_node<v8::Slice>(past_value, zero, past_seqlen, one, two);+ K = construct_kv_cache(past_key, K);+ V = construct_kv_cache(past_value, V);}- K = construct_kv_cache(past_key, K);- V = construct_kv_cache(past_value, V);ov::Output<ov::Node> present_k = K;ov::Output<ov::Node> present_v = V;@@ -187,12 +194,7 @@ ov::OutputVector ov::pass::GroupQueryAttentionDecomposition::decompose(std::shared_ptr<ov::Node> vert_range =register_new_node<v4::Range>(zero_without_shape, curr_seqlen_scalar, one_without_shape, ov::element::i64);vert_range = register_new_node<v0::Unsqueeze>(vert_range, one);- if (is_static_input) {- const auto past_k_node_len = get_dimensions(past_key.get_node_shared_ptr(), {2});- vert_range = register_new_node<v1::Add>(vert_range, past_k_node_len);- } else {- vert_range = register_new_node<v1::Add>(vert_range, past_seqlen);- }+ vert_range = register_new_node<v1::Add>(vert_range, past_seqlen);const auto triu = register_new_node<v1::Greater>(hori_range, vert_range);const auto typed_zero = register_new_node(v0::Constant::create(T, ov::Shape{}, {0}));@@ -205,14 +207,6 @@ ov::OutputVector ov::pass::GroupQueryAttentionDecomposition::decompose(minus_inf =register_new_node(v0::Constant::create(T, ov::Shape{}, {std::numeric_limits<ov::float16>::lowest()}));mask = register_new_node<v1::Select>(triu, minus_inf, typed_zero);-- if (is_static_input) {- const auto padding_len = register_new_node<v1::Subtract>(concat_kv_len, seqlens_1d);- const auto padding_mask_vert_shape = register_new_node<v0::Concat>(ov::NodeVector{current_seqlen, one}, 0);- const auto padding_mask_vert = register_new_node<v3::Broadcast>(padding_len, padding_mask_vert_shape);- const auto padding_mask = register_new_node<v1::GreaterEqual>(hori_range, padding_mask_vert);- mask = register_new_node<v1::Select>(padding_mask, mask, minus_inf);- }}std::shared_ptr<ov::Node> qga_output;diff --git a/src/frontends/onnx/tests/models/com.microsoft/gqa_static_rotary.prototxt b/src/frontends/onnx/tests/models/com.microsoft/gqa_static_rotary.prototxtnew file mode 100644index 00000000000..fea3e38e50a--- /dev/null+++ b/src/frontends/onnx/tests/models/com.microsoft/gqa_static_rotary.prototxt@@ -0,0 +1,191 @@+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"+ output: "output"+ output: "present_key"+ output: "present_value"+ 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: "local_window_size"+ i: -1+ type: INT+ }+ attribute {+ name: "num_heads"+ i: 2+ type: INT+ }+ attribute {+ name: "rotary_interleaved"+ i: 0+ type: INT+ }+ attribute {+ name: "smooth_softmax"+ i: 0+ type: INT+ }+ attribute {+ name: "softcap"+ f: 0+ type: FLOAT+ }+ domain: "com.microsoft"+ }+ name: "GroupQueryAttention_Static_Graph"+ 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 }+ dim { dim_value: 1 }+ }+ }+ }+ }+ input {+ name: "total_sequence_length"+ type {+ tensor_type {+ elem_type: 6+ shape {+ }+ }+ }+ }+ input {+ name: "cos_cache"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim { dim_value: 8 }+ dim { dim_value: 8 }+ }+ }+ }+ }+ input {+ name: "sin_cache"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim { dim_value: 8 }+ dim { dim_value: 8 }+ }+ }+ }+ }+ output {+ name: "output"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim { dim_value: 1 }+ dim { dim_value: 1 }+ dim { dim_value: 32 }+ }+ }+ }+ }+ output {+ name: "present_key"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim { dim_value: 1 }+ dim { dim_value: 1 }+ dim { dim_value: 8 }+ dim { dim_value: 16 }+ }+ }+ }+ }+ output {+ name: "present_value"+ type {+ tensor_type {+ elem_type: 1+ shape {+ dim { dim_value: 1 }+ dim { dim_value: 1 }+ dim { dim_value: 8 }+ dim { dim_value: 16 }+ }+ }+ }+ }+}+opset_import {+ version: 11+}+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 555c15fc6d6..79e9426ae10 100644--- a/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp+++ b/src/frontends/onnx/tests/onnx_import_com_microsoft.in.cpp@@ -3108,6 +3108,129 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_minimum_inputs_passes) {test_case.run_with_tolerance_as_fp();}+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_static_rotary) {+ const auto model = convert_model("com.microsoft/gqa_static_rotary.onnx");++ // Packed QKV input [1, 1, 64]: Q(2*16) + K(1*16) + V(1*16)+ std::vector<float> query = {+ -1.1258f, -1.1524f, -0.2506f, -0.4339f, 0.8487f, 0.6920f, -0.3160f, -2.1152f, 0.3223f, -1.2633f, 0.3500f,+ 0.3081f, 0.1198f, 1.2377f, 1.1168f, -0.2473f, -1.3527f, -1.6959f, 0.5667f, 0.7935f, 0.5988f, -1.5551f,+ -0.3414f, 1.8530f, 0.7502f, -0.5855f, -0.1734f, 0.1835f, 1.3894f, 1.5863f, 0.9463f, -0.8437f, 1.6459f,+ -1.3602f, 0.3446f, 0.5199f, -2.6133f, -1.6965f, -0.2282f, 0.2800f, 0.2469f, 0.0769f, 0.3380f, 0.4544f,+ 0.4569f, -0.8654f, 0.7813f, -0.9268f, -0.2188f, -2.4351f, -0.0729f, -0.0340f, 0.9625f, 0.3492f, -0.9215f,+ -0.0562f, -0.6227f, -0.4637f, 1.9218f, -0.4025f, 0.1239f, 1.1648f, 0.9234f, 1.3873f,+ };++ // Past KV [1, 1, 8, 16]: left-aligned, first 4 seqlen valid, last 4 zeros+ std::vector<float> past_key = {+ -0.6136f, 0.0316f, -0.4927f, 0.2484f, 0.4397f, 0.1124f, 0.6408f, 0.4412f, -0.1023f, 0.7924f, -0.2897f,+ 0.0525f, 0.5229f, 2.3022f, -1.4689f, -1.5867f, 0.2300f, 0.5100f, -0.3200f, 0.1100f, 0.7800f, -0.4500f,+ 0.6700f, 0.3300f, -0.1200f, 0.8900f, -0.5600f, 0.4400f, 0.2100f, -0.7800f, 0.9300f, -0.1500f, 0.4100f,+ -0.2300f, 0.8500f, -0.6100f, 0.1900f, 0.7200f, -0.3800f, 0.5500f, -0.4700f, 0.6300f, -0.1800f, 0.9100f,+ -0.2700f, 0.3600f, -0.8100f, 0.4800f, 0.3500f, -0.6500f, 0.7100f, 0.2200f, -0.8900f, 0.4300f, -0.1600f,+ 0.5800f, -0.7300f, 0.2800f, 0.6400f, -0.5200f, 0.1400f, -0.3300f, 0.8700f, -0.4100f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ };+ std::vector<float> past_value = {+ -0.5692f, 0.9200f, 1.1108f, 1.2899f, -1.4782f, 2.5672f, -0.4731f, 0.3356f, -1.6293f, -0.5497f, -0.4798f,+ -0.4997f, -1.0670f, 1.1149f, -0.1407f, 0.8058f, 0.1500f, -0.3200f, 0.7800f, 0.4500f, -0.6100f, 0.2800f,+ 0.9300f, -0.1200f, 0.5400f, -0.8700f, 0.3100f, 0.6600f, -0.2300f, 0.4100f, -0.7500f, 0.1800f, 0.6200f,+ -0.4100f, 0.2700f, -0.8300f, 0.5500f, 0.1300f, -0.6800f, 0.9100f, -0.3500f, 0.7400f, -0.1600f, 0.4800f,+ -0.9200f, 0.2100f, 0.6300f, -0.5700f, 0.8400f, -0.2600f, 0.3900f, 0.7100f, -0.1500f, 0.5200f, -0.8800f,+ 0.3300f, -0.4300f, 0.6700f, -0.5100f, 0.2400f, -0.7600f, 0.1100f, 0.8500f, -0.3700f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ };++ // seqlens_k = 4 means 4 valid past tokens (positions 0-3)+ std::vector<int> seqlens_k = {4};+ std::vector<int> total_sequence_length = {8};++ // cos/sin cache [8, 8] (max_seq_len=8, head_size/2=8)+ std::vector<float> cos_cache = {+ -0.2509198f, 0.9014286f, 0.4639879f, 0.1973170f, -0.6879627f, -0.6880109f, -0.8838328f, 0.7323523f,+ 0.2022300f, 0.4161451f, -0.9588310f, 0.9398197f, 0.6648853f, -0.5753218f, -0.6363501f, -0.6331910f,+ -0.3915155f, 0.0495129f, -0.1361100f, -0.4175417f, 0.2237058f, -0.7210123f, -0.4157107f, -0.2672763f,+ -0.0878600f, 0.5703519f, -0.6006525f, 0.0284689f, 0.1848291f, -0.9070992f, 0.2150897f, -0.6589518f,+ -0.8698968f, 0.8977711f, 0.9312640f, 0.6167947f, -0.3907725f, -0.8046558f, 0.3684660f, -0.1196950f,+ -0.7559235f, -0.0096462f, -0.9312230f, 0.8186408f, -0.4824400f, 0.3250446f, -0.3765779f, 0.0401360f,+ 0.0934206f, -0.6302911f, 0.9391692f, 0.5502657f, 0.8789979f, 0.7896547f, 0.1958000f, 0.8437485f,+ -0.8230150f, -0.6080343f, -0.9095454f, -0.3493393f, -0.2226454f, -0.4573019f, 0.6574750f, -0.2864934f,+ };+ std::vector<float> sin_cache = {+ -0.4381310f, 0.0853922f, -0.7181516f, 0.6043940f, -0.8508987f, 0.9737739f, 0.5444896f, -0.6025686f,+ -0.9889557f, 0.6309229f, 0.4137147f, 0.4580143f, 0.5425407f, -0.8519107f, -0.2830685f, -0.7682619f,+ 0.7262068f, 0.2465962f, -0.3382039f, -0.8728833f, -0.3780354f, -0.3496334f, 0.4592124f, 0.2751150f,+ 0.7744255f, -0.0555701f, -0.7608115f, 0.4264896f, 0.5215701f, 0.1225544f, 0.5419344f, -0.0124088f,+ 0.0454657f, -0.1449180f, -0.9491618f, -0.7842171f, -0.9371417f, 0.2728208f, -0.3712880f, 0.0171414f,+ 0.8151330f, -0.5014156f, -0.1792341f, 0.5111023f, -0.5424037f, -0.8460402f, -0.4204971f, -0.6775574f,+ 0.8593953f, 0.6162407f, 0.2668075f, 0.7429212f, 0.6073442f, -0.6268599f, 0.7851180f, 0.0786845f,+ 0.6148803f, 0.7921826f, -0.3639930f, -0.7798961f, -0.5441297f, -0.1457844f, 0.6360295f, 0.7214612f,+ };++ // Expected output [1, 1, 32]+ std::vector<float> expected_output = {+ 0.4162956f, -0.4182589f, 0.4727696f, 0.2936685f, -0.1128318f, 0.5199768f, -0.3651099f, 0.3073604f,+ -0.2850454f, 0.1067962f, -0.0051489f, 0.2774143f, -0.6051727f, 0.3807620f, 0.3404019f, -0.0230611f,+ 0.3233508f, -0.7579141f, 0.3853467f, 0.1999806f, 0.0748156f, 0.4330993f, -0.3911937f, 0.2431847f,+ -0.2730540f, -0.0074681f, 0.3233708f, 0.2087932f, -0.4696053f, 0.4899607f, 0.3912313f, 0.1830239f,+ };++ // Expected present_key [1, 1, 8, 16]: past seqlen 0-3 unchanged, seqlen 4 = K_rotary, seqlen 5-7 = 0+ std::vector<float> expected_present_key = {+ -0.6136f, 0.0316f, -0.4927f, 0.2484f, 0.4397f, 0.1124f, 0.6408f, 0.4412f, -0.1023f, 0.7924f, -0.2897f,+ 0.0525f, 0.5229f, 2.3022f, -1.4689f, -1.5867f, 0.2300f, 0.5100f, -0.3200f, 0.1100f, 0.7800f, -0.4500f,+ 0.6700f, 0.3300f, -0.1200f, 0.8900f, -0.5600f, 0.4400f, 0.2100f, -0.7800f, 0.9300f, -0.1500f, 0.4100f,+ -0.2300f, 0.8500f, -0.6100f, 0.1900f, 0.7200f, -0.3800f, 0.5500f, -0.4700f, 0.6300f, -0.1800f, 0.9100f,+ -0.2700f, 0.3600f, -0.8100f, 0.4800f, 0.3500f, -0.6500f, 0.7100f, 0.2200f, -0.8900f, 0.4300f, -0.1600f,+ 0.5800f, -0.7300f, 0.2800f, 0.6400f, -0.5200f, 0.1400f, -0.3300f, 0.8700f, -0.4100f, -1.4430f, -1.2100f,+ 0.6417f, 0.6770f, 1.4494f, 1.6012f, 0.2060f, -0.0176f, -0.1399f, 0.2662f, -0.0123f, -0.1274f, 2.2705f,+ 0.2335f, 0.3726f, 0.1157f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ };++ // Expected present_value [1, 1, 8, 16]: past seqlen 0-3 unchanged, seqlen 4 = V, seqlen 5-7 = 0+ std::vector<float> expected_present_value = {+ -0.5692f, 0.9200f, 1.1108f, 1.2899f, -1.4782f, 2.5672f, -0.4731f, 0.3356f, -1.6293f, -0.5497f, -0.4798f,+ -0.4997f, -1.0670f, 1.1149f, -0.1407f, 0.8058f, 0.1500f, -0.3200f, 0.7800f, 0.4500f, -0.6100f, 0.2800f,+ 0.9300f, -0.1200f, 0.5400f, -0.8700f, 0.3100f, 0.6600f, -0.2300f, 0.4100f, -0.7500f, 0.1800f, 0.6200f,+ -0.4100f, 0.2700f, -0.8300f, 0.5500f, 0.1300f, -0.6800f, 0.9100f, -0.3500f, 0.7400f, -0.1600f, 0.4800f,+ -0.9200f, 0.2100f, 0.6300f, -0.5700f, 0.8400f, -0.2600f, 0.3900f, 0.7100f, -0.1500f, 0.5200f, -0.8800f,+ 0.3300f, -0.4300f, 0.6700f, -0.5100f, 0.2400f, -0.7600f, 0.1100f, 0.8500f, -0.3700f, -0.2188f, -2.4351f,+ -0.0729f, -0.0340f, 0.9625f, 0.3492f, -0.9215f, -0.0562f, -0.6227f, -0.4637f, 1.9218f, -0.4025f, 0.1239f,+ 1.1648f, 0.9234f, 1.3873f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f, 0.0000f,+ };++ auto test_case = ov::test::TestCase(model, s_device);+ test_case.add_input<float>(Shape{1, 1, 64}, query);+ test_case.add_input<float>(Shape{1, 1, 8, 16}, past_key);+ test_case.add_input<float>(Shape{1, 1, 8, 16}, past_value);+ test_case.add_input<int>(Shape{1, 1}, seqlens_k);+ test_case.add_input<int>(Shape{}, total_sequence_length);+ test_case.add_input<float>(Shape{8, 8}, cos_cache);+ test_case.add_input<float>(Shape{8, 8}, sin_cache);+ test_case.add_expected_output<float>(Shape{1, 1, 32}, expected_output);+ test_case.add_expected_output<float>(Shape{1, 1, 8, 16}, expected_present_key);+ test_case.add_expected_output<float>(Shape{1, 1, 8, 16}, expected_present_value);+ test_case.run_with_tolerance_as_fp(1e-4f);+}+OPENVINO_TEST(${BACKEND_NAME}, onnx_model_gqa_insufficient_inputs_throws) {try {convert_model("com.microsoft/gqa_oob.onnx");