Skip to content

Commit a9e7448

Browse files
authored
[GPU] correct SDPA micro prefetch bounds (#36808)
Use value-based prefetch guards so zero-valued JIT macros actually disable prefetch blocks, and keep the optimized first-K prefetch range while restoring the expected r/c orientation for cooperative_prefetch_2d_k. This avoids BMG CL_OUT_OF_RESOURCES in the GenAI llama benchmark while preserving the reduced K range optimization. ### Tickets: - CVS-190364 - CVS-190396 ### AI Assistance: - AI assistance used: yes - AI: find a root-cause, fix - User: review
1 parent 69fa6d8 commit a9e7448

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa_micro.cl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ KERNEL(micro_sdpa)(OPTIONAL_SHAPE_INFO_ARG
501501
#endif
502502
#endif
503503

504-
#ifdef PREFETCH_K0
504+
#if PREFETCH_K0
505505
/* Prefetch first K tile. */
506506
#if TRANSPOSE_K
507507
const uint stride_k0 = ldk;
@@ -510,8 +510,8 @@ KERNEL(micro_sdpa)(OPTIONAL_SHAPE_INFO_ARG
510510
#endif
511511
cooperative_prefetch_2d_k(
512512
/* ptr */ K + window_k_begin * stride_k0,
513-
/* r */ causal_k - window_k_begin,
514-
/* c */ d,
513+
/* r */ d,
514+
/* c */ causal_k - window_k_begin,
515515
/* rmax */ ugemm_kq_wg_tile_m,
516516
/* cmax */ PREFETCH_D_MAX,
517517
/* ld */ ldk,
@@ -851,7 +851,7 @@ KERNEL(micro_sdpa)(OPTIONAL_SHAPE_INFO_ARG
851851
}
852852
#endif
853853

854-
#ifdef PREFETCH_V
854+
#if PREFETCH_V
855855
/* Prefetch V tile. */
856856
#if SLIDING_WINDOW_SIZE && !(IS_PAGED_ATTENTION && !IS_PREFILL)
857857
const int window_v_pf_begin = first ? (window_k_begin - k0) : 0;
@@ -990,7 +990,7 @@ KERNEL(micro_sdpa)(OPTIONAL_SHAPE_INFO_ARG
990990
sg_i_kq);
991991
}
992992

993-
#ifdef PREFETCH_K
993+
#if PREFETCH_K
994994
/* Prefetch next K tile. */
995995
if (!last) {
996996
#if TRANSPOSE_K

0 commit comments

Comments
 (0)