Skip to content

Commit

Permalink
[openacc][NFC] Bump parser support number to OpenACC 3.3
Browse files Browse the repository at this point in the history
Parser support reached OpenACC 3.3 specification.
Bump the numbers to reflect the latest specs.

Reviewed By: razvanlupusoru, awarzynski

Differential Revision: https://reviews.llvm.org/D154249
  • Loading branch information
clementval committed Jun 30, 2023
1 parent 1048b7f commit 0d6017c
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions flang/include/flang/Parser/parse-tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -3978,7 +3978,7 @@ struct OpenMPConstruct {
u;
};

// Parse tree nodes for OpenACC 3.1 directives and clauses
// Parse tree nodes for OpenACC 3.3 directives and clauses

struct AccObject {
UNION_CLASS_BOILERPLATE(AccObject);
Expand Down Expand Up @@ -4037,7 +4037,7 @@ struct AccObjectListWithModifier {
std::tuple<std::optional<AccDataModifier>, AccObjectList> t;
};

// 2.5.13: + | * | max | min | iand | ior | ieor | .and. | .or. | .eqv. | .neqv.
// 2.5.15: + | * | max | min | iand | ior | ieor | .and. | .or. | .eqv. | .neqv.
struct AccReductionOperator {
ENUM_CLASS(
Operator, Plus, Multiply, Max, Min, Iand, Ior, Ieor, And, Or, Eqv, Neqv)
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ void CompilerInvocation::setDefaultPredefinitions() {
// Add predefinitions based on extensions enabled
if (frontendOptions.features.IsEnabled(
Fortran::common::LanguageFeature::OpenACC)) {
fortranOptions.predefinitions.emplace_back("_OPENACC", "202011");
fortranOptions.predefinitions.emplace_back("_OPENACC", "202211");
}
if (frontendOptions.features.IsEnabled(
Fortran::common::LanguageFeature::OpenMP)) {
Expand Down
12 changes: 6 additions & 6 deletions flang/lib/Parser/openacc-parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// Top-level grammar specification for OpenACC 3.1.
// Top-level grammar specification for OpenACC 3.3.

#include "basic-parsers.h"
#include "expr-parsers.h"
Expand Down Expand Up @@ -40,12 +40,12 @@ TYPE_PARSER(construct<AccObjectListWithModifier>(
TYPE_PARSER(construct<AccObjectListWithReduction>(
Parser<AccReductionOperator>{} / ":", Parser<AccObjectList>{}))

// 2.16.3 (2485) wait-argument is:
// 2.16 (3249) wait-argument is:
// [devnum : int-expr :] [queues :] int-expr-list
TYPE_PARSER(construct<AccWaitArgument>(maybe("DEVNUM:" >> scalarIntExpr / ":"),
"QUEUES:" >> nonemptyList(scalarIntExpr) || nonemptyList(scalarIntExpr)))

// 2.9 (1609) size-expr is one of:
// 2.9 (1984-1986) size-expr is one of:
// * (represented as an empty std::optional<ScalarIntExpr>)
// int-expr
TYPE_PARSER(construct<AccSizeExpr>(scalarIntExpr) ||
Expand All @@ -66,7 +66,7 @@ TYPE_PARSER(construct<AccTileExpr>(scalarIntConstantExpr) ||
"*" >> construct<std::optional<ScalarIntConstantExpr>>()))
TYPE_PARSER(construct<AccTileExprList>(nonemptyList(Parser<AccTileExpr>{})))

// 2.9 gang-arg is one of :
// 2.9 (1979-1982) gang-arg is one of :
// [num:]int-expr
// dim:int-expr
// static:size-expr
Expand All @@ -85,7 +85,7 @@ TYPE_PARSER(
TYPE_PARSER(construct<AccCollapseArg>(
"FORCE:"_tok >> pure(true) || pure(false), scalarIntConstantExpr))

// 2.5.13 Reduction
// 2.5.15 Reduction
// Operator for reduction
TYPE_PARSER(sourced(construct<AccReductionOperator>(
first("+" >> pure(AccReductionOperator::Operator::Plus),
Expand All @@ -104,7 +104,7 @@ TYPE_PARSER(sourced(construct<AccReductionOperator>(
TYPE_PARSER(sourced(construct<AccBindClause>(name)) ||
sourced(construct<AccBindClause>(scalarDefaultCharExpr)))

// 2.5.14 Default clause
// 2.5.16 Default clause
TYPE_PARSER(construct<AccDefaultClause>(
first("NONE" >> pure(llvm::acc::DefaultValue::ACC_Default_none),
"PRESENT" >> pure(llvm::acc::DefaultValue::ACC_Default_present))))
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Semantics/check-acc-structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// OpenACC 3.1 structure validity check list
// OpenACC 3.3 structure validity check list
// 1. invalid clauses on directive
// 2. invalid repeated clauses on directive
// 3. invalid nesting of regions
Expand Down
2 changes: 1 addition & 1 deletion flang/tools/bbc/bbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ int main(int argc, char **argv) {
// enable parsing of OpenACC
if (enableOpenACC) {
options.features.Enable(Fortran::common::LanguageFeature::OpenACC);
options.predefinitions.emplace_back("_OPENACC", "202011");
options.predefinitions.emplace_back("_OPENACC", "202211");
}

Fortran::common::IntrinsicTypeDefaultKinds defaultKinds;
Expand Down
21 changes: 11 additions & 10 deletions llvm/include/llvm/Frontend/OpenACC/ACC.td
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
//
// This is the definition file for OpenACC 3.1 directives and clauses.
// This is the definition file for OpenACC 3.3 directives and clauses.
//
//===----------------------------------------------------------------------===//

Expand Down Expand Up @@ -64,6 +64,7 @@ def ACCC_Copy : Clause<"copy"> {
let flangClass = "AccObjectList";
let aliases = ["present_or_copy", "pcopy"];
}

// 2.7.7
def ACCC_Copyin : Clause<"copyin"> {
let flangClass = "AccObjectListWithModifier";
Expand All @@ -82,7 +83,7 @@ def ACCC_Create : Clause<"create"> {
let aliases = ["present_or_create", "pcreate"];
}

// 2.5.15
// 2.5.16
def ACC_Default_none : ClauseVal<"none", 1, 1> { let isDefault = 1; }
def ACC_Default_present : ClauseVal<"present", 0, 1> {}

Expand Down Expand Up @@ -140,7 +141,7 @@ def ACCC_DeviceType : Clause<"device_type"> {
// 2.6.6
def ACCC_Finalize : Clause<"finalize"> {}

// 2.5.13
// 2.5.14
def ACCC_FirstPrivate : Clause<"firstprivate"> {
let flangClass = "AccObjectList";
}
Expand All @@ -156,7 +157,7 @@ def ACCC_Host : Clause<"host"> {
let flangClass = "AccObjectList";
}

// 2.5.5
// 2.5.6
def ACCC_If : Clause <"if"> {
let flangClass = "ScalarLogicalExpr";
}
Expand All @@ -180,13 +181,13 @@ def ACCC_NoCreate : Clause<"no_create"> {
// 2.15.1
def ACCC_NoHost : Clause<"nohost"> {}

// 2.5.9
// 2.5.10
def ACCC_NumGangs : Clause<"num_gangs"> {
let flangClass = "ScalarIntExpr";
let isValueList = 1;
}

// 2.5.10
// 2.5.11
def ACCC_NumWorkers : Clause<"num_workers"> {
let flangClass = "ScalarIntExpr";
}
Expand All @@ -196,7 +197,7 @@ def ACCC_Present : Clause<"present"> {
let flangClass = "AccObjectList";
}

// 2.5.12
// 2.5.13
def ACCC_Private : Clause<"private"> {
let flangClass = "AccObjectList";
}
Expand All @@ -214,12 +215,12 @@ def ACCC_UseDevice : Clause <"use_device"> {
// 2.12
def ACCC_Read : Clause<"read"> {}

// 2.5.14
// 2.5.15
def ACCC_Reduction : Clause<"reduction"> {
let flangClass = "AccObjectListWithReduction";
}

// 2.5.6
// 2.5.7
def ACCC_Self : Clause<"self"> {
let flangClass = "AccSelfClause";
let isValueOptional = true;
Expand All @@ -235,7 +236,7 @@ def ACCC_Vector : Clause<"vector"> {
let prefix = "length";
}

// 2.5.11
// 2.5.12
def ACCC_VectorLength : Clause<"vector_length"> {
let flangClass = "ScalarIntExpr";
}
Expand Down
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/OpenACC/OpenACC.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace mlir {
namespace acc {

/// Enumeration used to encode the execution mapping on a loop construct.
/// They refer directly to the OpenACC 3.1 standard:
/// They refer directly to the OpenACC 3.3 standard:
/// 2.9.2. gang
/// 2.9.3. worker
/// 2.9.4. vector
Expand Down
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/OpenACC/OpenACCBase.td
Original file line number Diff line number Diff line change
Expand Up @@ -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.1 directive language.
This dialect models the construct from the OpenACC 3.3 directive language.
}];

let useDefaultAttributePrinterParser = 1;
Expand Down

0 comments on commit 0d6017c

Please sign in to comment.