[PATCH] D76342: [OpenMP] Implement '#pragma omp tile'

Narayanaswamy, Ravi via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 18 13:13:26 PDT 2020


If it Is not updated can you update the OpenMP feature tracking doc. https://clang.llvm.org/docs/OpenMPSupport.html
Thanks
Ravi

-----Original Message-----
From: Michael Kruse via Phabricator <reviews at reviews.llvm.org> 
Sent: Tuesday, March 17, 2020 8:34 PM
To: a.bataev at hotmail.com; jdoerfert at anl.gov; hfinkel at anl.gov; Wilmarth, Terry L <terry.l.wilmarth at intel.com>; Bae, Hansang <hansang.bae at intel.com>; protze.joachim at gmail.com; Churbanov, Andrey <Andrey.Churbanov at intel.com>; Narayanaswamy, Ravi <ravi.narayanaswamy at intel.com>; jonathanchesterfield at gmail.com; Rokos, Georgios <georgios.rokos at intel.com>
Cc: jholewinski at nvidia.com; zhang.guansong at gmail.com; arphaman at gmail.com; cfe-commits at lists.llvm.org; p8u8i7l5t1q9r8w3 at ibm-systems-z.slack.com; 1.int32 at gmail.com
Subject: [PATCH] D76342: [OpenMP] Implement '#pragma omp tile'

Meinersbur created this revision.
Meinersbur added reviewers: ABataev, jdoerfert, hfinkel, tlwilmar, hbae, protze.joachim, AndreyChurbanov, RaviNarayanaswamy, JonChesterfield, grokos.
Herald added subscribers: arphaman, guansong, hiraditya, jholewinski.

The tile directive is in OpenMP's Technical Report 8 and foreseeably will be part of the upcoming OpenMP 5.1 standard.

This implementation is based on an AST transformation providing a de-sugared loop nest. This makes it simple to forward the de-sugared transformation to loop associated directives taking the tiled loops. In contrast to other loop associated directives, the OMPTileDirective does not use CapturedStmts. Letting loop associated directives consume loops from different capture context would be difficult.

A significant amount of code generation logic is taking place in the Sema class. Eventually, I would prefer if these would move into the CodeGen component such that we could make use of the OpenMPIRBuilder, together with flang. Only expressions converting between the language's iteration variable and the logical iteration space need to take place in the semantic analyzer: Getting the of iterations (e.g. the overload resolution of `std::distance`) and converting the logical iteration number to the iteration variable (e.g. overload resolution of `iteration + .omp.iv`). In clang, only CXXForRangeStmt is also represented by its de-sugared components. However, OpenMP loop are not defined as syntatic sugar. Starting with an AST-based approach allows us to gradually move generated AST statements into CodeGen, instead all at once.

I would also like to refactor `checkOpenMPLoop` into its functionalities in a follow-up. In this patch it is used twice. Once for checking proper nesting and emitting diagnostics, and additionally for deriving the logical iteration space per-loop (instead of for the loop nest).


Repository:
  rC Clang

https://reviews.llvm.org/D76342

Files:
  clang/include/clang-c/Index.h
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/AST/StmtOpenMP.h
  clang/include/clang/Basic/DiagnosticCommonKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/OpenMPKinds.def
  clang/include/clang/Basic/OpenMPKinds.h
  clang/include/clang/Basic/StmtNodes.td
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/AST/StmtOpenMP.cpp
  clang/lib/AST/StmtPrinter.cpp
  clang/lib/AST/StmtProfile.cpp
  clang/lib/Analysis/CFG.cpp
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaExceptionSpec.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  clang/test/Index/openmp-tile.c
  clang/test/OpenMP/tile_ast_print.cpp
  clang/test/OpenMP/tile_codegen.cpp
  clang/test/OpenMP/tile_messages.cpp
  clang/tools/libclang/CIndex.cpp
  clang/tools/libclang/CXCursor.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Analysis/DependenceGraphBuilder.cpp



More information about the cfe-commits mailing list