Skip to content

Fix warnings in blas extensions during build on CUDA #2225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions dpnp/backend/extensions/blas/gemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ typedef sycl::event (*gemm_impl_fn_ptr_t)(sycl::queue &,
const std::int64_t,
char *,
const std::int64_t,
#if !defined(USE_ONEMKL_CUBLAS)
const bool,
#endif // !USE_ONEMKL_CUBLAS
const std::vector<sycl::event> &);

static gemm_impl_fn_ptr_t gemm_dispatch_table[dpctl_td_ns::num_types]
Expand All @@ -74,7 +76,9 @@ static sycl::event gemm_impl(sycl::queue &exec_q,
const std::int64_t ldb,
char *resultC,
const std::int64_t ldc,
#if !defined(USE_ONEMKL_CUBLAS)
const bool is_row_major,
#endif // !USE_ONEMKL_CUBLAS
const std::vector<sycl::event> &depends)
{
type_utils::validate_type_for_device<Tab>(exec_q);
Expand Down Expand Up @@ -236,6 +240,7 @@ std::tuple<sycl::event, sycl::event, bool>
std::int64_t lda;
std::int64_t ldb;

// cuBLAS supports only column-major storage
#if defined(USE_ONEMKL_CUBLAS)
const bool is_row_major = false;

Expand Down Expand Up @@ -315,9 +320,15 @@ std::tuple<sycl::event, sycl::event, bool>
const char *b_typeless_ptr = matrixB.get_data();
char *r_typeless_ptr = resultC.get_data();

#if defined(USE_ONEMKL_CUBLAS)
sycl::event gemm_ev =
gemm_fn(exec_q, transA, transB, m, n, k, a_typeless_ptr, lda,
b_typeless_ptr, ldb, r_typeless_ptr, ldc, depends);
#else
sycl::event gemm_ev = gemm_fn(exec_q, transA, transB, m, n, k,
a_typeless_ptr, lda, b_typeless_ptr, ldb,
r_typeless_ptr, ldc, is_row_major, depends);
#endif // USE_ONEMKL_CUBLAS

sycl::event args_ev = dpctl::utils::keep_args_alive(
exec_q, {matrixA, matrixB, resultC}, {gemm_ev});
Expand Down
12 changes: 12 additions & 0 deletions dpnp/backend/extensions/blas/gemm_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ typedef sycl::event (*gemm_batch_impl_fn_ptr_t)(
const char *,
const char *,
char *,
#if !defined(USE_ONEMKL_CUBLAS)
const bool,
#endif // !USE_ONEMKL_CUBLAS
const std::vector<sycl::event> &);

static gemm_batch_impl_fn_ptr_t
Expand All @@ -83,7 +85,9 @@ static sycl::event gemm_batch_impl(sycl::queue &exec_q,
const char *matrixA,
const char *matrixB,
char *resultC,
#if !defined(USE_ONEMKL_CUBLAS)
const bool is_row_major,
#endif // !USE_ONEMKL_CUBLAS
const std::vector<sycl::event> &depends)
{
type_utils::validate_type_for_device<Tab>(exec_q);
Expand Down Expand Up @@ -311,6 +315,7 @@ std::tuple<sycl::event, sycl::event, bool>
std::int64_t lda;
std::int64_t ldb;

// cuBLAS supports only column-major storage
#if defined(USE_ONEMKL_CUBLAS)
const bool is_row_major = false;

Expand Down Expand Up @@ -391,10 +396,17 @@ std::tuple<sycl::event, sycl::event, bool>
const char *b_typeless_ptr = matrixB.get_data();
char *r_typeless_ptr = resultC.get_data();

#if defined(USE_ONEMKL_CUBLAS)
sycl::event gemm_batch_ev =
gemm_batch_fn(exec_q, m, n, k, batch_size, lda, ldb, ldc, stridea,
strideb, stridec, transA, transB, a_typeless_ptr,
b_typeless_ptr, r_typeless_ptr, depends);
#else
sycl::event gemm_batch_ev =
gemm_batch_fn(exec_q, m, n, k, batch_size, lda, ldb, ldc, stridea,
strideb, stridec, transA, transB, a_typeless_ptr,
b_typeless_ptr, r_typeless_ptr, is_row_major, depends);
#endif // USE_ONEMKL_CUBLAS

sycl::event args_ev = dpctl::utils::keep_args_alive(
exec_q, {matrixA, matrixB, resultC}, {gemm_batch_ev});
Expand Down
11 changes: 11 additions & 0 deletions dpnp/backend/extensions/blas/gemv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ typedef sycl::event (*gemv_impl_fn_ptr_t)(sycl::queue &,
const std::int64_t,
char *,
const std::int64_t,
#if !defined(USE_ONEMKL_CUBLAS)
const bool,
#endif // !USE_ONEMKL_CUBLAS
const std::vector<sycl::event> &);

static gemv_impl_fn_ptr_t gemv_dispatch_vector[dpctl_td_ns::num_types];
Expand All @@ -69,7 +71,9 @@ static sycl::event gemv_impl(sycl::queue &exec_q,
const std::int64_t incx,
char *vectorY,
const std::int64_t incy,
#if !defined(USE_ONEMKL_CUBLAS)
const bool is_row_major,
#endif // !USE_ONEMKL_CUBLAS
const std::vector<sycl::event> &depends)
{
type_utils::validate_type_for_device<T>(exec_q);
Expand Down Expand Up @@ -190,6 +194,7 @@ std::pair<sycl::event, sycl::event>
oneapi::mkl::transpose transA;
std::size_t src_nelems;

// cuBLAS supports only column-major storage
#if defined(USE_ONEMKL_CUBLAS)
const bool is_row_major = false;
std::int64_t m;
Expand Down Expand Up @@ -299,9 +304,15 @@ std::pair<sycl::event, sycl::event>
y_typeless_ptr -= (y_shape[0] - 1) * std::abs(incy) * y_elemsize;
}

#if defined(USE_ONEMKL_CUBLAS)
sycl::event gemv_ev =
gemv_fn(exec_q, transA, m, n, a_typeless_ptr, lda, x_typeless_ptr, incx,
y_typeless_ptr, incy, depends);
#else
sycl::event gemv_ev =
gemv_fn(exec_q, transA, m, n, a_typeless_ptr, lda, x_typeless_ptr, incx,
y_typeless_ptr, incy, is_row_major, depends);
#endif // USE_ONEMKL_CUBLAS

sycl::event args_ev = dpctl::utils::keep_args_alive(
exec_q, {matrixA, vectorX, vectorY}, {gemv_ev});
Expand Down
Loading