Skip to content

Commit

Permalink
[SYCLomatic] Support migration of cublasLtGetVersion (#2200)
Browse files Browse the repository at this point in the history
Signed-off-by: Jiang, Zhiwei <zhiwei.jiang@intel.com>
  • Loading branch information
zhiweij1 authored Jul 29, 2024
1 parent 8eef643 commit ae766ea
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions clang/lib/DPCT/APINamesCUBLAS.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1646,3 +1646,8 @@ ASSIGNABLE_FACTORY(
"blas_gemm::experimental::matrix_transform",
ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6),
ARG(7), ARG(8), ARG(9), ARG(10))))
WARNING_FACTORY_ENTRY("cublasLtGetVersion",
CALL_FACTORY_ENTRY("cublasLtGetVersion",
CALL(MapNames::getDpctNamespace() +
"dnnl::get_version")),
Diagnostics::TYPE_MISMATCH)
2 changes: 1 addition & 1 deletion clang/lib/DPCT/APINames_cuBLAS.inc
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ ENTRY(cublasDotEx, cublasDotEx, true, NO_FLAG, P4, "DPCT1020")
ENTRY(cublasScalEx, cublasScalEx, true, NO_FLAG, P4, "DPCT1020")
ENTRY(cublasLtCreate, cublasLtCreate, true, NO_FLAG, P4, "DPCT1026/DPCT1027")
ENTRY(cublasLtDestroy, cublasLtDestroy, true, NO_FLAG, P4, "DPCT1026/DPCT1027")
ENTRY(cublasLtGetVersion, cublasLtGetVersion, false, NO_FLAG, P4, "comment")
ENTRY(cublasLtGetVersion, cublasLtGetVersion, true, NO_FLAG, P4, "DPCT1043")
ENTRY(cublasLtGetCudartVersion, cublasLtGetCudartVersion, false, NO_FLAG, P4, "comment")
ENTRY(cublasLtGetProperty, cublasLtGetProperty, false, NO_FLAG, P4, "comment")
ENTRY(cublasLtMatmul, cublasLtMatmul, true, NO_FLAG, P4, "comment")
Expand Down
3 changes: 2 additions & 1 deletion clang/lib/DPCT/ASTTraversal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4234,7 +4234,8 @@ void BLASFunctionCallRule::registerMatcher(MatchFinder &MF) {
"cublasLtMatmulAlgoGetHeuristic", "cublasLtMatrixTransformDescCreate",
"cublasLtMatrixTransformDescDestroy",
"cublasLtMatrixTransformDescSetAttribute",
"cublasLtMatrixTransformDescGetAttribute", "cublasLtMatrixTransform");
"cublasLtMatrixTransformDescGetAttribute", "cublasLtMatrixTransform",
"cublasLtGetVersion");
};

MF.addMatcher(callExpr(allOf(callee(functionDecl(functionName())),
Expand Down
1 change: 1 addition & 0 deletions clang/lib/DPCT/MapNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2134,6 +2134,7 @@ void MapNames::setExplicitNamespaceMap() {
"blas_gemm::experimental::transform_desc_t::get_attribute"},
{"cublasLtMatrixTransform",
getDpctNamespace() + "blas_gemm::experimental::matrix_transform"},
{"cublasLtGetVersion", getDpctNamespace() + "dnnl::get_version"},
};

SOLVERAPIWithRewriter = {"cusolverDnSetAdvOptions",
Expand Down
8 changes: 8 additions & 0 deletions clang/test/dpct/cublaslt.cu
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,11 @@ void foo4() {
cudaStream_t stream;
cublasLtMatrixTransform(lightHandle, transformDesc, alpha, A, Adesc, beta, B, Bdesc, C, Cdesc, stream);
}

void foo5() {
// CHECK: /*
// CHECK-NEXT: DPCT1043:{{[0-9]+}}: The version-related API is different in SYCL. An initial code was generated, but you need to adjust it.
// CHECK-NEXT: */
// CHECK-NEXT: size_t ver = dpct::dnnl::get_version();
size_t ver = cublasLtGetVersion();
}

0 comments on commit ae766ea

Please sign in to comment.