forked from wangliu-iscas/gcc-patch
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement host_data must have use_device clause requirement
On 2023/6/16 5:13 PM, Thomas Schwinge wrote: > OK with one small change, please -- unless there's a reason for doing it > this way: > >> --- a/gcc/fortran/trans-openmp.cc >> +++ b/gcc/fortran/trans-openmp.cc >> @@ -4677,6 +4677,12 @@ gfc_trans_oacc_construct (gfc_code *code) >> break; >> case EXEC_OACC_HOST_DATA: >> construct_code = OACC_HOST_DATA; >> + if (code->ext.omp_clauses->lists[OMP_LIST_USE_DEVICE] == NULL) >> + { >> + error_at (gfc_get_location (&code->loc), >> + "%<host_data%> construct requires %<use_device%> clause"); >> + return NULL_TREE; >> + } >> break; >> default: >> gcc_unreachable (); > The OpenMP "must contain at least one [...] clause" checks are done in > 'gcc/fortran/openmp.cc:resolve_omp_clauses'. For consistency (or, to let > 'gcc/fortran/trans-openmp.cc' continue to just deal with "directive > translation"), do similar for OpenACC 'host_data'? (..., and we later > accordingly adjust 'gcc/fortran/openmp.cc:gfc_match_oacc_update', too?) Hi Thomas, I've adjusted the Fortran implementation as you described. Yes, I agree this way more fits current Fortran FE conventions. I've re-tested the attached v2 patch, will commit later this week if no major objections. Thanks, Chung-Lin gcc/c/ChangeLog: * c-parser.cc (c_parser_oacc_host_data): Add checking requiring OpenACC host_data construct to have an use_device clause. gcc/cp/ChangeLog: * parser.cc (cp_parser_oacc_host_data): Add checking requiring OpenACC host_data construct to have an use_device clause. gcc/fortran/ChangeLog: * openmp.cc (resolve_omp_clauses): Add checking requiring OpenACC host_data construct to have an use_device clause. gcc/testsuite/ChangeLog: * c-c++-common/goacc/host_data-2.c: Adjust testcase. * gfortran.dg/goacc/host_data-error.f90: New testcase. * gfortran.dg/goacc/pr71704.f90: Adjust testcase.
- Loading branch information
1 parent
c2d62cd
commit b220c24
Showing
6 changed files
with
37 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
! { dg-do compile } | ||
|
||
subroutine foo () | ||
!$acc host_data ! { dg-error "'host_data' construct at .1. requires 'use_device' clause" } | ||
!$acc end host_data | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters