Skip to content

Commit

Permalink
fix: if mask not present, opencl kernel fails with divide by 0
Browse files Browse the repository at this point in the history
If utilizing micro kernel version of sdpa without an attention mask, the opencl kernel will fail to compile with a divide by zero error. This remove the `msk` index computation in the absence of the mask to avoid the error and allow micro kernel sdpa to function w/o the mask as intended.
  • Loading branch information
pv-pterab-s committed Nov 25, 2024
1 parent a78fe63 commit 541436c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gpu/intel/ocl/micro_sdpa.cl
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ micro_sdpa(const global half *K, const global half *Q, const global half *V,
Q += QRY_OFF(b1, b0, 0, 0);
V += VAL_OFF(b1, b0 / KV_GROUP_SIZE, 0, 0);
A += DST_OFF(b1, b0, 0, 0, 0);
#if WITH_ATTN_MASK
msk += MSK_OFF(b1 % MSK_D0, b0 % MSK_D1, 0, 0);
#endif

/* Load Q tile, destined for SLM */
q_tile_type Q_tile;
Expand Down

0 comments on commit 541436c

Please sign in to comment.