Skip to content
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

[SYCLomatic]Enable migration for CUBLASLT_MATMUL_DESC_BIAS_DATA_TYPE #2385

Open
wants to merge 2 commits into
base: SYCLomatic
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions clang/lib/DPCT/MapNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1934,6 +1934,9 @@ void MapNames::setExplicitNamespaceMap(
{"CUBLASLT_MATMUL_DESC_SCALE_TYPE",
getLibraryHelperNamespace() +
"blas_gemm::experimental::matmul_desc_t::attribute::scale_type"},
{"CUBLASLT_MATMUL_DESC_BIAS_DATA_TYPE",
getLibraryHelperNamespace() +
"blas_gemm::experimental::matmul_desc_t::attribute::bias_type"},
{"CUBLASLT_MATMUL_DESC_POINTER_MODE",
getLibraryHelperNamespace() +
"blas_gemm::experimental::matmul_desc_t::attribute::pointer_mode"},
Expand Down
5 changes: 4 additions & 1 deletion clang/runtime/dpct-rt/include/dpct/blas_gemm_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class matmul_desc_t {
enum class attribute {
compute_type,
scale_type,
bias_type,
pointer_mode,
trans_a,
trans_b,
Expand All @@ -133,7 +134,7 @@ class matmul_desc_t {
};

matmul_desc_t(compute_type compute_type, library_data_t scale_type)
: _compute_type(compute_type), _scale_type(scale_type) {}
: _compute_type(compute_type), _scale_type(scale_type), _bias_type(bias_type) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no bias_type in the constructor parameter, so you can give a default value directly:

Suggested change
: _compute_type(compute_type), _scale_type(scale_type), _bias_type(bias_type) {}
: _compute_type(compute_type), _scale_type(scale_type), _bias_type(some default value) {}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok Wiill modify this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed to library_data_t for bias_type (similar to scalar type).
@zhiweij1 could you please suggest ? Thanks

Copy link
Contributor

@zhiweij1 zhiweij1 Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

71bac7a is right. But you have not correct the init list of the constructor. Another option is removing , _bias_type(bias_type) in the init list and set the default value at line 179.


void set_attribute(attribute attr, const void *mem) {
if (attr != attribute::unsupport)
Expand All @@ -157,6 +158,7 @@ class matmul_desc_t {
switch (attr) {
CASE(compute_type)
CASE(scale_type)
CASE(bias_type)
CASE(pointer_mode)
CASE(trans_a)
CASE(trans_b)
Expand All @@ -174,6 +176,7 @@ class matmul_desc_t {

compute_type _compute_type;
library_data_t _scale_type;
bias_type _bias_type;
pointer_mode_t _pointer_mode = pointer_mode_t::host;
oneapi::mkl::transpose _trans_a = oneapi::mkl::transpose::nontrans;
oneapi::mkl::transpose _trans_b = oneapi::mkl::transpose::nontrans;
Expand Down
2 changes: 2 additions & 0 deletions clang/test/dpct/cublaslt.cu
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ void foo3() {
// CHECK: dpct::blas_gemm::experimental::matmul_desc_t::attribute d;
// CHECK-NEXT: d = dpct::blas_gemm::experimental::matmul_desc_t::attribute::compute_type;
// CHECK-NEXT: d = dpct::blas_gemm::experimental::matmul_desc_t::attribute::scale_type;
// CHECK-NEXT: d = dpct::blas_gemm::experimental::matmul_desc_t::attribute::bias_type;
// CHECK-NEXT: d = dpct::blas_gemm::experimental::matmul_desc_t::attribute::pointer_mode;
// CHECK-NEXT: d = dpct::blas_gemm::experimental::matmul_desc_t::attribute::trans_a;
// CHECK-NEXT: d = dpct::blas_gemm::experimental::matmul_desc_t::attribute::trans_b;
Expand All @@ -201,6 +202,7 @@ void foo3() {
cublasLtMatmulDescAttributes_t d;
d = CUBLASLT_MATMUL_DESC_COMPUTE_TYPE;
d = CUBLASLT_MATMUL_DESC_SCALE_TYPE;
d = CUBLASLT_MATMUL_DESC_BIAS_DATA_TYPE;
d = CUBLASLT_MATMUL_DESC_POINTER_MODE;
d = CUBLASLT_MATMUL_DESC_TRANSA;
d = CUBLASLT_MATMUL_DESC_TRANSB;
Expand Down