Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(kernel): 设置 sharedMemory
Signed-off-by: YdrMaster <[email protected]>
  • Loading branch information
YdrMaster committed Feb 19, 2024
commit d7bbd3b051f435f27abde39a09c7c7dd57fd4995
5 changes: 4 additions & 1 deletion src/04kernel/src/kernels/attention/cuda_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace refactor::kernel {
// gridDim.x = batch * nHead
// gridDim.y = seqLen
// blockDim.x = min(1024, attLen)
// sizeof(shared) = attLen * sizeof(float)
template<class T>
static __global__ void softmax(
T *__restrict__ att,
Expand Down Expand Up @@ -154,7 +155,9 @@ namespace refactor::kernel {
workspaceQK, d->workspaceSizeQK,
cudaStreamLegacy);
}
softmax<<<dim3(info.batch * info.nHead, info.seqLen), info.seqLen>>>(
softmax<<<dim3(info.batch * info.nHead, info.seqLen),
info.seqLen,
info.seqLen * sizeof(float)>>>(
att, causualMask, info.seqLen, info.seqLen);
{
half alpha = 1, beta = 0;
Expand Down