From ef9f17bfb8f73561553109c9c48d8fcc6e738379 Mon Sep 17 00:00:00 2001 From: "Jiang, Zhiwei" Date: Tue, 15 Oct 2024 11:52:38 +0800 Subject: [PATCH 1/9] [SYCLomatic] Add a dummy function to migrate API like getErrorStr/getErrorName Signed-off-by: Jiang, Zhiwei --- clang/lib/DPCT/APINamesCUBLAS.inc | 9 +-- clang/lib/DPCT/APINamesCUSPARSE.inc | 18 ++--- clang/lib/DPCT/APINamesDriver.inc | 10 +-- clang/lib/DPCT/APINamesErrorHandling.inc | 36 ++++------ clang/lib/DPCT/Diagnostics.cpp | 1 - clang/lib/DPCT/Diagnostics.inc | 4 +- clang/lib/DPCT/ExprAnalysis.cpp | 6 ++ clang/runtime/dpct-rt/include/dpct/dpct.hpp | 8 ++- clang/test/dpct/cublas_115.cu | 5 +- clang/test/dpct/cuda-get-error-string.cu | 72 +++++-------------- clang/test/dpct/cudnn-get-error-string.cu | 29 ++------ clang/test/dpct/cusparse-type102.cu | 10 +-- clang/test/dpct/fix_internal_error.cu | 2 +- .../dpct/macro_not_in_inroot/inroot/test.cu | 2 +- clang/test/dpct/nccl_error.cu | 5 +- .../dpct/query_api_mapping/Driver/test.cu | 5 +- .../dpct/query_api_mapping/NCCL/lit_nccl.cu | 5 +- .../dpct/query_api_mapping/Runtime/test.cu | 10 +-- .../query_api_mapping/cuBLAS/blas_11_5.cu | 5 +- .../dpct/query_api_mapping/cuDNN/dnn_part2.cu | 5 +- .../cuSPARSE/lit_cuSPARSE.cu | 10 +-- clang/test/dpct/wildcard_test/abd.cu | 5 +- 22 files changed, 79 insertions(+), 183 deletions(-) diff --git a/clang/lib/DPCT/APINamesCUBLAS.inc b/clang/lib/DPCT/APINamesCUBLAS.inc index 0e7ac16938b2..d4ae2fd2fc8a 100644 --- a/clang/lib/DPCT/APINamesCUBLAS.inc +++ b/clang/lib/DPCT/APINamesCUBLAS.inc @@ -651,12 +651,9 @@ GELS_BATCHED(cublasCgelsBatched) GELS_BATCHED(cublasZgelsBatched) #undef GELS_BATCHED -WARNING_FACTORY_ENTRY( - "cublasGetStatusString", - TOSTRING_FACTORY_ENTRY("cublasGetStatusString", - LITERAL("\"\"")), - Diagnostics::TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, - ARG("The call was replaced by a placeholder string")) +CALL_FACTORY_ENTRY("cublasGetStatusString", + CALL(MapNames::getDpctNamespace() + "get_error_dummy", + ARG_WC(0))) ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY( HelperFeatureEnum::device_ext, diff --git a/clang/lib/DPCT/APINamesCUSPARSE.inc b/clang/lib/DPCT/APINamesCUSPARSE.inc index 605e1a9afe7e..1dd44df85b23 100644 --- a/clang/lib/DPCT/APINamesCUSPARSE.inc +++ b/clang/lib/DPCT/APINamesCUSPARSE.inc @@ -335,18 +335,12 @@ ASSIGNABLE_FACTORY(CALL_FACTORY_ENTRY( "cusparseSpMV", CALL(MapNames::getLibraryHelperNamespace() + "sparse::spmv", MEMBER_CALL(ARG(0), true, "get_queue"), ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7)))) -WARNING_FACTORY_ENTRY( - "cusparseGetErrorString", - TOSTRING_FACTORY_ENTRY("cusparseGetErrorString", - LITERAL("\"\"")), - Diagnostics::TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, - ARG("The call was replaced by a placeholder string")) -WARNING_FACTORY_ENTRY( - "cusparseGetErrorName", - TOSTRING_FACTORY_ENTRY("cusparseGetErrorName", - LITERAL("\"\"")), - Diagnostics::TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, - ARG("The call was replaced by a placeholder string")) +CALL_FACTORY_ENTRY("cusparseGetErrorString", + CALL(MapNames::getDpctNamespace() + "get_error_dummy", + ARG_WC(0))) +CALL_FACTORY_ENTRY("cusparseGetErrorName", + CALL(MapNames::getDpctNamespace() + "get_error_dummy", + ARG_WC(0))) ASSIGNABLE_FACTORY( CALL_FACTORY_ENTRY("cusparseSpGEMM_createDescr", diff --git a/clang/lib/DPCT/APINamesDriver.inc b/clang/lib/DPCT/APINamesDriver.inc index 47f3adcced70..5516a9c71a37 100644 --- a/clang/lib/DPCT/APINamesDriver.inc +++ b/clang/lib/DPCT/APINamesDriver.inc @@ -8,13 +8,9 @@ // clang-format off -WARNING_FACTORY_ENTRY( - "cuGetErrorString", - ASSIGNABLE_FACTORY( - ASSIGN_FACTORY_ENTRY("cuGetErrorString", DEREF(1), - ARG("\"\""))), - Diagnostics::TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, - ARG("The call was replaced by a placeholder string")) +ASSIGNABLE_FACTORY( + ASSIGN_FACTORY_ENTRY("cuGetErrorString", DEREF(1), + CALL(MapNames::getDpctNamespace() + "get_error_dummy", ARG_WC(0)))) FEATURE_REQUEST_FACTORY( HelperFeatureEnum::device_ext, diff --git a/clang/lib/DPCT/APINamesErrorHandling.inc b/clang/lib/DPCT/APINamesErrorHandling.inc index 61b5979ae9ee..bea338200439 100644 --- a/clang/lib/DPCT/APINamesErrorHandling.inc +++ b/clang/lib/DPCT/APINamesErrorHandling.inc @@ -6,26 +6,17 @@ // //===----------------------------------------------------------------------===// -WARNING_FACTORY_ENTRY( - "cudnnGetErrorString", - TOSTRING_FACTORY_ENTRY("cudnnGetErrorString", - LITERAL("\"\"")), - Diagnostics::TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, - ARG("The call was replaced by a placeholder string")) +CALL_FACTORY_ENTRY("cudnnGetErrorString", + CALL(MapNames::getDpctNamespace() + "get_error_dummy", + ARG_WC(0))) -WARNING_FACTORY_ENTRY( - "cudaGetErrorString", - TOSTRING_FACTORY_ENTRY("cudaGetErrorString", - LITERAL("\"\"")), - Diagnostics::TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, - ARG("The call was replaced by a placeholder string")) +CALL_FACTORY_ENTRY("cudaGetErrorString", + CALL(MapNames::getDpctNamespace() + "get_error_dummy", + ARG_WC(0))) -WARNING_FACTORY_ENTRY( - "cudaGetErrorName", - TOSTRING_FACTORY_ENTRY("cudaGetErrorName", - LITERAL("\"\"")), - Diagnostics::TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, - ARG("The call was replaced by a placeholder string")) +CALL_FACTORY_ENTRY("cudaGetErrorName", + CALL(MapNames::getDpctNamespace() + "get_error_dummy", + ARG_WC(0))) CONDITIONAL_FACTORY_ENTRY( checkIsCallExprOnly(), @@ -51,12 +42,9 @@ CONDITIONAL_FACTORY_ENTRY( TOSTRING_FACTORY_ENTRY("cudaPeekAtLastError", LITERAL("0")), Diagnostics::TRNA_WARNING_ERROR_HANDLING_API_REPLACED_0)) -WARNING_FACTORY_ENTRY( - "ncclGetErrorString", - TOSTRING_FACTORY_ENTRY("cublasGetStatusString", - LITERAL("\"\"")), - Diagnostics::TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, - ARG("The call was replaced by a placeholder string")) +CALL_FACTORY_ENTRY("ncclGetErrorString", + CALL(MapNames::getDpctNamespace() + "get_error_dummy", + ARG_WC(0))) CONDITIONAL_FACTORY_ENTRY( checkIsCallExprOnly(), diff --git a/clang/lib/DPCT/Diagnostics.cpp b/clang/lib/DPCT/Diagnostics.cpp index 8d352865ef57..cf284f6860a9 100644 --- a/clang/lib/DPCT/Diagnostics.cpp +++ b/clang/lib/DPCT/Diagnostics.cpp @@ -52,7 +52,6 @@ std::unordered_set APIQueryNeedReportWarningIDSet = { // More IDs may need to be added, like: 1007, 1028, 1030, 1031, 1037, // 1051, 1053, 1067, 1069, 1076, 1082, 1090, 1107. 1008, // API_NOT_MIGRATED_SYCL_UNDEF - 1009, // TRNA_WARNING_ERROR_HANDLING_API_COMMENTED 1014, // STREAM_FLAG_PRIORITY_NOT_SUPPORTED 1023, // MASK_UNSUPPORTED 1029, // DEVICE_LIMIT_NOT_SUPPORTED diff --git a/clang/lib/DPCT/Diagnostics.inc b/clang/lib/DPCT/Diagnostics.inc index c9fe1cd2087b..e78ec9afcc55 100644 --- a/clang/lib/DPCT/Diagnostics.inc +++ b/clang/lib/DPCT/Diagnostics.inc @@ -48,8 +48,8 @@ DEF_WARNING(API_NOT_MIGRATED, 1007, HIGH_LEVEL, "Migration of %0 is not supporte DEF_COMMENT(API_NOT_MIGRATED, 1007, HIGH_LEVEL, "Migration of {0} is not supported.") DEF_WARNING(API_NOT_MIGRATED_SYCL_UNDEF, 1008, HIGH_LEVEL, "%0 function is not defined in SYCL. This is a hardware-specific feature. Consult with your hardware vendor to find a replacement.") DEF_COMMENT(API_NOT_MIGRATED_SYCL_UNDEF, 1008, HIGH_LEVEL, "{0} function is not defined in SYCL. This is a hardware-specific feature. Consult with your hardware vendor to find a replacement.") -DEF_WARNING(TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, 1009, LOW_LEVEL, "SYCL uses exceptions to report errors and does not use the error codes. %0. You need to rewrite this code.") -DEF_COMMENT(TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, 1009, LOW_LEVEL, "SYCL uses exceptions to report errors and does not use the error codes. {0}. You need to rewrite this code.") +DEF_WARNING(TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, 1009, LOW_LEVEL, "deprecated") +DEF_COMMENT(TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, 1009, LOW_LEVEL, "deprecated") DEF_WARNING(TRNA_WARNING_ERROR_HANDLING_API_REPLACED_0, 1010, LOW_LEVEL, "SYCL uses exceptions to report errors and does not use the error codes. The call was replaced with 0. You need to rewrite this code.") DEF_COMMENT(TRNA_WARNING_ERROR_HANDLING_API_REPLACED_0, 1010, LOW_LEVEL, "SYCL uses exceptions to report errors and does not use the error codes. The call was replaced with 0. You need to rewrite this code.") DEF_WARNING(TRNA_WARNING_OVERLOADED_API_FOUND, 1011, LOW_LEVEL, "The tool detected overloaded operators for built-in vector types, which may conflict with the SYCL 2020 standard operators (see 4.14.2.1 Vec interface). The tool inserted a namespace to avoid the conflict. Use SYCL 2020 standard operators instead.") diff --git a/clang/lib/DPCT/ExprAnalysis.cpp b/clang/lib/DPCT/ExprAnalysis.cpp index 255170765e4a..8e8c0ece586f 100644 --- a/clang/lib/DPCT/ExprAnalysis.cpp +++ b/clang/lib/DPCT/ExprAnalysis.cpp @@ -605,6 +605,12 @@ void ExprAnalysis::analyzeExpr(const DeclRefExpr *DRE) { REPLACE_ENUM(MapNames::SPBLASEnumsMap); REPLACE_ENUM(MapNames::CUBEnumsMap); #undef REPLACE_ENUM + std::string TypeName = DpctGlobalInfo::getTypeName(ECD->getType()); + if (TypeName == "cublasStatus_t" || TypeName == "cusparseStatus_t" || + TypeName == "cudaError_enum" || TypeName == "cudnnStatus_t" || + TypeName == "cudaError" || TypeName == "ncclResult_t") { + addReplacement(DRE, toString(ECD->getInitVal(), 10)); + } } } else if (auto VD = dyn_cast(DRE->getDecl())) { if (RefString == "warpSize" && diff --git a/clang/runtime/dpct-rt/include/dpct/dpct.hpp b/clang/runtime/dpct-rt/include/dpct/dpct.hpp index d2559174cf24..f381c1d2f374 100644 --- a/clang/runtime/dpct-rt/include/dpct/dpct.hpp +++ b/clang/runtime/dpct-rt/include/dpct/dpct.hpp @@ -46,9 +46,15 @@ template class dpct_kernel_scalar; #define DPCT_COMPATIBILITY_TEMP (900) -namespace dpct{ +namespace dpct { enum error_code { success = 0, default_error = 999 }; +inline const char *get_error_dummy(int ec) { + static const std::string Msg = + "SYCL uses exceptions to report errors and does not use the error codes. " + "You need to rewrite this code."; + return Msg.c_str(); } +} // namespace dpct #define DPCT_CHECK_ERROR(expr) \ [&]() { \ diff --git a/clang/test/dpct/cublas_115.cu b/clang/test/dpct/cublas_115.cu index f007d59efb27..3dfa27b52199 100644 --- a/clang/test/dpct/cublas_115.cu +++ b/clang/test/dpct/cublas_115.cu @@ -8,10 +8,7 @@ #include void foo1(cublasStatus_t s) { - //CHECK:/* - //CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. - //CHECK-NEXT:*/ - //CHECK-NEXT:printf("Error string: %s", ""); + //CHECK:printf("Error string: %s", dpct::get_error_dummy(s)); printf("Error string: %s", cublasGetStatusString(s)); cublasHandle_t handle; void *workspace; diff --git a/clang/test/dpct/cuda-get-error-string.cu b/clang/test/dpct/cuda-get-error-string.cu index fa2f02aaf27e..c93b8aeb48ae 100644 --- a/clang/test/dpct/cuda-get-error-string.cu +++ b/clang/test/dpct/cuda-get-error-string.cu @@ -4,62 +4,41 @@ int printf(const char *format, ...); -// CHECK: /* -// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// CHECK-NEXT: */ -// CHECK-NEXT: #define PRINT_ERROR_STR(X) printf("%s\n", "") +// CHECK: #define PRINT_ERROR_STR(X) printf("%s\n", dpct::get_error_dummy(X)) #define PRINT_ERROR_STR(X) printf("%s\n", cudaGetErrorString(X)) -// CHECK: /* -// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// CHECK-NEXT: */ -// CHECK-NEXT: #define PRINT_ERROR_STR2(X)\ -// CHECK-NEXT: printf("%s\n", "") +// CHECK: #define PRINT_ERROR_STR2(X)\ +// CHECK-NEXT: printf("%s\n", dpct::get_error_dummy(X)) #define PRINT_ERROR_STR2(X)\ printf("%s\n", cudaGetErrorString(X)) -// CHECK: /* -// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// CHECK-NEXT: */ -// CHECK-NEXT: #define PRINT_ERROR_STR3(X)\ +// CHECK: #define PRINT_ERROR_STR3(X)\ // CHECK-NEXT: printf("%s\ -// CHECK-NEXT: \n", "") +// CHECK-NEXT: \n", dpct::get_error_dummy(X)) #define PRINT_ERROR_STR3(X)\ printf("%s\ \n", cudaGetErrorString(X)) -// CHECK: /* -// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// CHECK-NEXT: */ -// CHECK-NEXT: #define PRINT_ERROR_NAME(X) printf("%s\n", "") +// CHECK: #define PRINT_ERROR_NAME(X) printf("%s\n", dpct::get_error_dummy(X)) #define PRINT_ERROR_NAME(X) printf("%s\n", cudaGetErrorName(X)) -// CHECK: /* -// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// CHECK-NEXT: */ -// CHECK-NEXT: #define PRINT_ERROR_NAME2(X)\ -// CHECK-NEXT: printf("%s\n", "") +// CHECK: #define PRINT_ERROR_NAME2(X)\ +// CHECK-NEXT: printf("%s\n", dpct::get_error_dummy(X)) #define PRINT_ERROR_NAME2(X)\ printf("%s\n", cudaGetErrorName(X)) -// CHECK: /* -// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// CHECK-NEXT: */ -// CHECK-NEXT: #define PRINT_ERROR_NAME3(X)\ +// CHECK: #define PRINT_ERROR_NAME3(X)\ // CHECK-NEXT: printf("%s\ -// CHECK-NEXT: \n", "") +// CHECK-NEXT: \n", dpct::get_error_dummy(X)) #define PRINT_ERROR_NAME3(X)\ printf("%s\ \n", cudaGetErrorName(X)) -// CHECK: /* -// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// CHECK-NEXT: */ -// CHECK-NEXT: #define PRINT_ERROR_STR_NAME(X)\ +// CHECK: #define PRINT_ERROR_STR_NAME(X)\ // CHECK-NEXT: printf("%s\ // CHECK-NEXT: %s\ -// CHECK-NEXT: \n", "",\ -// CHECK-NEXT: "") +// CHECK-NEXT: \n", dpct::get_error_dummy(X),\ +// CHECK-NEXT: dpct::get_error_dummy(X)) #define PRINT_ERROR_STR_NAME(X)\ printf("%s\ %s\ @@ -107,39 +86,24 @@ const char *test_function() { PRINT_ERROR_STR_NAME(cudaSuccess); //CHECK:/* -//CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -//CHECK-NEXT:*/ -//CHECK-NEXT:/* //CHECK-NEXT:DPCT1010:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced with 0. You need to rewrite this code. //CHECK-NEXT:*/ -//CHECK-NEXT: printf("%s\n", ""); +//CHECK-NEXT: printf("%s\n", dpct::get_error_dummy(0)); printf("%s\n", cudaGetErrorString(cudaGetLastError())); -//CHECK:/* -//CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -//CHECK-NEXT:*/ -//CHECK-NEXT: printf("%s\n", ""); +//CHECK: printf("%s\n", dpct::get_error_dummy(0)); printf("%s\n", cudaGetErrorString(cudaSuccess)); -//CHECK:/* -//CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -//CHECK-NEXT:*/ -//CHECK-NEXT:printf("%s\n", ""); +//CHECK:printf("%s\n", dpct::get_error_dummy(0)); printf("%s\n", cudaGetErrorName(cudaSuccess)); CUresult e; const char *err_s; -//CHECK: /* -//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -//CHECK-NEXT: */ -//CHECK-NEXT: err_s = ""; +//CHECK: err_s = dpct::get_error_dummy(e); cuGetErrorString(e, &err_s); -//CHECK:/* -//CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -//CHECK-NEXT:*/ -//CHECK-NEXT: return ""; +//CHECK: return dpct::get_error_dummy(0); return cudaGetErrorName(cudaSuccess); } diff --git a/clang/test/dpct/cudnn-get-error-string.cu b/clang/test/dpct/cudnn-get-error-string.cu index 3d084be459a5..c92d20282bd1 100644 --- a/clang/test/dpct/cudnn-get-error-string.cu +++ b/clang/test/dpct/cudnn-get-error-string.cu @@ -6,26 +6,17 @@ int printf(const char *format, ...); -// CHECK: /* -// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// CHECK-NEXT: */ -// CHECK-NEXT: #define PRINT_ERROR_STR(X) printf("%s\n", "") +// CHECK: #define PRINT_ERROR_STR(X) printf("%s\n", dpct::get_error_dummy(X)) #define PRINT_ERROR_STR(X) printf("%s\n", cudnnGetErrorString(X)) -// CHECK: /* -// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// CHECK-NEXT: */ -// CHECK-NEXT: #define PRINT_ERROR_STR2(X)\ -// CHECK-NEXT: printf("%s\n", "") +// CHECK: #define PRINT_ERROR_STR2(X)\ +// CHECK-NEXT: printf("%s\n", dpct::get_error_dummy(X)) #define PRINT_ERROR_STR2(X)\ printf("%s\n", cudnnGetErrorString(X)) -// CHECK: /* -// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// CHECK-NEXT: */ -// CHECK-NEXT: #define PRINT_ERROR_STR3(X)\ +// CHECK: #define PRINT_ERROR_STR3(X)\ // CHECK-NEXT: printf("%s\ -// CHECK-NEXT: \n", "") +// CHECK-NEXT: \n", dpct::get_error_dummy(X)) #define PRINT_ERROR_STR3(X)\ printf("%s\ \n", cudnnGetErrorString(X)) @@ -33,16 +24,10 @@ int printf(const char *format, ...); const char *test_function(cudnnStatus_t status) { -//CHECK:/* -//CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -//CHECK-NEXT:*/ -//CHECK-NEXT: printf("%s\n", ""); +//CHECK: printf("%s\n", dpct::get_error_dummy(status)); printf("%s\n", cudnnGetErrorString(status)); -//CHECK:/* -//CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -//CHECK-NEXT:*/ -//CHECK-NEXT: printf("%s\n", ""); +//CHECK: printf("%s\n", dpct::get_error_dummy(0)); printf("%s\n", cudnnGetErrorString(CUDNN_STATUS_SUCCESS)); PRINT_ERROR_STR(status); diff --git a/clang/test/dpct/cusparse-type102.cu b/clang/test/dpct/cusparse-type102.cu index 109f036f1c63..d1e1578854ef 100644 --- a/clang/test/dpct/cusparse-type102.cu +++ b/clang/test/dpct/cusparse-type102.cu @@ -14,14 +14,8 @@ int main() { cusparseStatus_t a6; a6 = CUSPARSE_STATUS_NOT_SUPPORTED; - //CHECK:/* - //CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. - //CHECK-NEXT:*/ - //CHECK-NEXT:printf("Error string: %s", ""); - //CHECK-NEXT:/* - //CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. - //CHECK-NEXT:*/ - //CHECK-NEXT:printf("Error name: %s", ""); + //CHECK:printf("Error string: %s", dpct::get_error_dummy(a6)); + //CHECK-NEXT:printf("Error name: %s", dpct::get_error_dummy(a6)); printf("Error string: %s", cusparseGetErrorString(a6)); printf("Error name: %s", cusparseGetErrorName(a6)); diff --git a/clang/test/dpct/fix_internal_error.cu b/clang/test/dpct/fix_internal_error.cu index a8b4762e0205..1a01dc0b1e4f 100644 --- a/clang/test/dpct/fix_internal_error.cu +++ b/clang/test/dpct/fix_internal_error.cu @@ -60,7 +60,7 @@ public: //CHECK-NEXT: do { \ //CHECK-NEXT: dpct::err0 e = ARG; \ //CHECK-NEXT: if (e != 0) { \ -//CHECK-NEXT: throw MY_EXCEPTION(uint32_t(__LINE__), ""); \ +//CHECK-NEXT: throw MY_EXCEPTION(uint32_t(__LINE__), dpct::get_error_dummy(e)); \ //CHECK-NEXT: } \ //CHECK-NEXT: } while (0) diff --git a/clang/test/dpct/macro_not_in_inroot/inroot/test.cu b/clang/test/dpct/macro_not_in_inroot/inroot/test.cu index a0b9988980dc..da26ca0f64f1 100644 --- a/clang/test/dpct/macro_not_in_inroot/inroot/test.cu +++ b/clang/test/dpct/macro_not_in_inroot/inroot/test.cu @@ -9,7 +9,7 @@ void foo() {} // CHECK: #define MACRO_B \ // CHECK-NEXT: foo();\ -// CHECK-NEXT: MACRO(""); +// CHECK-NEXT: MACRO(dpct::get_error_dummy(1)); #define MACRO_B \ foo();\ MACRO(cudaGetErrorString(cudaErrorInvalidValue)); diff --git a/clang/test/dpct/nccl_error.cu b/clang/test/dpct/nccl_error.cu index 779adbe9e1c0..a815f4704c04 100644 --- a/clang/test/dpct/nccl_error.cu +++ b/clang/test/dpct/nccl_error.cu @@ -36,10 +36,7 @@ int main(){ // CHECK: case int(oneapi::ccl::datatype::int32): std::cout << "Int32" << std::endl; break; case ncclInt32: std::cout << "Int32" << std::endl; break; } - // CHECK: /* - // CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. - // CHECK-NEXT: */ - // CHECK-NEXT: ""; + // CHECK: dpct::get_error_dummy(res); ncclGetErrorString(res); // CHECK: /* // CHECK-NEXT: DPCT1026:{{[0-9]+}}: The call to ncclGetLastError was removed because this functionality is redundant in SYCL. diff --git a/clang/test/dpct/query_api_mapping/Driver/test.cu b/clang/test/dpct/query_api_mapping/Driver/test.cu index 7cc9cf22f92d..af9c7525dd83 100644 --- a/clang/test/dpct/query_api_mapping/Driver/test.cu +++ b/clang/test/dpct/query_api_mapping/Driver/test.cu @@ -4,10 +4,7 @@ // CUGETERRORSTRING: CUDA API: // CUGETERRORSTRING-NEXT: cuGetErrorString(r /*CUresult*/, ppc /*const char ***/); // CUGETERRORSTRING-NEXT: Is migrated to: -// CUGETERRORSTRING-NEXT: /* -// CUGETERRORSTRING-NEXT: DPCT1009:0: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// CUGETERRORSTRING-NEXT: */ -// CUGETERRORSTRING-NEXT: *ppc = ""; +// CUGETERRORSTRING-NEXT: *ppc = dpct::get_error_dummy(r); /// Initialization diff --git a/clang/test/dpct/query_api_mapping/NCCL/lit_nccl.cu b/clang/test/dpct/query_api_mapping/NCCL/lit_nccl.cu index 3b56ce7bf422..aa114b2c51bd 100644 --- a/clang/test/dpct/query_api_mapping/NCCL/lit_nccl.cu +++ b/clang/test/dpct/query_api_mapping/NCCL/lit_nccl.cu @@ -10,10 +10,7 @@ // NCCLGETERRORSTRING: CUDA API: // NCCLGETERRORSTRING-NEXT: ncclGetErrorString(r /*ncclResult_t*/); // NCCLGETERRORSTRING-NEXT: Is migrated to: -// NCCLGETERRORSTRING-NEXT: /* -// NCCLGETERRORSTRING-NEXT: DPCT1009:0: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// NCCLGETERRORSTRING-NEXT: */ -// NCCLGETERRORSTRING-NEXT: ""; +// NCCLGETERRORSTRING-NEXT: dpct::get_error_dummy(r); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=ncclGetVersion | FileCheck %s -check-prefix=ncclGetVersion // ncclGetVersion: CUDA API: diff --git a/clang/test/dpct/query_api_mapping/Runtime/test.cu b/clang/test/dpct/query_api_mapping/Runtime/test.cu index 2593de4df56b..140c4d62f50b 100644 --- a/clang/test/dpct/query_api_mapping/Runtime/test.cu +++ b/clang/test/dpct/query_api_mapping/Runtime/test.cu @@ -164,19 +164,13 @@ // CUDAGETERRORNAME: CUDA API: // CUDAGETERRORNAME-NEXT: cudaGetErrorName(e /*cudaError_t*/); // CUDAGETERRORNAME-NEXT: Is migrated to: -// CUDAGETERRORNAME-NEXT: /* -// CUDAGETERRORNAME-NEXT: DPCT1009:0: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// CUDAGETERRORNAME-NEXT: */ -// CUDAGETERRORNAME-NEXT: ""; +// CUDAGETERRORNAME-NEXT: dpct::get_error_dummy(e); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGetErrorString | FileCheck %s -check-prefix=CUDAGETERRORSTRING // CUDAGETERRORSTRING: CUDA API: // CUDAGETERRORSTRING-NEXT: cudaGetErrorString(e /*cudaError_t*/); // CUDAGETERRORSTRING-NEXT: Is migrated to: -// CUDAGETERRORSTRING-NEXT: /* -// CUDAGETERRORSTRING-NEXT: DPCT1009:0: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// CUDAGETERRORSTRING-NEXT: */ -// CUDAGETERRORSTRING-NEXT: ""; +// CUDAGETERRORSTRING-NEXT: dpct::get_error_dummy(e); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGetLastError | FileCheck %s -check-prefix=CUDAGETLASTERROR // CUDAGETLASTERROR: CUDA API: diff --git a/clang/test/dpct/query_api_mapping/cuBLAS/blas_11_5.cu b/clang/test/dpct/query_api_mapping/cuBLAS/blas_11_5.cu index 010ba7708230..135f5bafab30 100644 --- a/clang/test/dpct/query_api_mapping/cuBLAS/blas_11_5.cu +++ b/clang/test/dpct/query_api_mapping/cuBLAS/blas_11_5.cu @@ -5,7 +5,4 @@ // cublasGetStatusString: CUDA API: // cublasGetStatusString-NEXT: res /*const char **/ = cublasGetStatusString(status /*cublasStatus_t*/); // cublasGetStatusString-NEXT: Is migrated to: -// cublasGetStatusString-NEXT: /* -// cublasGetStatusString-NEXT: DPCT1009:0: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// cublasGetStatusString-NEXT: */ -// cublasGetStatusString-NEXT: res /*const char **/ = ""; +// cublasGetStatusString-NEXT: res /*const char **/ = dpct::get_error_dummy(status); diff --git a/clang/test/dpct/query_api_mapping/cuDNN/dnn_part2.cu b/clang/test/dpct/query_api_mapping/cuDNN/dnn_part2.cu index d6c20c15e493..4406d873131c 100644 --- a/clang/test/dpct/query_api_mapping/cuDNN/dnn_part2.cu +++ b/clang/test/dpct/query_api_mapping/cuDNN/dnn_part2.cu @@ -236,10 +236,7 @@ // cudnnGetErrorString: CUDA API: // cudnnGetErrorString-NEXT: r = cudnnGetErrorString(s /*cudnnStatus_t*/); // cudnnGetErrorString-NEXT: Is migrated to: -// cudnnGetErrorString-NEXT: /* -// cudnnGetErrorString-NEXT: DPCT1009:0: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// cudnnGetErrorString-NEXT: */ -// cudnnGetErrorString-NEXT: r = ""; +// cudnnGetErrorString-NEXT: r = dpct::get_error_dummy(s); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudnnGetFilter4dDescriptor | FileCheck %s -check-prefix=cudnnGetFilter4dDescriptor // cudnnGetFilter4dDescriptor: CUDA API: diff --git a/clang/test/dpct/query_api_mapping/cuSPARSE/lit_cuSPARSE.cu b/clang/test/dpct/query_api_mapping/cuSPARSE/lit_cuSPARSE.cu index 619ff2384998..16eee12acdd6 100644 --- a/clang/test/dpct/query_api_mapping/cuSPARSE/lit_cuSPARSE.cu +++ b/clang/test/dpct/query_api_mapping/cuSPARSE/lit_cuSPARSE.cu @@ -209,19 +209,13 @@ // cusparseGetErrorName: CUDA API: // cusparseGetErrorName-NEXT: const char *Name = cusparseGetErrorName(status /*cusparseStatus_t*/); // cusparseGetErrorName-NEXT: Is migrated to: -// cusparseGetErrorName-NEXT: /* -// cusparseGetErrorName-NEXT: DPCT1009:0: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// cusparseGetErrorName-NEXT: */ -// cusparseGetErrorName-NEXT: const char *Name = ""; +// cusparseGetErrorName-NEXT: const char *Name = dpct::get_error_dummy(status); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cusparseGetErrorString | FileCheck %s -check-prefix=cusparseGetErrorString // cusparseGetErrorString: CUDA API: // cusparseGetErrorString-NEXT: const char *Str = cusparseGetErrorString(status /*cusparseStatus_t*/); // cusparseGetErrorString-NEXT: Is migrated to: -// cusparseGetErrorString-NEXT: /* -// cusparseGetErrorString-NEXT: DPCT1009:0: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -// cusparseGetErrorString-NEXT: */ -// cusparseGetErrorString-NEXT: const char *Str = ""; +// cusparseGetErrorString-NEXT: const char *Str = dpct::get_error_dummy(status); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cusparseGetProperty | FileCheck %s -check-prefix=cusparseGetProperty // cusparseGetProperty: CUDA API: diff --git a/clang/test/dpct/wildcard_test/abd.cu b/clang/test/dpct/wildcard_test/abd.cu index 546cbf5f8cd7..c81da994cb76 100644 --- a/clang/test/dpct/wildcard_test/abd.cu +++ b/clang/test/dpct/wildcard_test/abd.cu @@ -9,11 +9,8 @@ int printf(const char *format, ...); const char *test_function() { //CHECK:/* -//CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced by a placeholder string. You need to rewrite this code. -//CHECK-NEXT:*/ -//CHECK-NEXT:/* //CHECK-NEXT:DPCT1010:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced with 0. You need to rewrite this code. //CHECK-NEXT:*/ -//CHECK-NEXT: printf("%s\n", ""); +//CHECK-NEXT: printf("%s\n", dpct::get_error_dummy(0)); printf("%s\n", cudaGetErrorString(cudaGetLastError())); } From 8fab02d94ef8622c2d5252220939877def5ce930 Mon Sep 17 00:00:00 2001 From: "Jiang, Zhiwei" Date: Wed, 16 Oct 2024 16:43:36 +0800 Subject: [PATCH 2/9] Update Signed-off-by: Jiang, Zhiwei --- clang/lib/DPCT/APINamesCUBLAS.inc | 2 +- clang/lib/DPCT/APINamesCUSPARSE.inc | 4 +-- clang/lib/DPCT/APINamesDriver.inc | 2 +- clang/lib/DPCT/APINamesErrorHandling.inc | 8 +++--- clang/runtime/dpct-rt/include/dpct/dpct.hpp | 12 +++++---- clang/test/dpct/cublas_115.cu | 2 +- clang/test/dpct/cuda-get-error-string.cu | 26 +++++++++---------- clang/test/dpct/cudnn-get-error-string.cu | 10 +++---- clang/test/dpct/cusparse-type102.cu | 4 +-- clang/test/dpct/fix_internal_error.cu | 2 +- .../dpct/macro_not_in_inroot/inroot/test.cu | 2 +- clang/test/dpct/nccl_error.cu | 2 +- .../dpct/query_api_mapping/Driver/test.cu | 2 +- .../dpct/query_api_mapping/NCCL/lit_nccl.cu | 2 +- .../dpct/query_api_mapping/Runtime/test.cu | 4 +-- .../query_api_mapping/cuBLAS/blas_11_5.cu | 2 +- .../dpct/query_api_mapping/cuDNN/dnn_part2.cu | 2 +- .../cuSPARSE/lit_cuSPARSE.cu | 4 +-- clang/test/dpct/wildcard_test/abd.cu | 2 +- 19 files changed, 48 insertions(+), 46 deletions(-) diff --git a/clang/lib/DPCT/APINamesCUBLAS.inc b/clang/lib/DPCT/APINamesCUBLAS.inc index d4ae2fd2fc8a..dcb286e4f03e 100644 --- a/clang/lib/DPCT/APINamesCUBLAS.inc +++ b/clang/lib/DPCT/APINamesCUBLAS.inc @@ -652,7 +652,7 @@ GELS_BATCHED(cublasZgelsBatched) #undef GELS_BATCHED CALL_FACTORY_ENTRY("cublasGetStatusString", - CALL(MapNames::getDpctNamespace() + "get_error_dummy", + CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", ARG_WC(0))) ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY( diff --git a/clang/lib/DPCT/APINamesCUSPARSE.inc b/clang/lib/DPCT/APINamesCUSPARSE.inc index 1dd44df85b23..906cfbae07aa 100644 --- a/clang/lib/DPCT/APINamesCUSPARSE.inc +++ b/clang/lib/DPCT/APINamesCUSPARSE.inc @@ -336,10 +336,10 @@ ASSIGNABLE_FACTORY(CALL_FACTORY_ENTRY( MEMBER_CALL(ARG(0), true, "get_queue"), ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7)))) CALL_FACTORY_ENTRY("cusparseGetErrorString", - CALL(MapNames::getDpctNamespace() + "get_error_dummy", + CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", ARG_WC(0))) CALL_FACTORY_ENTRY("cusparseGetErrorName", - CALL(MapNames::getDpctNamespace() + "get_error_dummy", + CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", ARG_WC(0))) ASSIGNABLE_FACTORY( diff --git a/clang/lib/DPCT/APINamesDriver.inc b/clang/lib/DPCT/APINamesDriver.inc index 5516a9c71a37..e8d150e8965b 100644 --- a/clang/lib/DPCT/APINamesDriver.inc +++ b/clang/lib/DPCT/APINamesDriver.inc @@ -10,7 +10,7 @@ ASSIGNABLE_FACTORY( ASSIGN_FACTORY_ENTRY("cuGetErrorString", DEREF(1), - CALL(MapNames::getDpctNamespace() + "get_error_dummy", ARG_WC(0)))) + CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", ARG_WC(0)))) FEATURE_REQUEST_FACTORY( HelperFeatureEnum::device_ext, diff --git a/clang/lib/DPCT/APINamesErrorHandling.inc b/clang/lib/DPCT/APINamesErrorHandling.inc index bea338200439..25954cbd0981 100644 --- a/clang/lib/DPCT/APINamesErrorHandling.inc +++ b/clang/lib/DPCT/APINamesErrorHandling.inc @@ -7,15 +7,15 @@ //===----------------------------------------------------------------------===// CALL_FACTORY_ENTRY("cudnnGetErrorString", - CALL(MapNames::getDpctNamespace() + "get_error_dummy", + CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", ARG_WC(0))) CALL_FACTORY_ENTRY("cudaGetErrorString", - CALL(MapNames::getDpctNamespace() + "get_error_dummy", + CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", ARG_WC(0))) CALL_FACTORY_ENTRY("cudaGetErrorName", - CALL(MapNames::getDpctNamespace() + "get_error_dummy", + CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", ARG_WC(0))) CONDITIONAL_FACTORY_ENTRY( @@ -43,7 +43,7 @@ CONDITIONAL_FACTORY_ENTRY( Diagnostics::TRNA_WARNING_ERROR_HANDLING_API_REPLACED_0)) CALL_FACTORY_ENTRY("ncclGetErrorString", - CALL(MapNames::getDpctNamespace() + "get_error_dummy", + CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", ARG_WC(0))) CONDITIONAL_FACTORY_ENTRY( diff --git a/clang/runtime/dpct-rt/include/dpct/dpct.hpp b/clang/runtime/dpct-rt/include/dpct/dpct.hpp index f381c1d2f374..d1c6e4304286 100644 --- a/clang/runtime/dpct-rt/include/dpct/dpct.hpp +++ b/clang/runtime/dpct-rt/include/dpct/dpct.hpp @@ -48,11 +48,13 @@ template class dpct_kernel_scalar; namespace dpct { enum error_code { success = 0, default_error = 999 }; -inline const char *get_error_dummy(int ec) { - static const std::string Msg = - "SYCL uses exceptions to report errors and does not use the error codes. " - "You need to rewrite this code."; - return Msg.c_str(); +/// A dummy function introduced to assist auto migration. +/// It needs to be replaced with a real error-handling function. SYCL reports +/// errors using exceptions and does not use error codes. +inline const char *get_error_string_dummy(int ec) { + (void)ec; + return ""; // Return the error string for the error code + // ec. } } // namespace dpct diff --git a/clang/test/dpct/cublas_115.cu b/clang/test/dpct/cublas_115.cu index 3dfa27b52199..89a290b1f562 100644 --- a/clang/test/dpct/cublas_115.cu +++ b/clang/test/dpct/cublas_115.cu @@ -8,7 +8,7 @@ #include void foo1(cublasStatus_t s) { - //CHECK:printf("Error string: %s", dpct::get_error_dummy(s)); + //CHECK:printf("Error string: %s", dpct::get_error_string_dummy(s)); printf("Error string: %s", cublasGetStatusString(s)); cublasHandle_t handle; void *workspace; diff --git a/clang/test/dpct/cuda-get-error-string.cu b/clang/test/dpct/cuda-get-error-string.cu index c93b8aeb48ae..6d54d31938a2 100644 --- a/clang/test/dpct/cuda-get-error-string.cu +++ b/clang/test/dpct/cuda-get-error-string.cu @@ -4,32 +4,32 @@ int printf(const char *format, ...); -// CHECK: #define PRINT_ERROR_STR(X) printf("%s\n", dpct::get_error_dummy(X)) +// CHECK: #define PRINT_ERROR_STR(X) printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR(X) printf("%s\n", cudaGetErrorString(X)) // CHECK: #define PRINT_ERROR_STR2(X)\ -// CHECK-NEXT: printf("%s\n", dpct::get_error_dummy(X)) +// CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR2(X)\ printf("%s\n", cudaGetErrorString(X)) // CHECK: #define PRINT_ERROR_STR3(X)\ // CHECK-NEXT: printf("%s\ -// CHECK-NEXT: \n", dpct::get_error_dummy(X)) +// CHECK-NEXT: \n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR3(X)\ printf("%s\ \n", cudaGetErrorString(X)) -// CHECK: #define PRINT_ERROR_NAME(X) printf("%s\n", dpct::get_error_dummy(X)) +// CHECK: #define PRINT_ERROR_NAME(X) printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_NAME(X) printf("%s\n", cudaGetErrorName(X)) // CHECK: #define PRINT_ERROR_NAME2(X)\ -// CHECK-NEXT: printf("%s\n", dpct::get_error_dummy(X)) +// CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_NAME2(X)\ printf("%s\n", cudaGetErrorName(X)) // CHECK: #define PRINT_ERROR_NAME3(X)\ // CHECK-NEXT: printf("%s\ -// CHECK-NEXT: \n", dpct::get_error_dummy(X)) +// CHECK-NEXT: \n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_NAME3(X)\ printf("%s\ \n", cudaGetErrorName(X)) @@ -37,8 +37,8 @@ int printf(const char *format, ...); // CHECK: #define PRINT_ERROR_STR_NAME(X)\ // CHECK-NEXT: printf("%s\ // CHECK-NEXT: %s\ -// CHECK-NEXT: \n", dpct::get_error_dummy(X),\ -// CHECK-NEXT: dpct::get_error_dummy(X)) +// CHECK-NEXT: \n", dpct::get_error_string_dummy(X),\ +// CHECK-NEXT: dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR_NAME(X)\ printf("%s\ %s\ @@ -88,22 +88,22 @@ const char *test_function() { //CHECK:/* //CHECK-NEXT:DPCT1010:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced with 0. You need to rewrite this code. //CHECK-NEXT:*/ -//CHECK-NEXT: printf("%s\n", dpct::get_error_dummy(0)); +//CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(0)); printf("%s\n", cudaGetErrorString(cudaGetLastError())); -//CHECK: printf("%s\n", dpct::get_error_dummy(0)); +//CHECK: printf("%s\n", dpct::get_error_string_dummy(0)); printf("%s\n", cudaGetErrorString(cudaSuccess)); -//CHECK:printf("%s\n", dpct::get_error_dummy(0)); +//CHECK:printf("%s\n", dpct::get_error_string_dummy(0)); printf("%s\n", cudaGetErrorName(cudaSuccess)); CUresult e; const char *err_s; -//CHECK: err_s = dpct::get_error_dummy(e); +//CHECK: err_s = dpct::get_error_string_dummy(e); cuGetErrorString(e, &err_s); -//CHECK: return dpct::get_error_dummy(0); +//CHECK: return dpct::get_error_string_dummy(0); return cudaGetErrorName(cudaSuccess); } diff --git a/clang/test/dpct/cudnn-get-error-string.cu b/clang/test/dpct/cudnn-get-error-string.cu index c92d20282bd1..62bea3737f6c 100644 --- a/clang/test/dpct/cudnn-get-error-string.cu +++ b/clang/test/dpct/cudnn-get-error-string.cu @@ -6,17 +6,17 @@ int printf(const char *format, ...); -// CHECK: #define PRINT_ERROR_STR(X) printf("%s\n", dpct::get_error_dummy(X)) +// CHECK: #define PRINT_ERROR_STR(X) printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR(X) printf("%s\n", cudnnGetErrorString(X)) // CHECK: #define PRINT_ERROR_STR2(X)\ -// CHECK-NEXT: printf("%s\n", dpct::get_error_dummy(X)) +// CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR2(X)\ printf("%s\n", cudnnGetErrorString(X)) // CHECK: #define PRINT_ERROR_STR3(X)\ // CHECK-NEXT: printf("%s\ -// CHECK-NEXT: \n", dpct::get_error_dummy(X)) +// CHECK-NEXT: \n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR3(X)\ printf("%s\ \n", cudnnGetErrorString(X)) @@ -24,10 +24,10 @@ int printf(const char *format, ...); const char *test_function(cudnnStatus_t status) { -//CHECK: printf("%s\n", dpct::get_error_dummy(status)); +//CHECK: printf("%s\n", dpct::get_error_string_dummy(status)); printf("%s\n", cudnnGetErrorString(status)); -//CHECK: printf("%s\n", dpct::get_error_dummy(0)); +//CHECK: printf("%s\n", dpct::get_error_string_dummy(0)); printf("%s\n", cudnnGetErrorString(CUDNN_STATUS_SUCCESS)); PRINT_ERROR_STR(status); diff --git a/clang/test/dpct/cusparse-type102.cu b/clang/test/dpct/cusparse-type102.cu index d1e1578854ef..2fed6bbf4468 100644 --- a/clang/test/dpct/cusparse-type102.cu +++ b/clang/test/dpct/cusparse-type102.cu @@ -14,8 +14,8 @@ int main() { cusparseStatus_t a6; a6 = CUSPARSE_STATUS_NOT_SUPPORTED; - //CHECK:printf("Error string: %s", dpct::get_error_dummy(a6)); - //CHECK-NEXT:printf("Error name: %s", dpct::get_error_dummy(a6)); + //CHECK:printf("Error string: %s", dpct::get_error_string_dummy(a6)); + //CHECK-NEXT:printf("Error name: %s", dpct::get_error_string_dummy(a6)); printf("Error string: %s", cusparseGetErrorString(a6)); printf("Error name: %s", cusparseGetErrorName(a6)); diff --git a/clang/test/dpct/fix_internal_error.cu b/clang/test/dpct/fix_internal_error.cu index 1a01dc0b1e4f..9715dc885477 100644 --- a/clang/test/dpct/fix_internal_error.cu +++ b/clang/test/dpct/fix_internal_error.cu @@ -60,7 +60,7 @@ public: //CHECK-NEXT: do { \ //CHECK-NEXT: dpct::err0 e = ARG; \ //CHECK-NEXT: if (e != 0) { \ -//CHECK-NEXT: throw MY_EXCEPTION(uint32_t(__LINE__), dpct::get_error_dummy(e)); \ +//CHECK-NEXT: throw MY_EXCEPTION(uint32_t(__LINE__), dpct::get_error_string_dummy(e)); \ //CHECK-NEXT: } \ //CHECK-NEXT: } while (0) diff --git a/clang/test/dpct/macro_not_in_inroot/inroot/test.cu b/clang/test/dpct/macro_not_in_inroot/inroot/test.cu index da26ca0f64f1..1928b9b65320 100644 --- a/clang/test/dpct/macro_not_in_inroot/inroot/test.cu +++ b/clang/test/dpct/macro_not_in_inroot/inroot/test.cu @@ -9,7 +9,7 @@ void foo() {} // CHECK: #define MACRO_B \ // CHECK-NEXT: foo();\ -// CHECK-NEXT: MACRO(dpct::get_error_dummy(1)); +// CHECK-NEXT: MACRO(dpct::get_error_string_dummy(1)); #define MACRO_B \ foo();\ MACRO(cudaGetErrorString(cudaErrorInvalidValue)); diff --git a/clang/test/dpct/nccl_error.cu b/clang/test/dpct/nccl_error.cu index a815f4704c04..a55bd64bf527 100644 --- a/clang/test/dpct/nccl_error.cu +++ b/clang/test/dpct/nccl_error.cu @@ -36,7 +36,7 @@ int main(){ // CHECK: case int(oneapi::ccl::datatype::int32): std::cout << "Int32" << std::endl; break; case ncclInt32: std::cout << "Int32" << std::endl; break; } - // CHECK: dpct::get_error_dummy(res); + // CHECK: dpct::get_error_string_dummy(res); ncclGetErrorString(res); // CHECK: /* // CHECK-NEXT: DPCT1026:{{[0-9]+}}: The call to ncclGetLastError was removed because this functionality is redundant in SYCL. diff --git a/clang/test/dpct/query_api_mapping/Driver/test.cu b/clang/test/dpct/query_api_mapping/Driver/test.cu index af9c7525dd83..efe80e97ad65 100644 --- a/clang/test/dpct/query_api_mapping/Driver/test.cu +++ b/clang/test/dpct/query_api_mapping/Driver/test.cu @@ -4,7 +4,7 @@ // CUGETERRORSTRING: CUDA API: // CUGETERRORSTRING-NEXT: cuGetErrorString(r /*CUresult*/, ppc /*const char ***/); // CUGETERRORSTRING-NEXT: Is migrated to: -// CUGETERRORSTRING-NEXT: *ppc = dpct::get_error_dummy(r); +// CUGETERRORSTRING-NEXT: *ppc = dpct::get_error_string_dummy(r); /// Initialization diff --git a/clang/test/dpct/query_api_mapping/NCCL/lit_nccl.cu b/clang/test/dpct/query_api_mapping/NCCL/lit_nccl.cu index aa114b2c51bd..793463bbef39 100644 --- a/clang/test/dpct/query_api_mapping/NCCL/lit_nccl.cu +++ b/clang/test/dpct/query_api_mapping/NCCL/lit_nccl.cu @@ -10,7 +10,7 @@ // NCCLGETERRORSTRING: CUDA API: // NCCLGETERRORSTRING-NEXT: ncclGetErrorString(r /*ncclResult_t*/); // NCCLGETERRORSTRING-NEXT: Is migrated to: -// NCCLGETERRORSTRING-NEXT: dpct::get_error_dummy(r); +// NCCLGETERRORSTRING-NEXT: dpct::get_error_string_dummy(r); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=ncclGetVersion | FileCheck %s -check-prefix=ncclGetVersion // ncclGetVersion: CUDA API: diff --git a/clang/test/dpct/query_api_mapping/Runtime/test.cu b/clang/test/dpct/query_api_mapping/Runtime/test.cu index 140c4d62f50b..b106b0603c76 100644 --- a/clang/test/dpct/query_api_mapping/Runtime/test.cu +++ b/clang/test/dpct/query_api_mapping/Runtime/test.cu @@ -164,13 +164,13 @@ // CUDAGETERRORNAME: CUDA API: // CUDAGETERRORNAME-NEXT: cudaGetErrorName(e /*cudaError_t*/); // CUDAGETERRORNAME-NEXT: Is migrated to: -// CUDAGETERRORNAME-NEXT: dpct::get_error_dummy(e); +// CUDAGETERRORNAME-NEXT: dpct::get_error_string_dummy(e); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGetErrorString | FileCheck %s -check-prefix=CUDAGETERRORSTRING // CUDAGETERRORSTRING: CUDA API: // CUDAGETERRORSTRING-NEXT: cudaGetErrorString(e /*cudaError_t*/); // CUDAGETERRORSTRING-NEXT: Is migrated to: -// CUDAGETERRORSTRING-NEXT: dpct::get_error_dummy(e); +// CUDAGETERRORSTRING-NEXT: dpct::get_error_string_dummy(e); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGetLastError | FileCheck %s -check-prefix=CUDAGETLASTERROR // CUDAGETLASTERROR: CUDA API: diff --git a/clang/test/dpct/query_api_mapping/cuBLAS/blas_11_5.cu b/clang/test/dpct/query_api_mapping/cuBLAS/blas_11_5.cu index 135f5bafab30..6a714346e8b2 100644 --- a/clang/test/dpct/query_api_mapping/cuBLAS/blas_11_5.cu +++ b/clang/test/dpct/query_api_mapping/cuBLAS/blas_11_5.cu @@ -5,4 +5,4 @@ // cublasGetStatusString: CUDA API: // cublasGetStatusString-NEXT: res /*const char **/ = cublasGetStatusString(status /*cublasStatus_t*/); // cublasGetStatusString-NEXT: Is migrated to: -// cublasGetStatusString-NEXT: res /*const char **/ = dpct::get_error_dummy(status); +// cublasGetStatusString-NEXT: res /*const char **/ = dpct::get_error_string_dummy(status); diff --git a/clang/test/dpct/query_api_mapping/cuDNN/dnn_part2.cu b/clang/test/dpct/query_api_mapping/cuDNN/dnn_part2.cu index 4406d873131c..792608d765d5 100644 --- a/clang/test/dpct/query_api_mapping/cuDNN/dnn_part2.cu +++ b/clang/test/dpct/query_api_mapping/cuDNN/dnn_part2.cu @@ -236,7 +236,7 @@ // cudnnGetErrorString: CUDA API: // cudnnGetErrorString-NEXT: r = cudnnGetErrorString(s /*cudnnStatus_t*/); // cudnnGetErrorString-NEXT: Is migrated to: -// cudnnGetErrorString-NEXT: r = dpct::get_error_dummy(s); +// cudnnGetErrorString-NEXT: r = dpct::get_error_string_dummy(s); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudnnGetFilter4dDescriptor | FileCheck %s -check-prefix=cudnnGetFilter4dDescriptor // cudnnGetFilter4dDescriptor: CUDA API: diff --git a/clang/test/dpct/query_api_mapping/cuSPARSE/lit_cuSPARSE.cu b/clang/test/dpct/query_api_mapping/cuSPARSE/lit_cuSPARSE.cu index 16eee12acdd6..cfa098a20992 100644 --- a/clang/test/dpct/query_api_mapping/cuSPARSE/lit_cuSPARSE.cu +++ b/clang/test/dpct/query_api_mapping/cuSPARSE/lit_cuSPARSE.cu @@ -209,13 +209,13 @@ // cusparseGetErrorName: CUDA API: // cusparseGetErrorName-NEXT: const char *Name = cusparseGetErrorName(status /*cusparseStatus_t*/); // cusparseGetErrorName-NEXT: Is migrated to: -// cusparseGetErrorName-NEXT: const char *Name = dpct::get_error_dummy(status); +// cusparseGetErrorName-NEXT: const char *Name = dpct::get_error_string_dummy(status); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cusparseGetErrorString | FileCheck %s -check-prefix=cusparseGetErrorString // cusparseGetErrorString: CUDA API: // cusparseGetErrorString-NEXT: const char *Str = cusparseGetErrorString(status /*cusparseStatus_t*/); // cusparseGetErrorString-NEXT: Is migrated to: -// cusparseGetErrorString-NEXT: const char *Str = dpct::get_error_dummy(status); +// cusparseGetErrorString-NEXT: const char *Str = dpct::get_error_string_dummy(status); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cusparseGetProperty | FileCheck %s -check-prefix=cusparseGetProperty // cusparseGetProperty: CUDA API: diff --git a/clang/test/dpct/wildcard_test/abd.cu b/clang/test/dpct/wildcard_test/abd.cu index c81da994cb76..8c049ddb6306 100644 --- a/clang/test/dpct/wildcard_test/abd.cu +++ b/clang/test/dpct/wildcard_test/abd.cu @@ -11,6 +11,6 @@ const char *test_function() { //CHECK:/* //CHECK-NEXT:DPCT1010:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced with 0. You need to rewrite this code. //CHECK-NEXT:*/ -//CHECK-NEXT: printf("%s\n", dpct::get_error_dummy(0)); +//CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(0)); printf("%s\n", cudaGetErrorString(cudaGetLastError())); } From c3483d1d71d08b5508dde664e22636bd8badb4bc Mon Sep 17 00:00:00 2001 From: "Jiang, Zhiwei" Date: Thu, 17 Oct 2024 08:08:24 +0800 Subject: [PATCH 3/9] Fix lit Signed-off-by: Jiang, Zhiwei --- clang/test/dpct/macro_not_in_inroot/inroot/test.cu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/test/dpct/macro_not_in_inroot/inroot/test.cu b/clang/test/dpct/macro_not_in_inroot/inroot/test.cu index 1928b9b65320..2ea14a5732dc 100644 --- a/clang/test/dpct/macro_not_in_inroot/inroot/test.cu +++ b/clang/test/dpct/macro_not_in_inroot/inroot/test.cu @@ -9,7 +9,7 @@ void foo() {} // CHECK: #define MACRO_B \ // CHECK-NEXT: foo();\ -// CHECK-NEXT: MACRO(dpct::get_error_string_dummy(1)); +// CHECK-NEXT: MACRO(dpct::get_error_string_dummy({{[0-9]+}})); #define MACRO_B \ foo();\ MACRO(cudaGetErrorString(cudaErrorInvalidValue)); From 6853e73d7a8ce0df77a2ad5121be80dfb3ba3d90 Mon Sep 17 00:00:00 2001 From: "Jiang, Zhiwei" Date: Thu, 17 Oct 2024 08:26:48 +0800 Subject: [PATCH 4/9] Update comment Signed-off-by: Jiang, Zhiwei --- clang/runtime/dpct-rt/include/dpct/dpct.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/runtime/dpct-rt/include/dpct/dpct.hpp b/clang/runtime/dpct-rt/include/dpct/dpct.hpp index d1c6e4304286..9da763bf8419 100644 --- a/clang/runtime/dpct-rt/include/dpct/dpct.hpp +++ b/clang/runtime/dpct-rt/include/dpct/dpct.hpp @@ -49,8 +49,8 @@ template class dpct_kernel_scalar; namespace dpct { enum error_code { success = 0, default_error = 999 }; /// A dummy function introduced to assist auto migration. -/// It needs to be replaced with a real error-handling function. SYCL reports -/// errors using exceptions and does not use error codes. +/// The SYCLomatic user should replace it with a real error-handling function. +/// SYCL reports errors using exceptions and does not use error codes. inline const char *get_error_string_dummy(int ec) { (void)ec; return ""; // Return the error string for the error code From d570233673825d9c8af298418130cca1ba10c4c8 Mon Sep 17 00:00:00 2001 From: "Jiang, Zhiwei" Date: Thu, 17 Oct 2024 16:55:45 +0800 Subject: [PATCH 5/9] Add tests Signed-off-by: Jiang, Zhiwei --- clang/test/dpct/cublas_115.cu | 9 +++++++++ clang/test/dpct/cuda-get-error-string.cu | 23 +++++++++++++++++++++++ clang/test/dpct/cudnn-get-error-string.cu | 8 ++++++++ clang/test/dpct/cusparse-type102.cu | 9 +++++++++ clang/test/dpct/nccl_error.cu | 9 +++++++++ 5 files changed, 58 insertions(+) diff --git a/clang/test/dpct/cublas_115.cu b/clang/test/dpct/cublas_115.cu index 89a290b1f562..31c68de16a78 100644 --- a/clang/test/dpct/cublas_115.cu +++ b/clang/test/dpct/cublas_115.cu @@ -19,6 +19,15 @@ void foo1(cublasStatus_t s) { cublasSetWorkspace(handle, workspace, size); } +//CHECK:void foo11(int err) { +//CHECK-NEXT: dpct::get_error_string_dummy(err); +//CHECK-NEXT: dpct::get_error_string_dummy({{[0-9]+}}); +//CHECK-NEXT:} +void foo11(cublasStatus_t err) { + cublasGetStatusString(err); + cublasGetStatusString(CUBLAS_STATUS_NOT_INITIALIZED); +} + //CHECK:void foo2(dpct::compute_type &a) { //CHECK-NEXT: a = dpct::compute_type::f16; //CHECK-NEXT: a = dpct::compute_type::f16_standard; diff --git a/clang/test/dpct/cuda-get-error-string.cu b/clang/test/dpct/cuda-get-error-string.cu index 6d54d31938a2..fced46e09784 100644 --- a/clang/test/dpct/cuda-get-error-string.cu +++ b/clang/test/dpct/cuda-get-error-string.cu @@ -2,6 +2,12 @@ // RUN: FileCheck %s --match-full-lines --input-file %T/cuda-get-error-string/cuda-get-error-string.dp.cpp // RUN: %if build_lit %{icpx -c -fsycl %T/cuda-get-error-string/cuda-get-error-string.dp.cpp -o %T/cuda-get-error-string/cuda-get-error-string.dp.o %} +#include "cublas_v2.h" +#include "cusparse_v2.h" +#include "cuda.h" +#include "cudnn.h" +#include "nccl.h" + int printf(const char *format, ...); // CHECK: #define PRINT_ERROR_STR(X) printf("%s\n", dpct::get_error_string_dummy(X)) @@ -107,3 +113,20 @@ const char *test_function() { return cudaGetErrorName(cudaSuccess); } +//CHECK:void foo1(int err, const char *c) { +//CHECK-NEXT: c = dpct::get_error_string_dummy(err); +//CHECK-NEXT: c = dpct::get_error_string_dummy({{[0-9]+}}); +//CHECK-NEXT:} +void foo1(CUresult err, const char *c) { + cuGetErrorString(err, &c); + cuGetErrorString(CUDA_ERROR_UNKNOWN, &c); +} + +//CHECK:void foo2(dpct::err0 err) { +//CHECK-NEXT: dpct::get_error_string_dummy(err); +//CHECK-NEXT: dpct::get_error_string_dummy({{[0-9]+}}); +//CHECK-NEXT:} +void foo2(cudaError_t err) { + cudaGetErrorString(err); + cudaGetErrorString(cudaErrorInvalidValue); +} diff --git a/clang/test/dpct/cudnn-get-error-string.cu b/clang/test/dpct/cudnn-get-error-string.cu index 62bea3737f6c..01133a46084c 100644 --- a/clang/test/dpct/cudnn-get-error-string.cu +++ b/clang/test/dpct/cudnn-get-error-string.cu @@ -35,3 +35,11 @@ const char *test_function(cudnnStatus_t status) { PRINT_ERROR_STR3(status); } +//CHECK:void foo(dpct::err1 err) { +//CHECK-NEXT: dpct::get_error_string_dummy(err); +//CHECK-NEXT: dpct::get_error_string_dummy({{[0-9]+}}); +//CHECK-NEXT:} +void foo(cudnnStatus_t err) { + cudnnGetErrorString(err); + cudnnGetErrorString(CUDNN_STATUS_NOT_INITIALIZED); +} diff --git a/clang/test/dpct/cusparse-type102.cu b/clang/test/dpct/cusparse-type102.cu index 2fed6bbf4468..017834356575 100644 --- a/clang/test/dpct/cusparse-type102.cu +++ b/clang/test/dpct/cusparse-type102.cu @@ -32,3 +32,12 @@ int main() { return 0; } + +//CHECK:void foo(int err) { +//CHECK-NEXT: dpct::get_error_string_dummy(err); +//CHECK-NEXT: dpct::get_error_string_dummy({{[0-9]+}}); +//CHECK-NEXT:} +void foo(cusparseStatus_t err) { + cusparseGetErrorString(err); + cusparseGetErrorString(CUSPARSE_STATUS_NOT_INITIALIZED); +} diff --git a/clang/test/dpct/nccl_error.cu b/clang/test/dpct/nccl_error.cu index a55bd64bf527..6a6a7213eaeb 100644 --- a/clang/test/dpct/nccl_error.cu +++ b/clang/test/dpct/nccl_error.cu @@ -51,3 +51,12 @@ int main(){ return 0; } } + +//CHECK:void foo(int err) { +//CHECK-NEXT: dpct::get_error_string_dummy(err); +//CHECK-NEXT: dpct::get_error_string_dummy({{[0-9]+}}); +//CHECK-NEXT:} +void foo(ncclResult_t err) { + ncclGetErrorString(err); + ncclGetErrorString(ncclUnhandledCudaError); +} From 76c605881481ba78f1f1cc30edbe7f4e029a52ad Mon Sep 17 00:00:00 2001 From: "Jiang, Zhiwei" Date: Mon, 21 Oct 2024 11:39:53 +0800 Subject: [PATCH 6/9] Update Signed-off-by: Jiang, Zhiwei --- clang/lib/DPCT/APINamesCUBLAS.inc | 9 +- clang/lib/DPCT/APINamesCUSPARSE.inc | 18 ++-- clang/lib/DPCT/APINamesDriver.inc | 9 +- clang/lib/DPCT/APINamesErrorHandling.inc | 38 +++++---- clang/lib/DPCT/Diagnostics.cpp | 1 + clang/lib/DPCT/Diagnostics.inc | 4 +- clang/test/dpct/cublas_115.cu | 11 ++- clang/test/dpct/cuda-get-error-string.cu | 84 ++++++++++++++----- clang/test/dpct/cudnn-get-error-string.cu | 31 +++++-- clang/test/dpct/cusparse-type102.cu | 14 +++- clang/test/dpct/nccl_error.cu | 11 ++- .../dpct/query_api_mapping/Driver/test.cu | 3 + .../dpct/query_api_mapping/NCCL/lit_nccl.cu | 3 + .../dpct/query_api_mapping/Runtime/test.cu | 6 ++ .../query_api_mapping/cuBLAS/blas_11_5.cu | 3 + .../dpct/query_api_mapping/cuDNN/dnn_part2.cu | 3 + .../cuSPARSE/lit_cuSPARSE.cu | 6 ++ clang/test/dpct/wildcard_test/abd.cu | 3 + 18 files changed, 202 insertions(+), 55 deletions(-) diff --git a/clang/lib/DPCT/APINamesCUBLAS.inc b/clang/lib/DPCT/APINamesCUBLAS.inc index bc470504b6b3..84b7261c93f7 100644 --- a/clang/lib/DPCT/APINamesCUBLAS.inc +++ b/clang/lib/DPCT/APINamesCUBLAS.inc @@ -710,9 +710,12 @@ GELS_BATCHED(cublasCgelsBatched) GELS_BATCHED(cublasZgelsBatched) #undef GELS_BATCHED -CALL_FACTORY_ENTRY("cublasGetStatusString", - CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", - ARG_WC(0))) +WARNING_FACTORY_ENTRY("cublasGetStatusString", + CALL_FACTORY_ENTRY("cublasGetStatusString", + CALL(MapNames::getDpctNamespace() + + "get_error_string_dummy", + ARG_WC(0))), + Diagnostics::ERROR_HANDLING_API_REPLACED_BY_DUMMY) #define GEMM_EX(NAME, COMPUTE_TYPE) \ ASSIGNABLE_FACTORY(FEATURE_REQUEST_FACTORY( \ diff --git a/clang/lib/DPCT/APINamesCUSPARSE.inc b/clang/lib/DPCT/APINamesCUSPARSE.inc index 906cfbae07aa..f25258e1b83a 100644 --- a/clang/lib/DPCT/APINamesCUSPARSE.inc +++ b/clang/lib/DPCT/APINamesCUSPARSE.inc @@ -335,12 +335,18 @@ ASSIGNABLE_FACTORY(CALL_FACTORY_ENTRY( "cusparseSpMV", CALL(MapNames::getLibraryHelperNamespace() + "sparse::spmv", MEMBER_CALL(ARG(0), true, "get_queue"), ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7)))) -CALL_FACTORY_ENTRY("cusparseGetErrorString", - CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", - ARG_WC(0))) -CALL_FACTORY_ENTRY("cusparseGetErrorName", - CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", - ARG_WC(0))) +WARNING_FACTORY_ENTRY("cusparseGetErrorString", + CALL_FACTORY_ENTRY("cusparseGetErrorString", + CALL(MapNames::getDpctNamespace() + + "get_error_string_dummy", + ARG_WC(0))), + Diagnostics::ERROR_HANDLING_API_REPLACED_BY_DUMMY) +WARNING_FACTORY_ENTRY("cusparseGetErrorName", + CALL_FACTORY_ENTRY("cusparseGetErrorName", + CALL(MapNames::getDpctNamespace() + + "get_error_string_dummy", + ARG_WC(0))), + Diagnostics::ERROR_HANDLING_API_REPLACED_BY_DUMMY) ASSIGNABLE_FACTORY( CALL_FACTORY_ENTRY("cusparseSpGEMM_createDescr", diff --git a/clang/lib/DPCT/APINamesDriver.inc b/clang/lib/DPCT/APINamesDriver.inc index e8d150e8965b..586cd582ccb8 100644 --- a/clang/lib/DPCT/APINamesDriver.inc +++ b/clang/lib/DPCT/APINamesDriver.inc @@ -8,9 +8,12 @@ // clang-format off -ASSIGNABLE_FACTORY( - ASSIGN_FACTORY_ENTRY("cuGetErrorString", DEREF(1), - CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", ARG_WC(0)))) +WARNING_FACTORY_ENTRY( + "cuGetErrorString", + ASSIGNABLE_FACTORY( + ASSIGN_FACTORY_ENTRY("cuGetErrorString", DEREF(1), + CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", ARG_WC(0)))), + Diagnostics::ERROR_HANDLING_API_REPLACED_BY_DUMMY) FEATURE_REQUEST_FACTORY( HelperFeatureEnum::device_ext, diff --git a/clang/lib/DPCT/APINamesErrorHandling.inc b/clang/lib/DPCT/APINamesErrorHandling.inc index 25954cbd0981..f7cccedb3542 100644 --- a/clang/lib/DPCT/APINamesErrorHandling.inc +++ b/clang/lib/DPCT/APINamesErrorHandling.inc @@ -6,17 +6,24 @@ // //===----------------------------------------------------------------------===// -CALL_FACTORY_ENTRY("cudnnGetErrorString", - CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", - ARG_WC(0))) - -CALL_FACTORY_ENTRY("cudaGetErrorString", - CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", - ARG_WC(0))) - -CALL_FACTORY_ENTRY("cudaGetErrorName", - CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", - ARG_WC(0))) +WARNING_FACTORY_ENTRY( + "cudnnGetErrorString", + CALL_FACTORY_ENTRY("cudnnGetErrorString", + CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", + ARG_WC(0))), + Diagnostics::ERROR_HANDLING_API_REPLACED_BY_DUMMY) +WARNING_FACTORY_ENTRY( + "cudaGetErrorString", + CALL_FACTORY_ENTRY("cudaGetErrorString", + CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", + ARG_WC(0))), + Diagnostics::ERROR_HANDLING_API_REPLACED_BY_DUMMY) +WARNING_FACTORY_ENTRY( + "cudaGetErrorName", + CALL_FACTORY_ENTRY("cudaGetErrorName", + CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", + ARG_WC(0))), + Diagnostics::ERROR_HANDLING_API_REPLACED_BY_DUMMY) CONDITIONAL_FACTORY_ENTRY( checkIsCallExprOnly(), @@ -42,9 +49,12 @@ CONDITIONAL_FACTORY_ENTRY( TOSTRING_FACTORY_ENTRY("cudaPeekAtLastError", LITERAL("0")), Diagnostics::TRNA_WARNING_ERROR_HANDLING_API_REPLACED_0)) -CALL_FACTORY_ENTRY("ncclGetErrorString", - CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", - ARG_WC(0))) +WARNING_FACTORY_ENTRY( + "ncclGetErrorString", + CALL_FACTORY_ENTRY("ncclGetErrorString", + CALL(MapNames::getDpctNamespace() + "get_error_string_dummy", + ARG_WC(0))), + Diagnostics::ERROR_HANDLING_API_REPLACED_BY_DUMMY) CONDITIONAL_FACTORY_ENTRY( checkIsCallExprOnly(), diff --git a/clang/lib/DPCT/Diagnostics.cpp b/clang/lib/DPCT/Diagnostics.cpp index cf284f6860a9..0b18f72a9630 100644 --- a/clang/lib/DPCT/Diagnostics.cpp +++ b/clang/lib/DPCT/Diagnostics.cpp @@ -52,6 +52,7 @@ std::unordered_set APIQueryNeedReportWarningIDSet = { // More IDs may need to be added, like: 1007, 1028, 1030, 1031, 1037, // 1051, 1053, 1067, 1069, 1076, 1082, 1090, 1107. 1008, // API_NOT_MIGRATED_SYCL_UNDEF + 1009, // ERROR_HANDLING_API_REPLACED_BY_DUMMY 1014, // STREAM_FLAG_PRIORITY_NOT_SUPPORTED 1023, // MASK_UNSUPPORTED 1029, // DEVICE_LIMIT_NOT_SUPPORTED diff --git a/clang/lib/DPCT/Diagnostics.inc b/clang/lib/DPCT/Diagnostics.inc index e78ec9afcc55..8e9faf935b04 100644 --- a/clang/lib/DPCT/Diagnostics.inc +++ b/clang/lib/DPCT/Diagnostics.inc @@ -48,8 +48,8 @@ DEF_WARNING(API_NOT_MIGRATED, 1007, HIGH_LEVEL, "Migration of %0 is not supporte DEF_COMMENT(API_NOT_MIGRATED, 1007, HIGH_LEVEL, "Migration of {0} is not supported.") DEF_WARNING(API_NOT_MIGRATED_SYCL_UNDEF, 1008, HIGH_LEVEL, "%0 function is not defined in SYCL. This is a hardware-specific feature. Consult with your hardware vendor to find a replacement.") DEF_COMMENT(API_NOT_MIGRATED_SYCL_UNDEF, 1008, HIGH_LEVEL, "{0} function is not defined in SYCL. This is a hardware-specific feature. Consult with your hardware vendor to find a replacement.") -DEF_WARNING(TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, 1009, LOW_LEVEL, "deprecated") -DEF_COMMENT(TRNA_WARNING_ERROR_HANDLING_API_COMMENTED, 1009, LOW_LEVEL, "deprecated") +DEF_WARNING(ERROR_HANDLING_API_REPLACED_BY_DUMMY, 1009, LOW_LEVEL, "SYCL reports errors using exceptions and does not use error codes. Please replace the \"get_error_string_dummy(...)\" with a real error-handling function.") +DEF_COMMENT(ERROR_HANDLING_API_REPLACED_BY_DUMMY, 1009, LOW_LEVEL, "SYCL reports errors using exceptions and does not use error codes. Please replace the \"get_error_string_dummy(...)\" with a real error-handling function.") DEF_WARNING(TRNA_WARNING_ERROR_HANDLING_API_REPLACED_0, 1010, LOW_LEVEL, "SYCL uses exceptions to report errors and does not use the error codes. The call was replaced with 0. You need to rewrite this code.") DEF_COMMENT(TRNA_WARNING_ERROR_HANDLING_API_REPLACED_0, 1010, LOW_LEVEL, "SYCL uses exceptions to report errors and does not use the error codes. The call was replaced with 0. You need to rewrite this code.") DEF_WARNING(TRNA_WARNING_OVERLOADED_API_FOUND, 1011, LOW_LEVEL, "The tool detected overloaded operators for built-in vector types, which may conflict with the SYCL 2020 standard operators (see 4.14.2.1 Vec interface). The tool inserted a namespace to avoid the conflict. Use SYCL 2020 standard operators instead.") diff --git a/clang/test/dpct/cublas_115.cu b/clang/test/dpct/cublas_115.cu index 31c68de16a78..4f5cd994f244 100644 --- a/clang/test/dpct/cublas_115.cu +++ b/clang/test/dpct/cublas_115.cu @@ -8,7 +8,10 @@ #include void foo1(cublasStatus_t s) { - //CHECK:printf("Error string: %s", dpct::get_error_string_dummy(s)); + //CHECK:/* + //CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. + //CHECK-NEXT:*/ + //CHECK-NEXT:printf("Error string: %s", dpct::get_error_string_dummy(s)); printf("Error string: %s", cublasGetStatusString(s)); cublasHandle_t handle; void *workspace; @@ -20,7 +23,13 @@ void foo1(cublasStatus_t s) { } //CHECK:void foo11(int err) { +//CHECK: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ //CHECK-NEXT: dpct::get_error_string_dummy(err); +//CHECK-NEXT: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ //CHECK-NEXT: dpct::get_error_string_dummy({{[0-9]+}}); //CHECK-NEXT:} void foo11(cublasStatus_t err) { diff --git a/clang/test/dpct/cuda-get-error-string.cu b/clang/test/dpct/cuda-get-error-string.cu index fced46e09784..39d9822651ef 100644 --- a/clang/test/dpct/cuda-get-error-string.cu +++ b/clang/test/dpct/cuda-get-error-string.cu @@ -2,45 +2,65 @@ // RUN: FileCheck %s --match-full-lines --input-file %T/cuda-get-error-string/cuda-get-error-string.dp.cpp // RUN: %if build_lit %{icpx -c -fsycl %T/cuda-get-error-string/cuda-get-error-string.dp.cpp -o %T/cuda-get-error-string/cuda-get-error-string.dp.o %} -#include "cublas_v2.h" -#include "cusparse_v2.h" #include "cuda.h" -#include "cudnn.h" -#include "nccl.h" int printf(const char *format, ...); -// CHECK: #define PRINT_ERROR_STR(X) printf("%s\n", dpct::get_error_string_dummy(X)) +// CHECK: /* +// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CHECK-NEXT: */ +// CHECK-NEXT: #define PRINT_ERROR_STR(X) printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR(X) printf("%s\n", cudaGetErrorString(X)) -// CHECK: #define PRINT_ERROR_STR2(X)\ +// CHECK: /* +// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CHECK-NEXT: */ +// CHECK-NEXT: #define PRINT_ERROR_STR2(X)\ // CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR2(X)\ printf("%s\n", cudaGetErrorString(X)) -// CHECK: #define PRINT_ERROR_STR3(X)\ +// CHECK: /* +// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CHECK-NEXT: */ +// CHECK-NEXT: #define PRINT_ERROR_STR3(X)\ // CHECK-NEXT: printf("%s\ // CHECK-NEXT: \n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR3(X)\ printf("%s\ \n", cudaGetErrorString(X)) -// CHECK: #define PRINT_ERROR_NAME(X) printf("%s\n", dpct::get_error_string_dummy(X)) +// CHECK: /* +// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CHECK-NEXT: */ +// CHECK-NEXT: #define PRINT_ERROR_NAME(X) printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_NAME(X) printf("%s\n", cudaGetErrorName(X)) -// CHECK: #define PRINT_ERROR_NAME2(X)\ +// CHECK: /* +// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CHECK-NEXT: */ +// CHECK-NEXT: #define PRINT_ERROR_NAME2(X)\ // CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_NAME2(X)\ printf("%s\n", cudaGetErrorName(X)) -// CHECK: #define PRINT_ERROR_NAME3(X)\ +// CHECK: /* +// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CHECK-NEXT: */ +// CHECK-NEXT: #define PRINT_ERROR_NAME3(X)\ // CHECK-NEXT: printf("%s\ // CHECK-NEXT: \n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_NAME3(X)\ printf("%s\ \n", cudaGetErrorName(X)) -// CHECK: #define PRINT_ERROR_STR_NAME(X)\ +// CHECK: /* +// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CHECK-NEXT: */ +// CHECK-NEXT: /* +// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CHECK-NEXT: */ +// CHECK-NEXT: #define PRINT_ERROR_STR_NAME(X)\ // CHECK-NEXT: printf("%s\ // CHECK-NEXT: %s\ // CHECK-NEXT: \n", dpct::get_error_string_dummy(X),\ @@ -91,30 +111,50 @@ const char *test_function() { PRINT_ERROR_STR_NAME(cudaGetLastError()); PRINT_ERROR_STR_NAME(cudaSuccess); -//CHECK:/* -//CHECK-NEXT:DPCT1010:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced with 0. You need to rewrite this code. -//CHECK-NEXT:*/ +//CHECK: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ +//CHECK-NEXT: /* +//CHECK-NEXT: DPCT1010:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced with 0. You need to rewrite this code. +//CHECK-NEXT: */ //CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(0)); printf("%s\n", cudaGetErrorString(cudaGetLastError())); - -//CHECK: printf("%s\n", dpct::get_error_string_dummy(0)); +//CHECK: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ +//CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(0)); printf("%s\n", cudaGetErrorString(cudaSuccess)); -//CHECK:printf("%s\n", dpct::get_error_string_dummy(0)); +//CHECK:/* +//CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT:*/ +//CHECK-NEXT:printf("%s\n", dpct::get_error_string_dummy(0)); printf("%s\n", cudaGetErrorName(cudaSuccess)); CUresult e; const char *err_s; -//CHECK: err_s = dpct::get_error_string_dummy(e); +//CHECK: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ +//CHECK-NEXT: err_s = dpct::get_error_string_dummy(e); cuGetErrorString(e, &err_s); -//CHECK: return dpct::get_error_string_dummy(0); +//CHECK: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ +//CHECK-NEXT: return dpct::get_error_string_dummy(0); return cudaGetErrorName(cudaSuccess); } //CHECK:void foo1(int err, const char *c) { +//CHECK-NEXT: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ //CHECK-NEXT: c = dpct::get_error_string_dummy(err); +//CHECK-NEXT: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ //CHECK-NEXT: c = dpct::get_error_string_dummy({{[0-9]+}}); //CHECK-NEXT:} void foo1(CUresult err, const char *c) { @@ -123,7 +163,13 @@ void foo1(CUresult err, const char *c) { } //CHECK:void foo2(dpct::err0 err) { +//CHECK-NEXT: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ //CHECK-NEXT: dpct::get_error_string_dummy(err); +//CHECK-NEXT: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ //CHECK-NEXT: dpct::get_error_string_dummy({{[0-9]+}}); //CHECK-NEXT:} void foo2(cudaError_t err) { diff --git a/clang/test/dpct/cudnn-get-error-string.cu b/clang/test/dpct/cudnn-get-error-string.cu index 01133a46084c..6984ce026528 100644 --- a/clang/test/dpct/cudnn-get-error-string.cu +++ b/clang/test/dpct/cudnn-get-error-string.cu @@ -6,15 +6,24 @@ int printf(const char *format, ...); -// CHECK: #define PRINT_ERROR_STR(X) printf("%s\n", dpct::get_error_string_dummy(X)) +// CHECK: /* +// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CHECK-NEXT: */ +// CHECK-NEXT: #define PRINT_ERROR_STR(X) printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR(X) printf("%s\n", cudnnGetErrorString(X)) -// CHECK: #define PRINT_ERROR_STR2(X)\ +// CHECK: /* +// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CHECK-NEXT: */ +// CHECK-NEXT: #define PRINT_ERROR_STR2(X)\ // CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR2(X)\ printf("%s\n", cudnnGetErrorString(X)) -// CHECK: #define PRINT_ERROR_STR3(X)\ +// CHECK: /* +// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CHECK-NEXT: */ +// CHECK-NEXT: #define PRINT_ERROR_STR3(X)\ // CHECK-NEXT: printf("%s\ // CHECK-NEXT: \n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR3(X)\ @@ -24,10 +33,16 @@ int printf(const char *format, ...); const char *test_function(cudnnStatus_t status) { -//CHECK: printf("%s\n", dpct::get_error_string_dummy(status)); +//CHECK: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ +//CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(status)); printf("%s\n", cudnnGetErrorString(status)); -//CHECK: printf("%s\n", dpct::get_error_string_dummy(0)); +//CHECK: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ +//CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(0)); printf("%s\n", cudnnGetErrorString(CUDNN_STATUS_SUCCESS)); PRINT_ERROR_STR(status); @@ -36,7 +51,13 @@ const char *test_function(cudnnStatus_t status) { } //CHECK:void foo(dpct::err1 err) { +//CHECK-NEXT: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ //CHECK-NEXT: dpct::get_error_string_dummy(err); +//CHECK-NEXT: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ //CHECK-NEXT: dpct::get_error_string_dummy({{[0-9]+}}); //CHECK-NEXT:} void foo(cudnnStatus_t err) { diff --git a/clang/test/dpct/cusparse-type102.cu b/clang/test/dpct/cusparse-type102.cu index 017834356575..2a3b16226aee 100644 --- a/clang/test/dpct/cusparse-type102.cu +++ b/clang/test/dpct/cusparse-type102.cu @@ -14,7 +14,13 @@ int main() { cusparseStatus_t a6; a6 = CUSPARSE_STATUS_NOT_SUPPORTED; - //CHECK:printf("Error string: %s", dpct::get_error_string_dummy(a6)); + //CHECK:/* + //CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. + //CHECK-NEXT:*/ + //CHECK-NEXT:printf("Error string: %s", dpct::get_error_string_dummy(a6)); + //CHECK-NEXT:/* + //CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. + //CHECK-NEXT:*/ //CHECK-NEXT:printf("Error name: %s", dpct::get_error_string_dummy(a6)); printf("Error string: %s", cusparseGetErrorString(a6)); printf("Error name: %s", cusparseGetErrorName(a6)); @@ -34,7 +40,13 @@ int main() { } //CHECK:void foo(int err) { +//CHECK-NEXT: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ //CHECK-NEXT: dpct::get_error_string_dummy(err); +//CHECK-NEXT: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ //CHECK-NEXT: dpct::get_error_string_dummy({{[0-9]+}}); //CHECK-NEXT:} void foo(cusparseStatus_t err) { diff --git a/clang/test/dpct/nccl_error.cu b/clang/test/dpct/nccl_error.cu index 6a6a7213eaeb..37e8fc74a0b2 100644 --- a/clang/test/dpct/nccl_error.cu +++ b/clang/test/dpct/nccl_error.cu @@ -36,7 +36,10 @@ int main(){ // CHECK: case int(oneapi::ccl::datatype::int32): std::cout << "Int32" << std::endl; break; case ncclInt32: std::cout << "Int32" << std::endl; break; } - // CHECK: dpct::get_error_string_dummy(res); + // CHECK: /* + // CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. + // CHECK-NEXT: */ + // CHECK-NEXT: dpct::get_error_string_dummy(res); ncclGetErrorString(res); // CHECK: /* // CHECK-NEXT: DPCT1026:{{[0-9]+}}: The call to ncclGetLastError was removed because this functionality is redundant in SYCL. @@ -53,7 +56,13 @@ int main(){ } //CHECK:void foo(int err) { +//CHECK-NEXT: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ //CHECK-NEXT: dpct::get_error_string_dummy(err); +//CHECK-NEXT: /* +//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT: */ //CHECK-NEXT: dpct::get_error_string_dummy({{[0-9]+}}); //CHECK-NEXT:} void foo(ncclResult_t err) { diff --git a/clang/test/dpct/query_api_mapping/Driver/test.cu b/clang/test/dpct/query_api_mapping/Driver/test.cu index efe80e97ad65..0857be01196b 100644 --- a/clang/test/dpct/query_api_mapping/Driver/test.cu +++ b/clang/test/dpct/query_api_mapping/Driver/test.cu @@ -4,6 +4,9 @@ // CUGETERRORSTRING: CUDA API: // CUGETERRORSTRING-NEXT: cuGetErrorString(r /*CUresult*/, ppc /*const char ***/); // CUGETERRORSTRING-NEXT: Is migrated to: +// CUGETERRORSTRING-NEXT: /* +// CUGETERRORSTRING-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CUGETERRORSTRING-NEXT: */ // CUGETERRORSTRING-NEXT: *ppc = dpct::get_error_string_dummy(r); /// Initialization diff --git a/clang/test/dpct/query_api_mapping/NCCL/lit_nccl.cu b/clang/test/dpct/query_api_mapping/NCCL/lit_nccl.cu index 793463bbef39..6c17661874b2 100644 --- a/clang/test/dpct/query_api_mapping/NCCL/lit_nccl.cu +++ b/clang/test/dpct/query_api_mapping/NCCL/lit_nccl.cu @@ -10,6 +10,9 @@ // NCCLGETERRORSTRING: CUDA API: // NCCLGETERRORSTRING-NEXT: ncclGetErrorString(r /*ncclResult_t*/); // NCCLGETERRORSTRING-NEXT: Is migrated to: +// NCCLGETERRORSTRING-NEXT: /* +// NCCLGETERRORSTRING-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// NCCLGETERRORSTRING-NEXT: */ // NCCLGETERRORSTRING-NEXT: dpct::get_error_string_dummy(r); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=ncclGetVersion | FileCheck %s -check-prefix=ncclGetVersion diff --git a/clang/test/dpct/query_api_mapping/Runtime/test.cu b/clang/test/dpct/query_api_mapping/Runtime/test.cu index b106b0603c76..37dabec57b9e 100644 --- a/clang/test/dpct/query_api_mapping/Runtime/test.cu +++ b/clang/test/dpct/query_api_mapping/Runtime/test.cu @@ -164,12 +164,18 @@ // CUDAGETERRORNAME: CUDA API: // CUDAGETERRORNAME-NEXT: cudaGetErrorName(e /*cudaError_t*/); // CUDAGETERRORNAME-NEXT: Is migrated to: +// CUDAGETERRORNAME-NEXT: /* +// CUDAGETERRORNAME-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CUDAGETERRORNAME-NEXT: */ // CUDAGETERRORNAME-NEXT: dpct::get_error_string_dummy(e); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGetErrorString | FileCheck %s -check-prefix=CUDAGETERRORSTRING // CUDAGETERRORSTRING: CUDA API: // CUDAGETERRORSTRING-NEXT: cudaGetErrorString(e /*cudaError_t*/); // CUDAGETERRORSTRING-NEXT: Is migrated to: +// CUDAGETERRORSTRING-NEXT: /* +// CUDAGETERRORSTRING-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CUDAGETERRORSTRING-NEXT: */ // CUDAGETERRORSTRING-NEXT: dpct::get_error_string_dummy(e); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudaGetLastError | FileCheck %s -check-prefix=CUDAGETLASTERROR diff --git a/clang/test/dpct/query_api_mapping/cuBLAS/blas_11_5.cu b/clang/test/dpct/query_api_mapping/cuBLAS/blas_11_5.cu index 6a714346e8b2..4f700daad579 100644 --- a/clang/test/dpct/query_api_mapping/cuBLAS/blas_11_5.cu +++ b/clang/test/dpct/query_api_mapping/cuBLAS/blas_11_5.cu @@ -5,4 +5,7 @@ // cublasGetStatusString: CUDA API: // cublasGetStatusString-NEXT: res /*const char **/ = cublasGetStatusString(status /*cublasStatus_t*/); // cublasGetStatusString-NEXT: Is migrated to: +// cublasGetStatusString-NEXT: /* +// cublasGetStatusString-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// cublasGetStatusString-NEXT: */ // cublasGetStatusString-NEXT: res /*const char **/ = dpct::get_error_string_dummy(status); diff --git a/clang/test/dpct/query_api_mapping/cuDNN/dnn_part2.cu b/clang/test/dpct/query_api_mapping/cuDNN/dnn_part2.cu index 792608d765d5..906ab7b23637 100644 --- a/clang/test/dpct/query_api_mapping/cuDNN/dnn_part2.cu +++ b/clang/test/dpct/query_api_mapping/cuDNN/dnn_part2.cu @@ -236,6 +236,9 @@ // cudnnGetErrorString: CUDA API: // cudnnGetErrorString-NEXT: r = cudnnGetErrorString(s /*cudnnStatus_t*/); // cudnnGetErrorString-NEXT: Is migrated to: +// cudnnGetErrorString-NEXT: /* +// cudnnGetErrorString-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// cudnnGetErrorString-NEXT: */ // cudnnGetErrorString-NEXT: r = dpct::get_error_string_dummy(s); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cudnnGetFilter4dDescriptor | FileCheck %s -check-prefix=cudnnGetFilter4dDescriptor diff --git a/clang/test/dpct/query_api_mapping/cuSPARSE/lit_cuSPARSE.cu b/clang/test/dpct/query_api_mapping/cuSPARSE/lit_cuSPARSE.cu index cfa098a20992..f2a2484347c3 100644 --- a/clang/test/dpct/query_api_mapping/cuSPARSE/lit_cuSPARSE.cu +++ b/clang/test/dpct/query_api_mapping/cuSPARSE/lit_cuSPARSE.cu @@ -209,12 +209,18 @@ // cusparseGetErrorName: CUDA API: // cusparseGetErrorName-NEXT: const char *Name = cusparseGetErrorName(status /*cusparseStatus_t*/); // cusparseGetErrorName-NEXT: Is migrated to: +// cusparseGetErrorName-NEXT: /* +// cusparseGetErrorName-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// cusparseGetErrorName-NEXT: */ // cusparseGetErrorName-NEXT: const char *Name = dpct::get_error_string_dummy(status); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cusparseGetErrorString | FileCheck %s -check-prefix=cusparseGetErrorString // cusparseGetErrorString: CUDA API: // cusparseGetErrorString-NEXT: const char *Str = cusparseGetErrorString(status /*cusparseStatus_t*/); // cusparseGetErrorString-NEXT: Is migrated to: +// cusparseGetErrorString-NEXT: /* +// cusparseGetErrorString-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// cusparseGetErrorString-NEXT: */ // cusparseGetErrorString-NEXT: const char *Str = dpct::get_error_string_dummy(status); // RUN: dpct --cuda-include-path="%cuda-path/include" --query-api-mapping=cusparseGetProperty | FileCheck %s -check-prefix=cusparseGetProperty diff --git a/clang/test/dpct/wildcard_test/abd.cu b/clang/test/dpct/wildcard_test/abd.cu index 8c049ddb6306..f11c2c98c447 100644 --- a/clang/test/dpct/wildcard_test/abd.cu +++ b/clang/test/dpct/wildcard_test/abd.cu @@ -9,6 +9,9 @@ int printf(const char *format, ...); const char *test_function() { //CHECK:/* +//CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT:*/ +//CHECK-NEXT:/* //CHECK-NEXT:DPCT1010:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced with 0. You need to rewrite this code. //CHECK-NEXT:*/ //CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(0)); From c86f6dfc5bbf6d5ef5676b6cf58acd751fa1a163 Mon Sep 17 00:00:00 2001 From: "Jiang, Zhiwei" Date: Mon, 21 Oct 2024 11:44:14 +0800 Subject: [PATCH 7/9] Update Signed-off-by: Jiang, Zhiwei --- clang/test/dpct/cuda-get-error-string.cu | 30 +++++++++++------------ clang/test/dpct/cudnn-get-error-string.cu | 12 ++++----- clang/test/dpct/nccl_error.cu | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/clang/test/dpct/cuda-get-error-string.cu b/clang/test/dpct/cuda-get-error-string.cu index 39d9822651ef..464ca05d1e76 100644 --- a/clang/test/dpct/cuda-get-error-string.cu +++ b/clang/test/dpct/cuda-get-error-string.cu @@ -12,9 +12,9 @@ int printf(const char *format, ...); // CHECK-NEXT: #define PRINT_ERROR_STR(X) printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR(X) printf("%s\n", cudaGetErrorString(X)) -// CHECK: /* -// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. -// CHECK-NEXT: */ +// CHECK: /* +// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CHECK-NEXT: */ // CHECK-NEXT: #define PRINT_ERROR_STR2(X)\ // CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_STR2(X)\ @@ -36,9 +36,9 @@ int printf(const char *format, ...); // CHECK-NEXT: #define PRINT_ERROR_NAME(X) printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_NAME(X) printf("%s\n", cudaGetErrorName(X)) -// CHECK: /* -// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. -// CHECK-NEXT: */ +// CHECK: /* +// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +// CHECK-NEXT: */ // CHECK-NEXT: #define PRINT_ERROR_NAME2(X)\ // CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(X)) #define PRINT_ERROR_NAME2(X)\ @@ -111,12 +111,12 @@ const char *test_function() { PRINT_ERROR_STR_NAME(cudaGetLastError()); PRINT_ERROR_STR_NAME(cudaSuccess); -//CHECK: /* -//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. -//CHECK-NEXT: */ -//CHECK-NEXT: /* -//CHECK-NEXT: DPCT1010:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced with 0. You need to rewrite this code. -//CHECK-NEXT: */ +//CHECK:/* +//CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT:*/ +//CHECK-NEXT:/* +//CHECK-NEXT:DPCT1010:{{[0-9]+}}: SYCL uses exceptions to report errors and does not use the error codes. The call was replaced with 0. You need to rewrite this code. +//CHECK-NEXT:*/ //CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(0)); printf("%s\n", cudaGetErrorString(cudaGetLastError())); @@ -140,9 +140,9 @@ const char *test_function() { //CHECK-NEXT: err_s = dpct::get_error_string_dummy(e); cuGetErrorString(e, &err_s); -//CHECK: /* -//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. -//CHECK-NEXT: */ +//CHECK:/* +//CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT:*/ //CHECK-NEXT: return dpct::get_error_string_dummy(0); return cudaGetErrorName(cudaSuccess); } diff --git a/clang/test/dpct/cudnn-get-error-string.cu b/clang/test/dpct/cudnn-get-error-string.cu index 6984ce026528..b9cb57076a2e 100644 --- a/clang/test/dpct/cudnn-get-error-string.cu +++ b/clang/test/dpct/cudnn-get-error-string.cu @@ -33,15 +33,15 @@ int printf(const char *format, ...); const char *test_function(cudnnStatus_t status) { -//CHECK: /* -//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. -//CHECK-NEXT: */ +//CHECK:/* +//CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT:*/ //CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(status)); printf("%s\n", cudnnGetErrorString(status)); -//CHECK: /* -//CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. -//CHECK-NEXT: */ +//CHECK:/* +//CHECK-NEXT:DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. +//CHECK-NEXT:*/ //CHECK-NEXT: printf("%s\n", dpct::get_error_string_dummy(0)); printf("%s\n", cudnnGetErrorString(CUDNN_STATUS_SUCCESS)); diff --git a/clang/test/dpct/nccl_error.cu b/clang/test/dpct/nccl_error.cu index 37e8fc74a0b2..e1e2a6b963b9 100644 --- a/clang/test/dpct/nccl_error.cu +++ b/clang/test/dpct/nccl_error.cu @@ -36,7 +36,7 @@ int main(){ // CHECK: case int(oneapi::ccl::datatype::int32): std::cout << "Int32" << std::endl; break; case ncclInt32: std::cout << "Int32" << std::endl; break; } - // CHECK: /* + // CHECK: /* // CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. // CHECK-NEXT: */ // CHECK-NEXT: dpct::get_error_string_dummy(res); From 778233b687067e3144a99f453eb05d32b03713af Mon Sep 17 00:00:00 2001 From: "Jiang, Zhiwei" Date: Mon, 21 Oct 2024 13:01:47 +0800 Subject: [PATCH 8/9] Fix lit Signed-off-by: Jiang, Zhiwei --- clang/test/dpct/cuda-get-error-string.cu | 3 --- 1 file changed, 3 deletions(-) diff --git a/clang/test/dpct/cuda-get-error-string.cu b/clang/test/dpct/cuda-get-error-string.cu index 464ca05d1e76..422a82075a9b 100644 --- a/clang/test/dpct/cuda-get-error-string.cu +++ b/clang/test/dpct/cuda-get-error-string.cu @@ -57,9 +57,6 @@ int printf(const char *format, ...); // CHECK: /* // CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. // CHECK-NEXT: */ -// CHECK-NEXT: /* -// CHECK-NEXT: DPCT1009:{{[0-9]+}}: SYCL reports errors using exceptions and does not use error codes. Please replace the "get_error_string_dummy(...)" with a real error-handling function. -// CHECK-NEXT: */ // CHECK-NEXT: #define PRINT_ERROR_STR_NAME(X)\ // CHECK-NEXT: printf("%s\ // CHECK-NEXT: %s\ From 3f0e8107e8d7d6ae58ec1496e2de4c86a92854bb Mon Sep 17 00:00:00 2001 From: "Wang, Zhiming" Date: Tue, 22 Oct 2024 09:26:02 +0800 Subject: [PATCH 9/9] Update dpct.hpp --- clang/runtime/dpct-rt/include/dpct/dpct.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/runtime/dpct-rt/include/dpct/dpct.hpp b/clang/runtime/dpct-rt/include/dpct/dpct.hpp index 9da763bf8419..38a271f69da7 100644 --- a/clang/runtime/dpct-rt/include/dpct/dpct.hpp +++ b/clang/runtime/dpct-rt/include/dpct/dpct.hpp @@ -49,7 +49,7 @@ template class dpct_kernel_scalar; namespace dpct { enum error_code { success = 0, default_error = 999 }; /// A dummy function introduced to assist auto migration. -/// The SYCLomatic user should replace it with a real error-handling function. +/// The migration tool user should replace it with a real error-handling function. /// SYCL reports errors using exceptions and does not use error codes. inline const char *get_error_string_dummy(int ec) { (void)ec;