summaryrefslogtreecommitdiff
path: root/flang/test/Parser/OpenMP
AgeCommit message (Collapse)Author
2025-11-22[flang][OpenMP] Canonicalize loops with intervening OpenMP constructs (#169191)Krzysztof Parzyszek
Example based on the gfortran test a.6.1.f90 ``` do 100 i = 1,10 !$omp do do 100 j = 1,10 call work(i,j) 100 continue ``` During canonicalization of label-DO loops, if the body of an OpenMP construct ends with a label, treat the label as ending the construct itself. This will also allow handling of cases like ``` do 100 i = 1, 10 !$omp atomic write 100 x = i ``` which we were unable to before.
2025-11-22[flang][OpenMP] Implement loop nest parser (#168884)Krzysztof Parzyszek
Previously, loop constructs were parsed in a piece-wise manner: the begin directive, the body, and the end directive were parsed separately. Later on in canonicalization they were all coalesced into a loop construct. To facilitate that end-loop directives were given a special treatment, namely they were parsed as OpenMP constructs. As a result syntax errors caused by misplaced end-loop directives were handled differently from those cause by misplaced non-loop end directives. The new loop nest parser constructs the complete loop construct, removing the need for the canonicalization step. Additionally, it is the basis for parsing loop-sequence-associated constructs in the future. It also removes the need for the special treatment of end-loop directives. While this patch temporarily degrades the error messaging for misplaced end-loop directives, it enables uniform handling of any misplaced end-directives in the future.
2025-11-21[Flang][OpenMP] Add semantic support for Loop Sequences and OpenMP loop fuse ↵Ferran Toda
(#161213) This patch adds semantics for the `omp fuse` directive in flang, as specified in OpenMP 6.0. This patch also enables semantic support for loop sequences which are needed for the fuse directive along with semantics for the `looprange` clause. These changes are only semantic. Relevant tests have been added , and previous behavior is retained with no changes. --------- Co-authored-by: Ferran Toda <ferran.todacasaban@bsc.es> Co-authored-by: Krzysztof Parzyszek <Krzysztof.Parzyszek@amd.com>
2025-11-17[OpenMP][Flang] Change the OmpDefaultMapperName suffix (#168399)Akash Banerjee
This PR fixes a Fortran syntax violation in the OpenMP default mapper naming convention. The suffix .omp.default.mapper contains dots which are invalid in Fortran identifiers, causing failures when mappers are written to and read from module files. The fix changes the suffix to _omp_default_mapper which uses underscores instead of dots, complying with Fortran syntax rules. Key changes: - Changed OmpDefaultMapperName constant from .omp.default.mapper to _omp_default_mapper - Added GetUltimate() calls in mapper symbol resolution to properly handle symbols across module boundaries - Added new test case verifying default mappers work correctly when defined in a module and used in consuming programs This fixes #168336.
2025-11-17[Flang] [OpenMP] Add support for spaces in between the name (#168311)Thirumalai Shaktivel
Supports the fixed form syntax which has spaces in between the identifier
2025-11-17[flang][OpenMP] Store Block in OpenMPLoopConstruct, add access functions ↵Krzysztof Parzyszek
(#168078) Instead of storing a variant with specific types, store parser::Block as the body. Add two access functions to make the traversal of the nest simpler. This will allow storing loop-nest sequences in the future.
2025-11-13[Flang][OpenMP] Update declare mapper lookup via use-module (#167903)Akash Banerjee
2025-11-13Revert "[Flang][OpenMP] Update declare mapper lookup via use-module" (#167896)Akash Banerjee
Reverts llvm/llvm-project#163860
2025-11-13[Flang][OpenMP] Update declare mapper lookup via use-module (#163860)Akash Banerjee
- Implemented semantic TODO to catch undeclared mappers. - Fix mapper lookup to include modules imported through USE. - Update and add tests. Fixes #163385.
2025-11-11[flang][OpenMP] Replace modifiers in DYN_GROUPPRIVATE clause (#166199)Krzysztof Parzyszek
The "prescriptiveness" modifier has been replaced with "fallback-modifier". The "fallback" value has been removed from the "prescriptiveness" modifier.
2025-11-04[Flang] Nested directives are comments (#166348)Michael Kruse
Directives cannot be nested. A directive sentinel that appears within another directive should be ignored, and instead fall back to be treated as a line comment. Fixes: #165874
2025-11-03[flang][OpenMP] Use OmpDirectiveSpecification in ALLOCATE (#165865)Krzysztof Parzyszek
The ALLOCATE directive has two forms: - A declarative form with a standalone directive: ``` !$OMP ALLOCATE (variable-list-item...) ``` - An executable form that consists of several directives followed by an ALLOCATE statement: ``` !$OMP ALLOCATE (variable-list-item...) !$OMP ALLOCATE (variable-list-item...) ... ALLOCATE (...) ``` The second form was deprecated in OpenMP 5.2 in favor of the ALLOCATORS construct. Since in the parse tree every type corresponding to a directive only corresponds to a single directive, the executable form is represented by a sequence of nested OmpAllocateDirectives, e.g. ``` !$OMP ALLOCATE(x) !$OMP ALLOCATE(y) ALLOCATE(x, y) ``` will become ``` OmpAllocateDirective |- ALLOCATE(x) // begin directive `- OmpAllocateDirective // block |- ALLOCATE(y) // begin directive `- ALLOCATE(x, y) // block ``` With this change all AST nodes for directives use OmpDirectiveSpecification as the directive representation.
2025-11-03[flang][OpenMP] Reorganize ALLOCATE-related semantic checks (#165719)Krzysztof Parzyszek
For ALLOCATORS and executable ALLOCATE first perform list item checks in the context of an individual ALLOCATE clause or directive respectively, then perform "global" checks, e.g. whether all list items are present on the ALLOCATE statement. These changes allowed to simplify the checks for presence on ALLOCATE statement and the use of a predefined allocator. Additionally, allow variable list item lists to be empty, add a test for the related spec restriction. This is a first step towards unifying OpenMPDeclarativeAllocate and OpenMPExecutableAllocate into a single directive.
2025-10-28[flang][OpenMP] Implement OpenMP stylized expressions (#165049)Krzysztof Parzyszek
Consider OpenMP stylized expression to be a template to be instantiated with a series of types listed on the containing directive (currently DECLARE_REDUCTION). Create a series of instantiations in the parser, allowing OpenMP special variables to be declared separately for each type. --------- Co-authored-by: Tom Eccles <tom.eccles@arm.com>
2025-10-23[flang][OpenMP] Rename some AST classes to follow spec naming, NFC (#164870)Krzysztof Parzyszek
Rename OmpTypeSpecifier to OmpTypeName, since it represents a type-name list item. Also, OpenMP 6.0 introduced type-specifier with a different meaning. Rename OmpReductionCombiner to OmpCombinerExpression.
2025-10-20[flang][OpenMP] Frontend support for DEVICE_SAFESYNC (#163560)Krzysztof Parzyszek
Add parsing and semantic checks for DEVICE_SAFESYNC clause. No lowering.
2025-10-16[flang][OpenMP] Reuse semantic check for "constantness" of alignment (#163624)Krzysztof Parzyszek
Use ScalarIntConstantExpr in the parse tree instead of ScalarIntExpr. This will still parse a general expression, but the semantic checker for expressions will automatically perfom a test for whether the value is constant or not. Use that instead of manual checks, it will make diagnostics more uniform. There is no functional change other than that.
2025-10-16[flang][OpenMP] Add optional argument to requirement clauses (#163557)Krzysztof Parzyszek
OpenMP 6.0 added an optional logical parameter to the requirement clauses (except ATOMIC_DEFAULT_MEM_ORDER) to indicate whether the clause should take effect or not. The parameter defaults to true if not specified. The parameter value is a compile-time constant expression, but it may require folding to get the final value. Since name resolution happens before folding, the argument expression needs to be analyzed by hand. The determination of the value needs to happen during name resolution because the requirement directives need to be available through module files (and the module reader doesn't to semantic checks beyond name resolution).
2025-10-16[flang][OpenMP] Frontend support for ATTACH modifier (#163608)Krzysztof Parzyszek
Add parsing, semantic checks, but no lowering.
2025-10-03[Flang] Add standalone tile support (#160298)Michael Kruse
Add support for the standalone OpenMP tile construct: ```f90 !$omp tile sizes(...) DO i = 1, 100 ... ``` This is complementary to #143715 which added support for the tile construct as part of another loop-associated construct such as worksharing-loop, distribute, etc.
2025-09-27[flang][OpenMP] Use OmpDirectiveSpecification in REQUIRES (#160595)Krzysztof Parzyszek
2025-09-27[flang][OpenMP] Use OmpDirectiveSpecification in ASSUMES (#160591)Krzysztof Parzyszek
2025-09-26[flang][OpenMP] Use OmpDirectiveSpecification in DECLARE_TARGET (#160573)Krzysztof Parzyszek
2025-09-25[flang][OpenMP] Use OmpDirectiveSpecification in DECLARE_SIMD (#160390)Krzysztof Parzyszek
2025-09-25[flang][OpenMP] Use OmpDirectiveSpecification in DECLARE_VARIANT (#160371)Krzysztof Parzyszek
2025-09-23[flang][OpenMP] Avoid extra newline when unparsing OmpReductionCombiner ↵Krzysztof Parzyszek
(#160200) When the combiner contains an AssignmentStmt, the unparser for that will emit a newline after the assignment. Don't let it do that, unparse the assignment ourselves.
2025-09-23[flang][OpenMP] Use OmpDirectiveSpecification in DECLARE_REDUCTION (#160192)Krzysztof Parzyszek
2025-09-23[flang][OpenMP] Use OmpDirectiveSpecification in DECLARE_MAPPER (#160169)Krzysztof Parzyszek
2025-09-22[flang][OpenMP] Semantic checks for TASKGRAPH (#160115)Krzysztof Parzyszek
This verifies the "structural" restrictions on constructs encountered in a TASKGRAPH construct. There are also restrictions that apply to list items, specifically in the following contexts: - a list item on a clause on a replayable construct, - data-sharing attributes for a variable on a replayable construct. These restrictions are not verified, because that would require knowing which clauses (on a potential compound directive) apply to the task- generating construct of interest. This information is not available during semantic checks.
2025-09-22[flang][OpenMP] Use OmpDirectiveSpecification in METADIRECTIVE (#159577)Krzysztof Parzyszek
2025-09-22[flang][OpenMP] Use OmpDirectiveSpecification in THREADPRIVATE (#159632)Krzysztof Parzyszek
Since ODS doesn't store a list of OmpObjects (i.e. not as OmpObjectList), some semantics-checking functions needed to be updated to operate on a single object at a time.
2025-09-22[flang][OpenMP] Reject blank common blocks more gracefully (#159626)Krzysztof Parzyszek
Parse them as "invalid" OmpObjects, then emit a diagnostic in semantic checks.
2025-09-19[flang][OpenMP] Use OmpDirectiveSpecification in SECTIONS (#159580)Krzysztof Parzyszek
2025-09-16[flang][OpenMP] Use OmpDirectiveSpecification in Omp[Begin|End]LoopDi… ↵Krzysztof Parzyszek
(#159087) …rective This makes accessing directive components, such as directive name or the list of clauses simpler and more uniform across different directives. It also makes the parser simpler, since it reuses existing parsing functionality. The changes are scattered over a number of files, but they all share the same nature: - getting the begin/end directive from OpenMPLoopConstruct, - getting the llvm::omp::Directive enum, and the source location, - getting the clause list.
2025-09-12[flang][OpenMP] Frontend support for REPLAYABLE and TRANSPARENT clauses ↵Krzysztof Parzyszek
(#158149) Parsing and semantic checks.
2025-09-10[flang][OpenMP] Parse TASKGRAPH, GRAPH_ID, and GRAPH_RESET (#157926)Krzysztof Parzyszek
This is parsing only, no semantic check are performed.
2025-09-10[flang][OpenMP] Fix crash on DECLARE REDUCTION in unparse-with-symbols (#157871)Krzysztof Parzyszek
2025-09-10[flang][OpenMP] Enable tiling (#143715)Jan Leyonberg
This patch enables tiling in flang. In MLIR tiling is handled by changing the the omp.loop_nest op to be able to represent both collapse and tiling, so the flang front-end will combine the nested constructs into a single MLIR op. The MLIR->LLVM-IR lowering of the LoopNestOp is enhanced to first do the tiling if present, then collapse.
2025-09-04[flang][OpenMP] Parse ORDERED as standalone when DEPEND/DOACROSS is p… ↵Krzysztof Parzyszek
(#156693) …resent The OpenMP spec 4.5-5.1 defines ORDERED as standalone when a DEPEND clause is present (with either SOURCE or SINK as argument). The OpenMP spec 5.2+ defines ORDERED as standalone when a DOACROSS clause is present.
2025-08-29[flang][OpenMP] Replace OpenMPBlockConstruct with OmpBlockConstruct (#155872)Krzysztof Parzyszek
OpenMPBlockConstruct, somewhat confusingly, represents most but not all block-associated constructs. It's derived from OmpBlockConstruct, as are all the remaining block-associated constructs. It does not correspond to any well-defined group of constructs. It's the collection of constructs that don't have their own types (and those that do have their own types do so for their own reasons). Using the broader OmpBlockConstruct in type-based visitors won't cause issues, because the specific overloads (for classes derived from it) will always be preferred.
2025-08-27[flang][OpenMP] Fix parsing of ASSUME directive (#155257)Krzysztof Parzyszek
The ASSUME directive is block-associated and whether the end-directive is optional or not depends on the form of the block. This is all taken care of automatically since the AST node for ASSUME inherits from OmpBlockConstruct.
2025-08-26[flang][OpenMP] move omp end directive validation to semantics (#154739)Tom Eccles
The old parse tree errors quckly exploded to thousands of unhelpful lines when there were multiple missing end directives (e.g. #90452). Instead I've added a flag to the parse tree indicating when a missing end directive needs to be diagnosed, and moved the error messages to semantics (where they are a lot easier to control). This has the disadvantage of not displaying the error if there were other parse errors, but there is a precedent for this approach (e.g. parsing atomic constructs).
2025-08-25[flang][openmp] Add parser and semantic support for workdistribute (#154377)Chaitanya
This PR adds workdistribute parser and semantic support in flang. The work in this PR is c-p and updated from @ivanradanov commits from coexecute implementation: flang_workdistribute_iwomp_2024
2025-08-19[flang][OpenMP] Parse GROUPPRIVATE directive (#153807)Krzysztof Parzyszek
No semantic checks or lowering yet.
2025-08-18[flang][OpenMP] Parsing support for DYN_GROUPPRIVATE (#153615)Krzysztof Parzyszek
This does not perform semantic checks or lowering.
2025-08-07[flang][OpenMP] Make OpenMPCriticalConstruct follow block structure (#152007)Krzysztof Parzyszek
This allows not having the END CRITICAL directive in certain situations. Update semantic checks and symbol resolution.
2025-08-05[flang][OpenMP] Fix crash in unparse-with-symbols for CRITICAL (#151962)Krzysztof Parzyszek
2025-08-01[flang][OpenMP] Make all block constructs share the same structure (#150956)Krzysztof Parzyszek
The structure is - OmpBeginDirective (aka OmpDirectiveSpecification) - Block - optional<OmpEndDirective> (aka optional<OmpDirectiveSpecification>) The OmpBeginDirective and OmpEndDirective are effectively different names for OmpDirectiveSpecification. They exist to allow the semantic analyses to distinguish between the beginning and the ending of a block construct without maintaining additional context. The actual changes are in the parser: parse-tree.h and openmp-parser.cpp in particular. The rest is simply changing the way the directive/clause information is accessed (typically for the simpler). All standalone and block constructs now use OmpDirectiveSpecification to store the directive/clause information.
2025-07-31Fix build error from #151511.Akash Banerjee
2025-07-31[Flang] Add parser support for AUTOMAP modifier (#151511)Akash Banerjee
Add parser support for the new AUTOMAP modifier for OpenMP Declare Target Enter clause introduced in OpenMP 6.0 section 7.9.7.