[OPENMP]Improve diagnostics for unsupported unified addressing.

Improved diagnostics for better user experience.
This commit is contained in:
Alexey Bataev 2019-11-05 10:10:50 -05:00
parent 100e797adb
commit 7b710a4294
2 changed files with 10 additions and 5 deletions

View File

@ -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:

View File

@ -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