[flang-commits] [flang] d553243 - [flang][openacc] Update reference to OpenACC 3.1 specification

via flang-commits flang-commits at lists.llvm.org
Tue Dec 8 11:36:46 PST 2020


Author: Valentin Clement
Date: 2020-12-08T14:36:38-05:00
New Revision: d553243fe4b5e1992c07aff7b54b16160a4d5e97

URL: https://github.com/llvm/llvm-project/commit/d553243fe4b5e1992c07aff7b54b16160a4d5e97
DIFF: https://github.com/llvm/llvm-project/commit/d553243fe4b5e1992c07aff7b54b16160a4d5e97.diff

LOG: [flang][openacc] Update reference to OpenACC 3.1 specification

Update all reference from the specification to the new OpenACC 3.1
document.

Reviewed By: SouraVX

Differential Revision: https://reviews.llvm.org/D92120

Added: 
    

Modified: 
    flang/include/flang/Parser/parse-tree.h
    flang/lib/Parser/openacc-parsers.cpp
    flang/lib/Semantics/check-acc-structure.cpp
    flang/lib/Semantics/check-acc-structure.h
    flang/tools/f18/f18.cpp
    llvm/include/llvm/Frontend/OpenACC/ACC.td
    mlir/include/mlir/Dialect/OpenACC/OpenACC.h
    mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h
index c990ddd5c915..6bed37c2b871 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -3781,7 +3781,7 @@ struct OpenMPConstruct {
       u;
 };
 
