Skip to content

Commit 23d8e5c

Browse files
committed
Fix block size in matrixMutiplyVector
Signed-off-by:Tianxiang Wang<tianxiang.wang@metax-tech.com>, Contributed under MetaX Integrated Circuits (Shanghai) Co., Ltd.
1 parent c297263 commit 23d8e5c

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

source/module_hsolver/kernels/cuda/math_kernel_op.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ template <>
11981198
void matrixMutiplyVector<double, base_device::DEVICE_GPU>::operator()(const base_device::DEVICE_GPU *d, const int &m, const int &n,
11991199
double *a, const int &lda, const double *v, const double alpha, double *c, const int &ldc){
12001200
dim3 thread(16, 16, 1);
1201-
dim3 block((m + thread.x - 1) / thread.x, (m + thread.y - 1) / thread.y, 1);
1201+
dim3 block((m + thread.x - 1) / thread.x, (n + thread.y - 1) / thread.y, 1);
12021202
matrix_multiply_vector_kernel<double, double> <<<block, thread >>>(m, n, a, lda,
12031203
v, alpha, c, ldc);
12041204
cudaCheckOnDebug();
@@ -1208,7 +1208,7 @@ template <>
12081208
void matrixMutiplyVector<std::complex<float>, base_device::DEVICE_GPU>::operator()(const base_device::DEVICE_GPU *d, const int &m, const int &n,
12091209
std::complex<float> *a, const int &lda, const float *v, const float alpha, std::complex<float> *c, const int &ldc){
12101210
dim3 thread(16, 16, 1);
1211-
dim3 block((m + thread.x - 1) / thread.x, (m + thread.y - 1) / thread.y, 1);
1211+
dim3 block((m + thread.x - 1) / thread.x, (n + thread.y - 1) / thread.y, 1);
12121212
matrix_multiply_vector_kernel<thrust::complex<float>, float> <<<block, thread >>>(m, n, reinterpret_cast<thrust::complex<float>*>(a), lda,
12131213
v, alpha, reinterpret_cast<thrust::complex<float>*>(c), ldc);
12141214
cudaCheckOnDebug();

source/module_hsolver/kernels/rocm/math_kernel_op.hip.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ template <>
11121112
void matrixMutiplyVector<double, base_device::DEVICE_GPU>::operator()(const base_device::DEVICE_GPU *d, const int &m, const int &n,
11131113
double *a, const int &lda, const double *v, const double alpha, double *c, const int &ldc){
11141114
dim3 thread(16, 16, 1);
1115-
dim3 block((m + thread.x - 1) / thread.x, (m + thread.y - 1) / thread.y, 1);
1115+
dim3 block((m + thread.x - 1) / thread.x, (n + thread.y - 1) / thread.y, 1);
11161116
hipLaunchKernelGGL(HIP_KERNEL_NAME(matrix_multiply_vector_kernel<double, double>), block, thread, 0, 0, m, n, a, lda,
11171117
v, alpha, c, ldc);
11181118
hipCheckOnDebug();
@@ -1122,7 +1122,7 @@ template <>
11221122
void matrixMutiplyVector<std::complex<float>, base_device::DEVICE_GPU>::operator()(const base_device::DEVICE_GPU *d, const int &m, const int &n,
11231123
std::complex<float> *a, const int &lda, const float *v, const float alpha, std::complex<float> *c, const int &ldc){
11241124
dim3 thread(16, 16, 1);
1125-
dim3 block((m + thread.x - 1) / thread.x, (m + thread.y - 1) / thread.y, 1);
1125+
dim3 block((m + thread.x - 1) / thread.x, (n + thread.y - 1) / thread.y, 1);
11261126
hipLaunchKernelGGL(HIP_KERNEL_NAME(matrix_multiply_vector_kernel<thrust::complex<float>, float>), block, thread, 0, 0, m, n, reinterpret_cast<thrust::complex<float>*>(a), lda,
11271127
v, alpha, reinterpret_cast<thrust::complex<float>*>(c), ldc);
11281128
hipCheckOnDebug();

0 commit comments

Comments
 (0)