diff --git a/clang/lib/DPCT/ASTTraversal.cpp b/clang/lib/DPCT/ASTTraversal.cpp index 29d95ca8075c..35a7eea5cb5f 100644 --- a/clang/lib/DPCT/ASTTraversal.cpp +++ b/clang/lib/DPCT/ASTTraversal.cpp @@ -198,4 +198,4 @@ REGISTER_RULE(CuDNNAPIRule, PassKind::PK_Migration, RuleGroupKind::RK_DNN) REGISTER_RULE(NVSHMEMRule, PassKind::PK_Migration, RuleGroupKind::RK_NVSHMEM) } // namespace dpct -} // namespace clang \ No newline at end of file +} // namespace clang diff --git a/clang/lib/DPCT/MigrationReport/Libraries.inc b/clang/lib/DPCT/MigrationReport/Libraries.inc index 99a6991ba017..ed2e74767980 100644 --- a/clang/lib/DPCT/MigrationReport/Libraries.inc +++ b/clang/lib/DPCT/MigrationReport/Libraries.inc @@ -18,4 +18,4 @@ LIBRARY(CCL, "oneAPI Collective Communications Library (oneCCL)", LIBRARY(SHMEM, "Intel Shared Memory Library (iSHMEM)", RuleGroupKind::RK_NVSHMEM) -#undef LIBRARY \ No newline at end of file +#undef LIBRARY diff --git a/clang/lib/DPCT/RulesSHMEM/NVSHMEMAPIMigration.cpp b/clang/lib/DPCT/RulesSHMEM/NVSHMEMAPIMigration.cpp index 072f766498d0..b2f02e0dcfef 100644 --- a/clang/lib/DPCT/RulesSHMEM/NVSHMEMAPIMigration.cpp +++ b/clang/lib/DPCT/RulesSHMEM/NVSHMEMAPIMigration.cpp @@ -135,7 +135,10 @@ void clang::dpct::NVSHMEMRule::runRule( } } - llvm::outs() << "nvshmem_rt: " << nvshmem_rt << "\n"; + if (nvshmem_rt == "0" || nvshmem_init_rt == "0") { + emplaceTransformation(new ReplaceStmt(CE, "ishmem_init()")); + return; + } std::string ishmem_rt = ""; if (nvshmem_rt == "NVSHMEMX_INIT_WITH_MPI_COMM") { diff --git a/clang/test/dpct/nvshmem.cu b/clang/test/dpct/nvshmem.cu index 4d76e5888c7f..564d6d114fb9 100644 --- a/clang/test/dpct/nvshmem.cu +++ b/clang/test/dpct/nvshmem.cu @@ -62,6 +62,11 @@ int main() { // CHECK-NEXT: ishmemx_init_attr(&attr); nvshmemx_init_attr(NVSHMEMX_INIT_WITH_MPI_COMM, &attr); + // CHECK: /* + // CHECK-NEXT: DPCT1007:{{[0-9]+}}: Migration of nvshmemx_init_attr is not supported. + // CHECK-NEXT: */ + nvshmemx_init_attr(NVSHMEMX_INIT_WITH_MPI_COMM | NVSHMEMX_INIT_WITH_SHMEM, &attr); + // CHECK: unsigned int rt = ISHMEMX_RUNTIME_MPI; // CHECK-NEXT: (&attr)->runtime = static_cast(rt); // CHECK-NEXT: ishmemx_init_attr(&attr); @@ -74,6 +79,9 @@ int main() { rt = NVSHMEMX_INIT_WITH_SHMEM; nvshmemx_init_attr(rt, &attr); + // CHECK: ishmem_init(); + nvshmemx_init_attr(0, &attr); + // CHECK: ishmem_init(); nvshmem_init();