Skip to content

Commit

Permalink
Merge #1756 fix oneMKL GEMM on zero-size matrix
Browse files Browse the repository at this point in the history
This PR only use oneMKL GEMM when all pointer are not nullptr, which avoids the illegal access.

Related PR: #1756
  • Loading branch information
yhmtsai authored Feb 18, 2025
2 parents e37369b + 58cf7e9 commit 01a3d35
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dpcpp/matrix/dense_kernels.dp.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
//
// SPDX-License-Identifier: BSD-3-Clause

Expand Down Expand Up @@ -223,7 +223,8 @@ void simple_apply(std::shared_ptr<const DefaultExecutor> exec,
using namespace oneapi::mkl;
if constexpr (onemkl::is_supported<ValueType>::value) {
if (b->get_stride() != 0 && c->get_stride() != 0) {
if (a->get_size()[1] > 0) {
if (a->get_size()[1] > 0 && a->get_const_values() &&
b->get_const_values() && c->get_const_values()) {
oneapi::mkl::blas::row_major::gemm(
*exec->get_queue(), transpose::nontrans,
transpose::nontrans, c->get_size()[0], c->get_size()[1],
Expand Down Expand Up @@ -253,7 +254,8 @@ void apply(std::shared_ptr<const DefaultExecutor> exec,
using namespace oneapi::mkl;
if constexpr (onemkl::is_supported<ValueType>::value) {
if (b->get_stride() != 0 && c->get_stride() != 0) {
if (a->get_size()[1] > 0) {
if (a->get_size()[1] > 0 && a->get_const_values() &&
b->get_const_values() && c->get_const_values()) {
oneapi::mkl::blas::row_major::gemm(
*exec->get_queue(), transpose::nontrans,
transpose::nontrans, c->get_size()[0], c->get_size()[1],
Expand Down

0 comments on commit 01a3d35

Please sign in to comment.