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
[GPU] ScaledAttn performance regression (#39077)
Nikolay Shchegolev230b4a56216b
diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/paged_attention_opt.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/paged_attention_opt.cppindex 7b4caf04ebc..573c47f781b 100644--- a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/paged_attention_opt.cpp+++ b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/paged_attention_opt.cpp@@ -207,10 +207,10 @@ size_t get_max_context_len(const kernel_impl_params& params) {return paged_attention_max_len;}-size_t get_partitioning_size(const kernel_impl_params& params, size_t head_size, PagedAttentionStage stage, size_t k_head_size) {+size_t get_partitioning_size(const kernel_impl_params& params, size_t head_size, PagedAttentionStage stage) {size_t partition_size = 0;if (stage == PagedAttentionStage::PREFILL) {- partition_size = head_size * get_sg_number_scale_factor(params.get_device_info(), head_size, SDPAStage::MULTI_TOKENS, k_head_size);+ partition_size = head_size * get_sg_number_scale_factor(params.get_device_info(), head_size, SDPAStage::MULTI_TOKENS);} else {partition_size = seq_len_partition_size;}@@ -1305,7 +1305,7 @@ public:const size_t heads_num = desc->heads_num;const size_t head_size = desc->v_head_size;- const size_t sg_num_scale = get_sg_number_scale_factor(params.get_device_info(), head_size, SDPAStage::MULTI_TOKENS, desc->k_head_size);+ const size_t sg_num_scale = get_sg_number_scale_factor(params.get_device_info(), head_size, SDPAStage::MULTI_TOKENS);wgs.global = {heads_num, ceil_div(rtp->paged_attention_aligned_seq_len, get_target_seq_len_block_size()), head_size * sg_num_scale};wgs.local = {1, 1, head_size * sg_num_scale};@@ -1487,7 +1487,7 @@ public:auto stage = get_paged_attention_stage(params);rt_params->max_context_len = get_max_context_len(params);rt_params->stage = stage;- rt_params->partition_size = get_partitioning_size(params, desc->v_head_size, rt_params->stage, desc->k_head_size);+ rt_params->partition_size = get_partitioning_size(params, desc->v_head_size, rt_params->stage);auto effective_context_len = rt_params->max_context_len;// scores_output is only used in SnapKV path, and it doesn't yet handle the SWA block skip offset@@ -1505,8 +1505,7 @@ public:if ((rt_params->stage == PagedAttentionStage::PREFILL || rt_params->stage == PagedAttentionStage::MIXED) && !params.is_dynamic())rt_params->paged_attention_aligned_seq_len = static_cast<size_t>(get_aligned_seq_len(params, rt_params->stage));- rt_params->sdpa_opt_seq_len_partition_size =- get_seq_len_partition_size(params.get_device_info(), desc->v_head_size, SDPAStage::MULTI_TOKENS, desc->k_head_size);+ rt_params->sdpa_opt_seq_len_partition_size = get_seq_len_partition_size(params.get_device_info(), desc->v_head_size, SDPAStage::MULTI_TOKENS);if (desc->has_score_aggregation) {const auto& input_mem = params.memory_deps;@@ -1695,7 +1694,7 @@ public:num_of_partitions = rt_params->num_of_partitions;} else {stage = get_paged_attention_stage(params);- partition_size = get_partitioning_size(params, desc->v_head_size, stage, desc->k_head_size);+ partition_size = get_partitioning_size(params, desc->v_head_size, stage);const auto max_context_len = get_max_context_len(params);num_of_partitions = ceil_div(max_context_len, partition_size);}diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_base.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_base.cppindex d0672d5fa4c..27dec51fd19 100644--- a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_base.cpp+++ b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_base.cpp@@ -87,34 +87,49 @@ bool SDPABase::is_int4_kv_cache(const kernel_impl_params& params) {return data_type_traits::is_i4_u4(kv_cache_dt);}-// Returns {k_head_size, v_head_size} as actually used by SDPA-family OCL kernels (SDPAOpt/SDPAMicro-// and PagedAttentionOpt share this via SDPABase). For PagedAttention these are simply the descriptor-// fields; for SDPA they are derived from the K/V input layouts (honoring transpose orders), with the-// int4 KV-cache override (physical K/V layouts are packed to half size; use the logical, un-halved+// Returns the effective K head size as actually used by SDPA-family OCL kernels (SDPAOpt/SDPAMicro+// and PagedAttentionOpt share this via SDPABase). For PagedAttention this is simply the descriptor+// field; for SDPA it is derived from the K input layout (honoring the transpose order), with the+// int4 KV-cache override (physical K layout is packed to half size; use the logical, un-halved// head size taken from the query layout instead).-std::pair<int64_t, int64_t> SDPABase::get_effective_head_sizes(const kernel_impl_params& params) {+int64_t SDPABase::get_effective_k_head_size(const kernel_impl_params& params) {if (params.is_type<paged_attention>()) {const auto desc = params.typed_desc<paged_attention>();- return {static_cast<int64_t>(desc->k_head_size), static_cast<int64_t>(desc->v_head_size)};+ return static_cast<int64_t>(desc->k_head_size);}const auto desc = params.typed_desc<scaled_dot_product_attention>();++ // 4-bit KV-cache: K layout has head_size/2 due to u4→i8 packing.+ // Use logical head size from query (which is not packed) instead.+ if (desc->is_kv_compressed && SDPABase::is_int4_kv_cache(params)) {+ auto extended_input_q_transpose_order = extend_order_in_num_heads_dim(desc->input_q_transpose_order);+ return get_head_size(params.get_input_layout(0), extended_input_q_transpose_order);+ }+auto extended_input_k_transpose_order = extend_order_in_num_heads_dim(desc->input_k_transpose_order);- auto extended_input_v_transpose_order = extend_order_in_num_heads_dim(desc->input_v_transpose_order);+ return get_head_size(params.get_input_layout(1), extended_input_k_transpose_order);+}- int64_t k_head_size = get_head_size(params.get_input_layout(1), extended_input_k_transpose_order);- int64_t v_head_size = get_head_size(params.get_input_layout(2), extended_input_v_transpose_order);+// Returns the effective V head size. See get_effective_k_head_size() for details; the only+// difference is that this is derived from the V input layout / v_head_size descriptor field.+int64_t SDPABase::get_effective_v_head_size(const kernel_impl_params& params) {+ if (params.is_type<paged_attention>()) {+ const auto desc = params.typed_desc<paged_attention>();+ return static_cast<int64_t>(desc->v_head_size);+ }- // 4-bit KV-cache: K/V layouts have head_size/2 due to u4→i8 packing.- // Override with logical head size from query (which is not packed).+ const auto desc = params.typed_desc<scaled_dot_product_attention>();++ // 4-bit KV-cache: V layout has head_size/2 due to u4→i8 packing.+ // Use logical head size from query (which is not packed) instead.if (desc->is_kv_compressed && SDPABase::is_int4_kv_cache(params)) {auto extended_input_q_transpose_order = extend_order_in_num_heads_dim(desc->input_q_transpose_order);- const int64_t q_head_size = get_head_size(params.get_input_layout(0), extended_input_q_transpose_order);- k_head_size = q_head_size;- v_head_size = q_head_size;+ return get_head_size(params.get_input_layout(0), extended_input_q_transpose_order);}- return {k_head_size, v_head_size};+ auto extended_input_v_transpose_order = extend_order_in_num_heads_dim(desc->input_v_transpose_order);+ return get_head_size(params.get_input_layout(2), extended_input_v_transpose_order);}std::pair<int64_t, int64_t> SDPABase::get_gqa_params(const kernel_impl_params& params) const {diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_base.hpp b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_base.hppindex f9a69cd7981..16c13cf8ea3 100644--- a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_base.hpp+++ b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_base.hpp@@ -70,9 +70,17 @@ struct SDPABase : public KernelGenerator {const std::vector<int64_t>& input_v_transpose_order);static bool is_int4_kv_cache(const kernel_impl_params& params);- // Returns {k_head_size, v_head_size} as used by SDPA-family OCL kernels; shared by SDPA and- // PagedAttention to avoid re-deriving (and potentially diverging) this pair per call site.- static std::pair<int64_t, int64_t> get_effective_head_sizes(const kernel_impl_params& params);++ // Returns the effective K head size as actually used by SDPA-family OCL kernels (SDPAOpt/SDPAMicro+ // and PagedAttentionOpt share this via SDPABase). For PagedAttention this is simply the descriptor+ // field; for SDPA it is derived from the K input layout (honoring the transpose order), with the+ // int4 KV-cache override (physical K layout is packed to half size; use the logical, un-halved+ // head size taken from the query layout instead).+ static int64_t get_effective_k_head_size(const kernel_impl_params& params);+ // Returns the effective V head size. See get_effective_k_head_size() for details; the only+ // difference is that this is derived from the V input layout / v_head_size descriptor field.+ static int64_t get_effective_v_head_size(const kernel_impl_params& params);+static bool requires_shape_canonicalization(const kernel_impl_params& impl_params);static kernel_impl_params static_canonicalize_shapes(const kernel_impl_params& impl_params);diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_gen_opt.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_gen_opt.cppindex b550b682877..6adf13c0704 100644--- a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_gen_opt.cpp+++ b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_gen_opt.cpp@@ -36,7 +36,8 @@ JitConstants SDPAOptGeneratorBase::get_jit_constants_base(const kernel_impl_parajit.make("SUBGROUP_SIZE", subgroup_size);auto [broadcast_axis, group_size] = get_gqa_params(params);- auto [k_head_size, v_head_size] = get_effective_head_sizes(params);+ const auto k_head_size = SDPABase::get_effective_k_head_size(params);+ const auto v_head_size = SDPABase::get_effective_v_head_size(params);if (is_paged_attention) {auto desc = params.typed_desc<paged_attention>();@@ -134,8 +135,8 @@ JitConstants SDPAOptGeneratorBase::get_jit_constants_base(const kernel_impl_parajit.make("K_HEAD_SIZE_LEFTOVER", k_head_size % subgroup_size);jit.make("V_HEAD_SIZE_LEFTOVER", v_head_size % subgroup_size);}- jit.make("SEQ_LEN_PARTITION_SIZE", get_seq_len_partition_size(info, v_head_size, stage, static_cast<size_t>(k_head_size)));- jit.make("SG_SCALE_FACTOR", get_sg_number_scale_factor(info, v_head_size, stage, static_cast<size_t>(k_head_size)));+ jit.make("SEQ_LEN_PARTITION_SIZE", get_seq_len_partition_size(info, v_head_size, stage));+ jit.make("SG_SCALE_FACTOR", get_sg_number_scale_factor(info, v_head_size, stage));bool could_use_flashattn_v2 = params.get_program().get_config().get_could_use_flashattn_v2();if (could_use_flashattn_v2) {@@ -230,12 +231,10 @@ DispatchDataFunc SDPAOptGeneratorSingleToken::get_dispatch_data_func() const {"SDPA: invalid non-positive "," in static dispatch");const size_t num_of_partitions = get_partitions_num(params, SDPAStage::SINGLE_TOKEN);- auto [k_head_size, v_head_size] = SDPABase::get_effective_head_sizes(params);+ const size_t head_size_u =+ ensure_positive_dim(SDPABase::get_effective_v_head_size(params), "head_size", "SDPA: invalid non-positive ", " in static dispatch");- const size_t head_size_u = ensure_positive_dim(v_head_size, "head_size", "SDPA: invalid non-positive ", " in static dispatch");-- const size_t sg_num_scale =- get_sg_number_scale_factor(params.get_device_info(), head_size_u, SDPAStage::SINGLE_TOKEN, static_cast<size_t>(k_head_size));+ const size_t sg_num_scale = get_sg_number_scale_factor(params.get_device_info(), head_size_u, SDPAStage::SINGLE_TOKEN);GPU_DEBUG_TRACE_DETAIL << "batch_size = " << batch_size << ", target_seq_len = " << target_seq_len << ", heads_num = " << heads_num << "\n";GPU_DEBUG_TRACE_DETAIL << "head_size = " << head_size_u << ", num_of_partitions = " << num_of_partitions << "\n";GPU_DEBUG_TRACE_DETAIL << "sg_num_scale = " << sg_num_scale << "\n";@@ -278,12 +277,10 @@ DispatchDataFunc SDPAOptGeneratorMultiToken::get_dispatch_data_func() const {"SDPA: invalid non-positive "," in static dispatch");const size_t target_seq_len_block_size = get_target_seq_len_block_size();- auto [k_head_size, v_head_size] = SDPABase::get_effective_head_sizes(params);-- const size_t head_size_u = ensure_positive_dim(v_head_size, "head_size", "SDPA: invalid non-positive ", " in static dispatch");- const size_t k_head_size_u = ensure_positive_dim(k_head_size, "k_head_size", "SDPA: invalid non-positive ", " in static dispatch");+ const size_t head_size_u =+ ensure_positive_dim(SDPABase::get_effective_v_head_size(params), "head_size", "SDPA: invalid non-positive ", " in static dispatch");- const size_t sg_num_scale = get_sg_number_scale_factor(params.get_device_info(), head_size_u, SDPAStage::MULTI_TOKENS, k_head_size_u);+ const size_t sg_num_scale = get_sg_number_scale_factor(params.get_device_info(), head_size_u, SDPAStage::MULTI_TOKENS);GPU_DEBUG_TRACE_DETAIL << "batch_size = " << batch_size << ", target_seq_len = " << target_seq_len << ", heads_num = " << heads_num << "\n";GPU_DEBUG_TRACE_DETAIL << "head_size = " << head_size_u << ", sg_num_scale = " << sg_num_scale << "\n";@@ -330,10 +327,8 @@ DispatchDataFunc SDPAOptGeneratorFinalization::get_dispatch_data_func() const {"SDPA: invalid non-positive "," in static dispatch");const size_t num_of_partitions = get_partitions_num(params, SDPAStage::FINALIZATION);- auto [k_head_size, v_head_size] = SDPABase::get_effective_head_sizes(params);- (void)k_head_size;-- const size_t head_size_u = ensure_positive_dim(v_head_size, "head_size", "SDPA: invalid non-positive ", " in static dispatch");+ const size_t head_size_u =+ ensure_positive_dim(SDPABase::get_effective_v_head_size(params), "head_size", "SDPA: invalid non-positive ", " in static dispatch");GPU_DEBUG_TRACE_DETAIL << "batch_size = " << batch_size << ", target_seq_len = " << target_seq_len << ", heads_num = " << heads_num << "\n";GPU_DEBUG_TRACE_DETAIL << "head_size = " << head_size_u << ", num_of_partitions = " << num_of_partitions << "\n";diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_gen_opt.hpp b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_gen_opt.hppindex 414fa152392..c1b8fcb512b 100644--- a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_gen_opt.hpp+++ b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_gen_opt.hpp@@ -24,16 +24,11 @@ inline size_t get_target_seq_len_block_size() {return block_size;}-inline size_t get_sg_number_scale_factor(const device_info& info, size_t head_size, size_t kernel_type, size_t k_head_size) {+inline size_t get_sg_number_scale_factor(const device_info& info, size_t head_size, size_t kernel_type) {constexpr size_t subgroup_size = 16;const size_t optimal_scale_factor = 2;if (kernel_type == SDPAStage::MULTI_TOKENS) {- // The doubled-subgroup query-loading scheme (SG_SCALE_FACTOR == 2) in the multi-token- // kernel assumes the work-group is sized off a single head size. When K/V head sizes- // differ, the per-subgroup head-index/seq-half assignment logic is not guaranteed to- // produce correct coverage, so keep the safe (non-scaled) path in that case.- bool head_sizes_match = (k_head_size == head_size);- if (head_sizes_match && head_size % subgroup_size == 0 && head_size * optimal_scale_factor <= info.max_work_group_size) {+ if ((head_size % subgroup_size == 0) && (head_size * optimal_scale_factor <= info.max_work_group_size)) {return optimal_scale_factor;}} else if (kernel_type == SDPAStage::SINGLE_TOKEN) {@@ -45,10 +40,10 @@ inline size_t get_sg_number_scale_factor(const device_info& info, size_t head_sireturn 1;}-inline size_t get_seq_len_partition_size(const device_info& info, size_t head_size, size_t kernel_type, size_t k_head_size) {+inline size_t get_seq_len_partition_size(const device_info& info, size_t head_size, size_t kernel_type) {size_t seq_len = 0;if (kernel_type == SDPAStage::MULTI_TOKENS) {- seq_len = align_to(head_size * get_sg_number_scale_factor(info, head_size, kernel_type, k_head_size), 16);+ seq_len = align_to(head_size * get_sg_number_scale_factor(info, head_size, kernel_type), 16);} else {seq_len = 256;}@@ -68,7 +63,7 @@ inline size_t get_partitions_num(const kernel_impl_params& params, size_t kernelconst auto head_size = get_head_size(params.get_input_layout(0), extended_input_q_transpose_order);const auto source_seq_len = get_seq_length(params.get_input_layout(1), extended_input_k_transpose_order);- return ceil_div(source_seq_len, get_seq_len_partition_size(params.get_device_info(), head_size, kernel_type, 0));+ return ceil_div(source_seq_len, get_seq_len_partition_size(params.get_device_info(), head_size, kernel_type));}class SDPAOptGeneratorBase : public SDPABase {diff --git a/src/plugins/intel_gpu/tests/unit/test_cases/sdpa_gpu_test.cpp b/src/plugins/intel_gpu/tests/unit/test_cases/sdpa_gpu_test.cppindex eadc254510a..f0bfbd2bcb9 100644--- a/src/plugins/intel_gpu/tests/unit/test_cases/sdpa_gpu_test.cpp+++ b/src/plugins/intel_gpu/tests/unit/test_cases/sdpa_gpu_test.cpp@@ -10,6 +10,7 @@#include <intel_gpu/primitives/eltwise.hpp>#include <intel_gpu/runtime/debug_configuration.hpp>+#include "impls/ocl_v2/sdpa/sdpa_gen_opt.hpp"#include "impls/ocl_v2/sdpa/sdpa_opt.hpp"#include "impls/ocl_v2/sdpa/sdpa_ref.hpp"#include "openvino/reference/scaled_dot_product_attention.hpp"@@ -2406,6 +2407,104 @@ TEST(sdpa_gpu_custom, dynamic_mismatched_v_head_size) {}}+TEST(sdpa_gpu_custom, static_mismatched_kv_head_size_multi_token_uses_sg_scale_factor_2) {+ // The multi-token (prefill) SDPA kernel must keep using SG_SCALE_FACTOR=2 even when K and V+ // head sizes differ (e.g. k_head_size=16, v_head_size=32).+ // Unlike `dynamic_mismatched_v_head_size` above, this test uses *static* shapes and multiple+ // query tokens so sdpa_opt (not sdpa_ref) is actually selected and dispatches through+ // the multi-token kernel, allowing us to catch this kind of dispatch regression.+ auto& engine = get_test_engine();++ const ov::Shape q_shape{1, 4, 32, 16}; // batch=1, heads=4, seq_len=32, q_head_size=16+ const ov::Shape k_shape{1, 4, 32, 16}; // k_head_size=16+ const ov::Shape v_shape{1, 4, 32, 32}; // v_head_size=32 (mismatched vs k/q head size)+ const size_t v_head_size = v_shape[3];++ auto q_mem = engine.allocate_memory(layout(q_shape, data_types::f16, format::bfyx));+ auto k_mem = engine.allocate_memory(layout(k_shape, data_types::f16, format::bfyx));+ auto v_mem = engine.allocate_memory(layout(v_shape, data_types::f16, format::bfyx));++ tests::random_generator rg;+ rg.set_seed(GET_SUITE_NAME);+ auto fill_random = [&](const memory::ptr& mem) {+ auto data = rg.generate_random_1d<ov::float16>(mem->get_layout().count(), -1.0f, 1.0f);+ set_values(mem, data);+ };+ fill_random(q_mem);+ fill_random(k_mem);+ fill_random(v_mem);++ topology topology;+ topology.add(input_layout("q", q_mem->get_layout()));+ topology.add(input_layout("k", k_mem->get_layout()));+ topology.add(input_layout("v", v_mem->get_layout()));+ topology.add(scaled_dot_product_attention("sdpa",+ {input_info("q"), input_info("k"), input_info("v")},+ false,+ -1,+ {0, 1, 2, 3},+ {0, 1, 2, 3},+ {0, 1, 2, 3},+ {0, 1, 2, 3},+ {},+ false));+ topology.add(reorder("result", input_info("sdpa"), format::bfyx, data_types::f16));++ auto run_network = [&](bool force_ref) {+ ExecutionConfig config = get_test_default_config(engine);+ if (force_ref) {+ config.set_property(ov::intel_gpu::force_implementations(ov::intel_gpu::ImplForcingMap{+ {"sdpa", {format::type::bfyx, "sdpa_ref"}}+ }));+ }+ auto network = get_network(engine, topology, config, get_test_stream_ptr(), false);+ network->set_input_data("q", q_mem);+ network->set_input_data("k", k_mem);+ network->set_input_data("v", v_mem);+ auto output = network->execute().at("result").get_memory();+ return std::make_pair(network, output);+ };++ auto [network, output] = run_network(false);+ auto [ref_network, ref_output] = run_network(true);++ // With unforced implementation selection, this static, multi-token, mismatched K/V head-size+ // shape must still be handled by the optimized sdpa_opt kernel (not fall back to sdpa_ref).+ auto sdpa_inst = network->get_primitive("sdpa");+ ASSERT_EQ(sdpa_inst->get_impl()->m_manager->get_type_info(), ov::intel_gpu::ocl::SDPAOpt::get_type_info_static());++ // Correctness: sdpa_opt output must match the sdpa_ref output.+ ASSERT_EQ(output->get_layout().get_shape(), ref_output->get_layout().get_shape());+ cldnn::mem_lock<ov::float16, mem_lock_type::read> output_data(output, get_test_stream());+ cldnn::mem_lock<ov::float16, mem_lock_type::read> ref_output_data(ref_output, get_test_stream());+ ASSERT_EQ(output_data.size(), ref_output_data.size());+ for (size_t i = 0; i < output_data.size(); ++i) {+ ASSERT_NEAR(static_cast<float>(output_data[i]), static_cast<float>(ref_output_data[i]), 1e-2f)+ << "Mismatch at index " << i;+ }++ // Directly verify the restored dispatch logic: the multi-token kernel must still select+ // SG_SCALE_FACTOR=2 for this head size, regardless of the (mismatched) K head size.+ const auto sg_scale_factor =+ ov::intel_gpu::ocl::get_sg_number_scale_factor(engine.get_device_info(), v_head_size, ov::intel_gpu::ocl::SDPAStage::MULTI_TOKENS);+ ASSERT_EQ(sg_scale_factor, 2U);++ // And verify this is actually what the multi-token dispatch-data function computes for the+ // exact runtime parameters used by the executed instance, i.e. the generated OpenCL+ // work-group uses a local Z-dimension of v_head_size * SG_SCALE_FACTOR (aligned to the+ // subgroup size), not v_head_size * 1.+ ov::intel_gpu::ocl::SDPAOptGeneratorMultiToken generator(/*indirect=*/false);+ auto kd = generator.get_kernel_data(*sdpa_inst->get_impl_params());+ kd.update_dispatch_data_func(*sdpa_inst->get_impl_params(), kd, nullptr);++ const size_t subgroup_size = 16;+ const size_t expected_local_z = align_to(v_head_size * 2, subgroup_size);+ const size_t regressed_local_z = align_to(v_head_size * 1, subgroup_size);+ ASSERT_EQ(kd.params.workGroups.local.size(), 3u);+ ASSERT_EQ(kd.params.workGroups.local[2], expected_local_z);+ ASSERT_NE(kd.params.workGroups.local[2], regressed_local_z);+}+TEST(sdpa_gpu_custom, different_rank_orders_dynamic_v_head_size_rejects_opt) {auto& engine = get_test_engine();