"dockerfile/cuda12.4.dockerfile" did not exist on "9f03d5687a79d06fd881c8ba95f5460b293c1506"
Commit 0b6bdab0 authored by Ceng23333's avatar Ceng23333
Browse files

issue/746: 修复causal_softmax在长宽在1024边缘的计算错误


Signed-off-by: default avatarCeng23333 <441651826@qq.com>
parent 51beebc6
...@@ -28,7 +28,7 @@ __device__ void causalSoftmaxKernel( ...@@ -28,7 +28,7 @@ __device__ void causalSoftmaxKernel(
// 1 | * * * ... * * | // 1 | * * * ... * * |
// 2 | * * * ... * * * | // 2 | * * * ... * * * |
// height: 3 col_id-> // height: 3 col_id->
if (width + blockIdx.x >= threadIdx.x + height) { if (width + blockIdx.x >= col + height) {
if constexpr (std::is_same_v<Tdata, half> || std::is_same_v<Tdata, cuda_bfloat16>) { if constexpr (std::is_same_v<Tdata, half> || std::is_same_v<Tdata, cuda_bfloat16>) {
y[col] = hexp(x[col] - max_); y[col] = hexp(x[col] - max_);
} else { } else {
......
...@@ -32,6 +32,9 @@ _TEST_CASES_ = [ ...@@ -32,6 +32,9 @@ _TEST_CASES_ = [
((32, 20, 512), None, None), ((32, 20, 512), None, None),
((32, 20, 512), (20480, 512, 1), None), ((32, 20, 512), (20480, 512, 1), None),
((28, 15, 15), None, None), ((28, 15, 15), None, None),
((28, 1024, 1024), None, None),
((28, 1025, 1025), None, None),
((28, 1031, 1031), None, None),
] ]
# Data types used for testing # Data types used for testing
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment