This patch handles empty hint value for critical and atomic constructs.
This also adds checks and tests for hint clause on atomic constructs.
| Paths 
 |  Differential  D123186  
[mlir][OpenMP] Add checks and tests for hint clause and fix empty hint ClosedPublic Authored by shraiysh on Apr 5 2022, 11:39 PM. 
Details Summary This patch handles empty hint value for critical and atomic constructs. This also adds checks and tests for hint clause on atomic constructs. 
Diff Detail 
 Event TimelineHerald added subscribers: sstefan1, stephenneuendorffer, nicolasvasilache, jdoerfert.  ·  View Herald Transcript shraiysh added reviewers: peixin, kiranchandramohan, schweitz, clementval, kiranktp, NimishMishra, AMDChirag.Apr 5 2022, 11:45 PMComment Actions Another way to handle this would be to give up the string based syntax for hint and instead have an integer based syntax. i.e. hint(5) instead of hint(uncontended, nonspeculative) - with the value of hint instead of the names. Last time, there was some resistance for the integer based syntax for readability. I do not have a strong preference for one way or another. Let me know if integer based syntax sounds good. Comment Actions 
 I was recommending the string-based syntax for readability. I would suggest keeping it, but if we continue to face issues then we can go to the integer syntax. Do we need some llvm it translation tests as well? Comment Actions 
 Hints are basically unused for translation to LLVM IR at the moment. Clang doesn't seem to use them either. So, there should be no tests for that. Comment Actions Added LLVM IR Translation tests for omp.critical construct. Atomic construct translation ignores the hint clause in current implementation hence no tests for the same. 
 shraiysh added inline comments. 
 This revision is now accepted and ready to land.Apr 18 2022, 12:16 AM Comment Actions @kiranchandramohan Is this OK to you? The lowering atomic read/write depends on this patch, so can we give high priority for this? Comment Actions 
 Fine with me. Closed by commit rG88bb2521b006: [mlir][OpenMP] Add checks and tests for hint clause and fix empty hint (authored by shraiysh).  ·  Explain WhyApr 20 2022, 7:01 PM This revision was automatically updated to reflect the committed changes. 
Revision Contents 
 
Diff 424077 flang/test/Lower/OpenMP/critical.f90
 mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
 mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
 mlir/test/Dialect/OpenMP/invalid.mlir
 mlir/test/Dialect/OpenMP/ops.mlir
 mlir/test/Target/LLVMIR/openmp-llvm.mlir
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
One question: Will we ever reach this point from a legal fortran source code?
A capture construct proceeds as:
!$omp atomic capture update / capture / capture capture / update / write !$omp end atomic/ delimits the three combinations in capture construct we can have. Here, capture statement is v=x while write is x=expr. Is it possible to define a hint clause here?