This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP 5.2] Deprecate MINUS (-) operator on reduction clauses
ClosedPublic

Authored by mdfazlay on May 11 2023, 12:49 PM.

Details

Reviewers
jdoerfert
ABataev
Summary

The minus (-) operator for reductions was deprecated in OpenMP 5.2.

Reference:
(1) OpenMP 5.2 Page 627 Line 18
(1) OpenMP 5.2 Page 124 (Section 5.5) Line 18 and 20

Diff Detail

Event Timeline

mdfazlay created this revision.May 11 2023, 12:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 11 2023, 12:49 PM
mdfazlay requested review of this revision.May 11 2023, 12:49 PM
Herald added a project: Restricted Project. · View Herald Transcript
mdfazlay retitled this revision from [OpenMP 5.2] Deprecate MINUS (-) operator from reduction clauses to [OpenMP 5.2] Deprecate MINUS (-) operator on reduction clauses.May 11 2023, 9:31 PM
ABataev added inline comments.May 15 2023, 6:56 AM
clang/include/clang/Basic/DiagnosticSemaKinds.td
10487–10488

We already have message for unsupported reduction identifier. Better to modify switch in static bool actOnOMPReductionKindClause function and check if OpenMP > 52, set BOK to BO_Comma, if incoming OOK is OO_Minus. In this case it will be automatically diagnosed for OpenMP>52 as not allowed reduction identifier.

10490

use + or user defined reudction instead? And better make it a fixme note.

mdfazlay added inline comments.May 16 2023, 11:58 AM
clang/include/clang/Basic/DiagnosticSemaKinds.td
10490

@ABataev, Do you want me to add a warning and a note at the same location? Or Changing the warning message to minus(-) operator for reductions is deprecated; use + or user defined reduction instead is just fine? Please let me know which one you prefer.

ABataev added inline comments.May 16 2023, 1:47 PM
clang/include/clang/Basic/DiagnosticSemaKinds.td
10490

Would be good to have both. But since it is a temp warning, I'm fine with your message

mdfazlay updated this revision to Diff 523098.May 17 2023, 10:18 AM
mdfazlay added inline comments.
clang/include/clang/Basic/DiagnosticSemaKinds.td
10490

I have addressed your comments. Please let me know if anything needs to be revised.

mdfazlay added inline comments.May 17 2023, 10:29 AM
clang/include/clang/Basic/DiagnosticSemaKinds.td
10487–10488

BTW, I think we need to remove minus (-) from the incorrect reduction identifier error message once OpenMP 6.0 becomes official. Please take a look at the following output:

$ cat test.c
void foo() {
  int a = 0 ;
#pragma omp parallel reduction(-:a)
  ;
}
> clang -fopenmp -fopenmp-version=60 test.c -c
test.c:3:32: error: incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'
#pragma omp parallel reduction(-:a)
                               ^
1 error generated.
ABataev accepted this revision.May 17 2023, 4:20 PM

LG

clang/include/clang/Basic/DiagnosticSemaKinds.td
10487–10488

Yes, need to create versioned message:prior 6.0 and after 6.0.

This revision is now accepted and ready to land.May 17 2023, 4:20 PM
mdfazlay closed this revision.May 18 2023, 2:09 PM

Commit ID - c657363