From 7b710a4294c1baed0157d86d3e2dabac78c306ce Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Tue, 5 Nov 2019 10:10:50 -0500 Subject: [PATCH] [OPENMP]Improve diagnostics for unsupported unified addressing. Improved diagnostics for better user experience. --- clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp | 13 +++++++++---- clang/test/OpenMP/requires_codegen.cpp | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp index eab2d7b..96716c0 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp @@ -4954,7 +4954,8 @@ void CGOpenMPRuntimeNVPTX::checkArchForUnifiedAddressing( const OMPRequiresDecl *D) { for (const OMPClause *Clause : D->clauselists()) { if (Clause->getClauseKind() == OMPC_unified_shared_memory) { - switch (getCudaArch(CGM)) { + CudaArch Arch = getCudaArch(CGM); + switch (Arch) { case CudaArch::SM_20: case CudaArch::SM_21: case CudaArch::SM_30: @@ -4966,10 +4967,14 @@ void CGOpenMPRuntimeNVPTX::checkArchForUnifiedAddressing( case CudaArch::SM_53: case CudaArch::SM_60: case CudaArch::SM_61: - case CudaArch::SM_62: - CGM.Error(Clause->getBeginLoc(), - "Target architecture does not support unified addressing"); + case CudaArch::SM_62: { + SmallString<256> Buffer; + llvm::raw_svector_ostream Out(Buffer); + Out << "Target architecture " << CudaArchToString(Arch) + << " does not support unified addressing"; + CGM.Error(Clause->getBeginLoc(), Out.str()); return; + } case CudaArch::SM_70: case CudaArch::SM_72: case CudaArch::SM_75: diff --git a/clang/test/OpenMP/requires_codegen.cpp b/clang/test/OpenMP/requires_codegen.cpp index e94fd28..84821e8 100644 --- a/clang/test/OpenMP/requires_codegen.cpp +++ b/clang/test/OpenMP/requires_codegen.cpp @@ -21,5 +21,5 @@ #endif #ifdef REGION_DEVICE -#pragma omp requires unified_shared_memory // expected-error {{Target architecture does not support unified addressing}} +#pragma omp requires unified_shared_memory // expected-error-re {{Target architecture sm_{{20|21|30|32|35|37|50|52|53|60|61|62}} does not support unified addressing}} #endif -- 2.7.4