Skip to content

Commit

Permalink
Working score
Browse files Browse the repository at this point in the history
  • Loading branch information
dakenf committed Sep 10, 2023
1 parent 4d6e45d commit 7009a95
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/web/lib/wasm/jsep/webgpu/ops/attentiion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,8 @@ const computeVxAttentionScore = (context: ComputeContext, probs: TensorView, v:

const TILE_SIZE = 8;
const dispatch = {
x: Math.ceil(params.sequenceLength / TILE_SIZE),
y: Math.ceil(params.vHeadSize / TILE_SIZE),
x: Math.ceil(params.vHeadSize / TILE_SIZE),
y: Math.ceil(params.sequenceLength / TILE_SIZE),
z: params.batchSize * params.numHeads
};

Expand Down Expand Up @@ -446,7 +446,7 @@ const computeVxAttentionScore = (context: ComputeContext, probs: TensorView, v:
if (m < M && w + local_id.x < K) {
tileQ[TILE_SIZE * local_id.y + local_id.x] = probs[offsetA + w + local_id.x];
}
if (w + local_id.y < N) {
if (n < N && w + local_id.y < K) {
tileK[TILE_SIZE * local_id.y + local_id.x] = v[offsetB + (w + local_id.y) * N];
}
workgroupBarrier();
Expand Down

0 comments on commit 7009a95

Please sign in to comment.