-// Parse tree nodes for OpenACC 3.0 directives and clauses
+// Parse tree nodes for OpenACC 3.1 directives and clauses
 
 struct AccObject {
   UNION_CLASS_BOILERPLATE(AccObject);

diff  --git a/flang/lib/Parser/openacc-parsers.cpp b/flang/lib/Parser/openacc-parsers.cpp
index bba886f2fbfd..b4d2b285cd6c 100644
--- a/flang/lib/Parser/openacc-parsers.cpp
+++ b/flang/lib/Parser/openacc-parsers.cpp
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-// Top-level grammar specification for OpenACC 3.0.
+// Top-level grammar specification for OpenACC 3.1.
 
 #include "basic-parsers.h"
 #include "expr-parsers.h"

diff  --git a/flang/lib/Semantics/check-acc-structure.cpp b/flang/lib/Semantics/check-acc-structure.cpp
index d6be718aa2c1..c88e7f8eaaa3 100644
--- a/flang/lib/Semantics/check-acc-structure.cpp
+++ b/flang/lib/Semantics/check-acc-structure.cpp
@@ -23,14 +23,11 @@
 namespace Fortran::semantics {
 
 static constexpr inline AccClauseSet
-    parallelAndKernelsOnlyAllowedAfterDeviceTypeClauses{
+    computeConstructOnlyAllowedAfterDeviceTypeClauses{
         llvm::acc::Clause::ACCC_async, llvm::acc::Clause::ACCC_wait,
         llvm::acc::Clause::ACCC_num_gangs, llvm::acc::Clause::ACCC_num_workers,
         llvm::acc::Clause::ACCC_vector_length};
 
-static constexpr inline AccClauseSet serialOnlyAllowedAfterDeviceTypeClauses{
-    llvm::acc::Clause::ACCC_async, llvm::acc::Clause::ACCC_wait};
-
 static constexpr inline AccClauseSet loopOnlyAllowedAfterDeviceTypeClauses{
     llvm::acc::Clause::ACCC_auto, llvm::acc::Clause::ACCC_collapse,
     llvm::acc::Clause::ACCC_independent, llvm::acc::Clause::ACCC_gang,
@@ -80,27 +77,19 @@ void AccStructureChecker::Leave(const parser::OpenACCBlockConstruct &x) {
   switch (blockDir.v) {
   case llvm::acc::Directive::ACCD_kernels:
   case llvm::acc::Directive::ACCD_parallel:
-    // Restriction - 880-881 (KERNELS)
-    // Restriction - 843-844 (PARALLEL)
-    CheckOnlyAllowedAfter(llvm::acc::Clause::ACCC_device_type,
-        parallelAndKernelsOnlyAllowedAfterDeviceTypeClauses);
-    // Restriction - 877 (KERNELS)
-    // Restriction - 840 (PARALLEL)
-    CheckNoBranching(block, GetContext().directive, blockDir.source);
-    break;
   case llvm::acc::Directive::ACCD_serial:
-    // Restriction - 919
+    // Restriction - line 1004-1005
     CheckOnlyAllowedAfter(llvm::acc::Clause::ACCC_device_type,
-        serialOnlyAllowedAfterDeviceTypeClauses);
-    // Restriction - 916
-    CheckNoBranching(block, llvm::acc::Directive::ACCD_serial, blockDir.source);
+        computeConstructOnlyAllowedAfterDeviceTypeClauses);
+    // Restriction - line 1001
+    CheckNoBranching(block, GetContext().directive, blockDir.source);
     break;
   case llvm::acc::Directive::ACCD_data:
-    // Restriction - 1117-1118
+    // Restriction - line 1249-1250
     CheckRequireAtLeastOneOf();
     break;
   case llvm::acc::Directive::ACCD_host_data:
-    // Restriction - 1578
+    // Restriction - line 1746
     CheckRequireAtLeastOneOf();
     break;
   default:
@@ -117,7 +106,7 @@ void AccStructureChecker::Enter(
 
 void AccStructureChecker::Leave(
     const parser::OpenACCStandaloneDeclarativeConstruct &) {
-  // Restriction - 2075
+  // Restriction - line 2409
   CheckAtLeastOneClause();
   dirContext_.pop_back();
 }
@@ -144,18 +133,10 @@ void AccStructureChecker::Leave(const parser::OpenACCCombinedConstruct &x) {
   switch (combinedDir.v) {
   case llvm::acc::Directive::ACCD_kernels_loop:
   case llvm::acc::Directive::ACCD_parallel_loop:
-    // Restriction - 1962 -> (880-881) (KERNELS LOOP)
-    // Restriction - 1962 -> (843-844) (PARALLEL LOOP)
-    CheckOnlyAllowedAfter(llvm::acc::Clause::ACCC_device_type,
-        {llvm::acc::Clause::ACCC_async, llvm::acc::Clause::ACCC_wait,
-            llvm::acc::Clause::ACCC_num_gangs,
-            llvm::acc::Clause::ACCC_num_workers,
-            llvm::acc::Clause::ACCC_vector_length});
-    break;
   case llvm::acc::Directive::ACCD_serial_loop:
-    // Restriction - 1962 -> (919) (SERIAL LOOP)
+    // Restriction - line 1004-1005
     CheckOnlyAllowedAfter(llvm::acc::Clause::ACCC_device_type,
-        {llvm::acc::Clause::ACCC_async, llvm::acc::Clause::ACCC_wait});
+        computeConstructOnlyAllowedAfterDeviceTypeClauses);
     break;
   default:
     break;
@@ -173,10 +154,10 @@ void AccStructureChecker::Leave(const parser::OpenACCLoopConstruct &x) {
   const auto &beginDir{std::get<parser::AccBeginLoopDirective>(x.t)};
   const auto &loopDir{std::get<parser::AccLoopDirective>(beginDir.t)};
   if (loopDir.v == llvm::acc::Directive::ACCD_loop) {
-    // Restriction - 1615-1616
+    // Restriction - line 1818-1819
     CheckOnlyAllowedAfter(llvm::acc::Clause::ACCC_device_type,
         loopOnlyAllowedAfterDeviceTypeClauses);
-    // Restriction - 1622
+    // Restriction - line 1834
     CheckNotAllowedIfClause(llvm::acc::Clause::ACCC_seq,
         {llvm::acc::Clause::ACCC_gang, llvm::acc::Clause::ACCC_vector,
             llvm::acc::Clause::ACCC_worker});
@@ -195,15 +176,15 @@ void AccStructureChecker::Leave(const parser::OpenACCStandaloneConstruct &x) {
   case llvm::acc::Directive::ACCD_enter_data:
   case llvm::acc::Directive::ACCD_exit_data:
   case llvm::acc::Directive::ACCD_set:
-    // Restriction - 1117-1118 (ENTER DATA)
-    // Restriction - 1161-1162 (EXIT DATA)
-    // Restriction - 2254 (SET)
+    // Restriction - line 1310-1311 (ENTER DATA)
+    // Restriction - line 1312-1313 (EXIT DATA)
+    // Restriction - line 2610 (SET)
     CheckRequireAtLeastOneOf();
     break;
   case llvm::acc::Directive::ACCD_update:
     // Restriction - line 2636
     CheckRequireAtLeastOneOf();
-    // Restriction - 2301
+    // Restriction - line 2669
     CheckOnlyAllowedAfter(llvm::acc::Clause::ACCC_device_type,
         updateOnlyAllowedAfterDeviceTypeClauses);
     break;
@@ -217,9 +198,9 @@ void AccStructureChecker::Enter(const parser::OpenACCRoutineConstruct &x) {
   PushContextAndClauseSets(x.source, llvm::acc::Directive::ACCD_routine);
 }
 void AccStructureChecker::Leave(const parser::OpenACCRoutineConstruct &) {
-  // Restriction - 2409
+  // Restriction - line 2790
   CheckRequireAtLeastOneOf();
-  // Restriction - 2407-2408
+  // Restriction - line 2788-2789
   CheckOnlyAllowedAfter(llvm::acc::Clause::ACCC_device_type,
       routineOnlyAllowedAfterDeviceTypeClauses);
   dirContext_.pop_back();

diff  --git a/flang/lib/Semantics/check-acc-structure.h b/flang/lib/Semantics/check-acc-structure.h
index e2ea3899c98b..85f01ba8271d 100644
--- a/flang/lib/Semantics/check-acc-structure.h
+++ b/flang/lib/Semantics/check-acc-structure.h
@@ -4,7 +4,7 @@
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
-// OpenACC structure validity check list
+// OpenACC 3.1 structure validity check list
 //    1. invalid clauses on directive
 //    2. invalid repeated clauses on directive
 //    3. invalid nesting of regions

diff  --git a/flang/tools/f18/f18.cpp b/flang/tools/f18/f18.cpp
index 895e61ecd5e3..b0cc2298005e 100644
--- a/flang/tools/f18/f18.cpp
+++ b/flang/tools/f18/f18.cpp
@@ -489,7 +489,7 @@ int main(int argc, char *const argv[]) {
       driver.warnOnNonstandardUsage = true;
     } else if (arg == "-fopenacc") {
       options.features.Enable(Fortran::common::LanguageFeature::OpenACC);
-      options.predefinitions.emplace_back("_OPENACC", "201911");
+      options.predefinitions.emplace_back("_OPENACC", "202011");
     } else if (arg == "-fopenmp") {
       options.features.Enable(Fortran::common::LanguageFeature::OpenMP);
       options.predefinitions.emplace_back("_OPENMP", "201511");

diff  --git a/llvm/include/llvm/Frontend/OpenACC/ACC.td b/llvm/include/llvm/Frontend/OpenACC/ACC.td
index 4c1d6324929f..10c21c851853 100644
--- a/llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ b/llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -6,7 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This is the definition file for OpenACC directives and clauses.
+// This is the definition file for OpenACC 3.1 directives and clauses.
 //
 //===----------------------------------------------------------------------===//
 
@@ -38,10 +38,10 @@ def ACCC_Async : Clause<"async"> {
   let isValueOptional = true;
 }
 
-// 2.9.6
+// 2.9.7
 def ACCC_Auto : Clause<"auto"> {}
 
-// 2.7.11
+// 2.7.12
 def ACCC_Attach : Clause<"attach"> {
   let flangClassValue = "AccObjectList";
 }
@@ -60,41 +60,41 @@ def ACCC_Collapse : Clause<"collapse"> {
   let flangClassValue = "ScalarIntConstantExpr";
 }
 
-// 2.7.5
+// 2.7.6
 def ACCC_Copy : Clause<"copy"> {
   let flangClassValue = "AccObjectList";
 }
-// 2.7.6
+// 2.7.7
 def ACCC_Copyin : Clause<"copyin"> {
   let flangClassValue = "AccObjectListWithModifier";
 }
 
-// 2.7.7
+// 2.7.8
 def ACCC_Copyout : Clause<"copyout"> {
   let flangClassValue = "AccObjectListWithModifier";
 }
 
-// 2.7.8
+// 2.7.9
 def ACCC_Create : Clause<"create"> {
   let flangClassValue = "AccObjectListWithModifier";
 }
 
-// 2.5.14
+// 2.5.15
 def ACCC_Default : Clause<"default"> {
   let flangClassValue = "AccDefaultClause";
 }
 
-// 2.4.12
+// 2.14.3
 def ACCC_DefaultAsync : Clause<"default_async"> {
   let flangClassValue = "ScalarIntExpr";
 }
 
-// 2.7.10
+// 2.7.11
 def ACCC_Delete : Clause<"delete"> {
   let flangClassValue = "AccObjectList";
 }
 
-// 2.7.12
+// 2.7.13
 def ACCC_Detach : Clause<"detach"> {
   let flangClassValue = "AccObjectList";
 }
@@ -104,17 +104,17 @@ def ACCC_Device : Clause<"device"> {
   let flangClassValue = "AccObjectList";
 }
 
-// 2.14.1
+// 2.14.1 - 2.14.2
 def ACCC_DeviceNum : Clause<"device_num">  {
   let flangClassValue = "ScalarIntExpr";
 }
 
-// 2.7.3
+// 2.7.4
 def ACCC_DevicePtr : Clause<"deviceptr"> {
   let flangClassValue = "AccObjectList";
 }
 
-// 2.13
+// 2.13.1
 def ACCC_DeviceResident : Clause<"device_resident"> {
   let flangClassValue = "AccObjectList";
 }
@@ -130,7 +130,7 @@ def ACCC_DeviceType : Clause<"device_type"> {
 // 2.6.6
 def ACCC_Finalize : Clause<"finalize"> {}
 
-// 2.5.12
+// 2.5.13
 def ACCC_FirstPrivate : Clause<"firstprivate"> {
   let flangClassValue = "AccObjectList";
 }
@@ -146,7 +146,7 @@ def ACCC_Host : Clause<"host"> {
   let flangClassValue = "AccObjectList";
 }
 
-// 2.5.4
+// 2.5.5
 def ACCC_If : Clause <"if"> {
   let flangClassValue = "ScalarLogicalExpr";
 }
@@ -154,15 +154,15 @@ def ACCC_If : Clause <"if"> {
 // 2.14.4
 def ACCC_IfPresent : Clause<"if_present"> {}
 
-// 2.9.9
+// 2.9.6
 def ACCC_Independent : Clause<"independent"> {}
 
-// 2.13
+// 2.13.3
 def ACCC_Link : Clause<"link"> {
   let flangClassValue = "AccObjectList";
 }
 
-// 2.7.9
+// 2.7.10
 def ACCC_NoCreate : Clause<"no_create"> {
   let flangClassValue = "AccObjectList";
 }
@@ -170,27 +170,27 @@ def ACCC_NoCreate : Clause<"no_create"> {
 // 2.15.1
 def ACCC_NoHost : Clause<"nohost"> {}
 
-// 2.5.8
+// 2.5.9
 def ACCC_NumGangs : Clause<"num_gangs"> {
   let flangClassValue = "ScalarIntExpr";
 }
 
-// 2.5.9
+// 2.5.10
 def ACCC_NumWorkers : Clause<"num_workers"> {
   let flangClassValue = "ScalarIntExpr";
 }
 
-// 2.7.4
+// 2.7.5
 def ACCC_Present : Clause<"present"> {
   let flangClassValue = "AccObjectList";
 }
 
-// 2.5.11
+// 2.5.12
 def ACCC_Private : Clause<"private"> {
   let flangClassValue = "AccObjectList";
 }
 
-// 2.9.7
+// 2.9.8
 def ACCC_Tile : Clause <"tile"> {
   let flangClassValue = "AccTileExprList";
 }
@@ -203,12 +203,12 @@ def ACCC_UseDevice : Clause <"use_device"> {
 // 2.12
 def ACCC_Read : Clause<"read"> {}
 
-// 2.5.13
+// 2.5.14
 def ACCC_Reduction : Clause<"reduction"> {
   let flangClassValue = "AccObjectListWithReduction";
 }
 
-// 2.5.5
+// 2.5.6
 def ACCC_Self : Clause<"self"> {
   let flangClassValue = "AccSelfClause";
 }
@@ -222,7 +222,7 @@ def ACCC_Vector : Clause<"vector"> {
   let isValueOptional = true;
 }
 
-// 2.5.10
+// 2.5.11
 def ACCC_VectorLength : Clause<"vector_length"> {
   let flangClassValue = "ScalarIntExpr";
 }
@@ -286,7 +286,7 @@ def ACC_Declare : Directive<"declare"> {
   ];
 }
 
-// 2.5.2
+// 2.5.3
 def ACC_Kernels : Directive<"kernels"> {
   let allowedClauses = [
     VersionedClause<ACCC_Attach>,
@@ -339,7 +339,7 @@ def ACC_Parallel : Directive<"parallel"> {
   ];
 }
 
-// 2.5.3
+// 2.5.2
 def ACC_Serial : Directive<"serial"> {
   let allowedClauses = [
     VersionedClause<ACCC_Attach>,
@@ -493,6 +493,8 @@ def ACC_ExitData : Directive<"exit data"> {
     VersionedClause<ACCC_Detach>
   ];
 }
+
+// 2.8
 def ACC_HostData : Directive<"host_data"> {
   let allowedClauses = [
     VersionedClause<ACCC_If>,

diff  --git a/mlir/include/mlir/Dialect/OpenACC/OpenACC.h b/mlir/include/mlir/Dialect/OpenACC/OpenACC.h
index 40700e6d1b73..9080b277625d 100644
--- a/mlir/include/mlir/Dialect/OpenACC/OpenACC.h
+++ b/mlir/include/mlir/Dialect/OpenACC/OpenACC.h
@@ -26,7 +26,7 @@ namespace mlir {
 namespace acc {
 
 /// Enumeration used to encode the execution mapping on a loop construct.
-/// They refer directly to the OpenACC 3.0 standard:
+/// They refer directly to the OpenACC 3.1 standard:
 /// 2.9.2. gang
 /// 2.9.3. worker
 /// 2.9.4. vector

diff  --git a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
index ccc623377ea6..6feec888ec8e 100644
--- a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
+++ b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
@@ -21,7 +21,7 @@ def OpenACC_Dialect : Dialect {
   let summary = "An OpenACC dialect for MLIR.";
 
   let description = [{
-    This dialect models the construct from the OpenACC 3.0 directive language.
+    This dialect models the construct from the OpenACC 3.1 directive language.
   }];
 
   let cppNamespace = "::mlir::acc";


        


More information about the flang-commits mailing list