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] Avoid use other configs in sdpa_micro for paged_attention (#30662)
Chon Ming Lee9315206a0eed
diff --git a/src/plugins/intel_gpu/src/kernel_selector/kernels/sdpa/sdpa_kernel_micro.cpp b/src/plugins/intel_gpu/src/kernel_selector/kernels/sdpa/sdpa_kernel_micro.cppindex b3a91aa4adc..c88efe248ed 100644--- a/src/plugins/intel_gpu/src/kernel_selector/kernels/sdpa/sdpa_kernel_micro.cpp+++ b/src/plugins/intel_gpu/src/kernel_selector/kernels/sdpa/sdpa_kernel_micro.cpp@@ -247,17 +247,18 @@ sdpa_config_t xe2_q_h256_s384_2nd_integrated = {16, 16, 16, 16, 16, 1, 16, 1};sdpa_config_t *choose_config_xehpg(int head_size, int seq, bool thin_q, bool quantized, bool is_pa) {if (head_size <= 32) {+ if (seq <= 0 && is_pa) return &xehpg_h32;if (quantized && seq >= 128) {if (thin_q) return &xehpg_q_h32_2nd;return &xehpg_q_h32;}if (thin_q) return &xehpg_h32_2nd;- if (seq <= 0 && is_pa) return &xehpg_h32;if (seq <= 32) return &xehpg_h32_s32;if (seq <= 64) return &xehpg_h32_s64;if (seq <= 256) return &xehpg_h32_s256;return &xehpg_h32;} else if (head_size <= 64) {+ if (seq <= 0 && is_pa) return &xehpg_h64;if (quantized) {if (thin_q) {if (seq <= 64) return &xehpg_q_h64_s64_2nd;@@ -271,11 +272,11 @@ sdpa_config_t *choose_config_xehpg(int head_size, int seq, bool thin_q, bool qua}}if (thin_q) return &xehpg_h64_2nd;- if (seq <= 0 && is_pa) return &xehpg_h64;if (seq <= 64) return &xehpg_h64_s64;if (seq <= 128) return &xehpg_h64_s128;return &xehpg_h64;} else if (head_size <= 128) {+ if (seq <= 0 && is_pa) return &xehpg_h128;if (quantized) {if (thin_q) {if (seq <= 1) return &xehpg_q_h128_2nd;@@ -290,10 +291,10 @@ sdpa_config_t *choose_config_xehpg(int head_size, int seq, bool thin_q, bool quaif (seq <= 256) return &xehpg_q_h128_2nd;return &xehpg_h128_2nd;}- if (seq <= 0 && is_pa) return &xehpg_h128;if (seq <= 32) return &xehpg_h128_s32;return &xehpg_h128;} else if (head_size <= 256) {+ if (seq <= 0 && is_pa) return &xehpg_h256;if (thin_q) {if (quantized) {if (seq <= 96) return &xehpg_q_h256_s96_2nd;@@ -308,11 +309,11 @@ sdpa_config_t *choose_config_xehpg(int head_size, int seq, bool thin_q, bool quaif (seq <= 512) return &xehpg_q_h256_s512;return &xehpg_q_h256;}- if (seq <= 0 && is_pa) return &xehpg_h256;if (seq <= 32) return &xehpg_h256_s32;if (seq <= 128) return &xehpg_h256_s128;return &xehpg_h256;} else if (head_size <= 512) {+ if (seq <= 0 && is_pa) return &xehpg_h512;if (quantized) {if (thin_q) {if (seq <= 64) return &xehpg_q_h512_s64_2nd;@@ -325,7 +326,6 @@ sdpa_config_t *choose_config_xehpg(int head_size, int seq, bool thin_q, bool quareturn &xehpg_q_h512;}if (thin_q) { return &xehpg_h512_2nd; }- if (seq <= 0 && is_pa) return &xehpg_h512;return &xehpg_h512;}return nullptr;@@ -333,11 +333,12 @@ sdpa_config_t *choose_config_xehpg(int head_size, int seq, bool thin_q, bool quasdpa_config_t *choose_config_xehpc(int head_size, int seq, bool thin_q, bool quantized, bool is_integrated, bool is_pa) {if (head_size <= 32) {- if (thin_q) return &xehpc_h32_2nd;if (seq <= 0 && is_pa) return &xehpc_h32;+ if (thin_q) return &xehpc_h32_2nd;if (seq <= 32) return &xehpc_h32_s32;return &xehpc_h32;} else if (head_size <= 64) {+ if (seq <= 0 && is_pa) return &xehpc_h64;if (thin_q) {if (quantized) {if (seq <= 96) return &xehpc_q_h64_s96_2nd;@@ -355,11 +356,11 @@ sdpa_config_t *choose_config_xehpc(int head_size, int seq, bool thin_q, bool quaif (seq <= 1024) return &xehpc_q_h64_s1024;return &xehpc_q_h64;}- if (seq <= 0 && is_pa) return &xehpc_h64;if (seq <= 32) return &xehpc_h64_s32;if (seq <= 64) return &xehpc_h64_s64;return &xehpc_h64;} else if (head_size <= 128) {+ if (seq <= 0 && is_pa) return &xehpc_h128;if (quantized) {if (thin_q) {if (is_integrated) { return &xehpc_q_h128_2nd_integrated; }@@ -376,16 +377,16 @@ sdpa_config_t *choose_config_xehpc(int head_size, int seq, bool thin_q, bool qua}if (is_integrated) return &xehpc_q_h128_2nd_integrated;if (thin_q) return &xehpc_h128_2nd;- if (seq <= 0 && is_pa) return &xehpc_h128;if (seq <= 32) return &xehpc_h128_s32;if (seq <= 64) return &xehpc_h128_s64;return &xehpc_h128;} else if (head_size <= 256) {- if (thin_q) return &xehpc_h256_2nd;if (seq <= 0 && is_pa) return &xehpc_h256;+ if (thin_q) return &xehpc_h256_2nd;if (seq <= 64) return &xehpc_h256_s64;return &xehpc_h256;} else if (head_size <= 512) {+ if (seq <= 0 && is_pa) return &xehpc_h512;if (thin_q) {if (quantized) {if (is_integrated) {@@ -421,7 +422,6 @@ sdpa_config_t *choose_config_xehpc(int head_size, int seq, bool thin_q, bool quaif (seq <= 128) return &xehpc_h512_s128_integrated;return &xehpc_h512_integrated;}- if (seq <= 0 && is_pa) return &xehpc_h512;if (seq <= 64) return &xehpc_h512_s64;return &xehpc_h512;}