-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[Flang][mlir] - Translation of delayed privatization for deferred target-tasks #155348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bhandarkar-pranav
merged 39 commits into
llvm:main
from
bhandarkar-pranav:flang/delayed_priv_def_tgt_tasks_translation
Oct 22, 2025
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
938091d
[Flang][mlir] - Translation of delayed privatization for deferred tar…
bhandarkar-pranav f72152a
Add some comments and clean up some codoe
bhandarkar-pranav c859bbc
Fix CHECK stmts in test to account for constant folding done by the g…
bhandarkar-pranav 697cc4f
Fix clang-format issues
bhandarkar-pranav bc107cd
Checkpoint commit, working with operaiton->walk
bhandarkar-pranav f7dacb3
Address more comments from tblah and meinersbur
bhandarkar-pranav f4a13ea
Handle boxchars
bhandarkar-pranav c8fad74
fix testcases
bhandarkar-pranav e74fa7d
Revert "Fix CHECK stmts in test to account for constant folding done …
bhandarkar-pranav 343f7ec
Fix more testcases
bhandarkar-pranav 41bb5b2
Reset some tests back to their old states
bhandarkar-pranav 3264bfe
Undo empty line removal
bhandarkar-pranav b9fb8ce
Add back some CHECK statements in flang/test/Fir/target.fir and flang…
bhandarkar-pranav 7032cae
use the init region to initialize the heap allocated private variable
bhandarkar-pranav 269c575
use the copy region to copy the private variable into its heap alloca…
bhandarkar-pranav 3109e4f
Fix for boxchars is working
bhandarkar-pranav d5b9c27
Adjust mlir/test/Dialect/LLVMIR/omp-offload-privatization-prepare.mli…
bhandarkar-pranav 8bd4359
Address minor review comments
bhandarkar-pranav a393ff1
Handle the case where varPtr is a blockargument. - Take the varType f…
bhandarkar-pranav 28ec66a
clean up the pass a little bit
bhandarkar-pranav d95799d
Do not include OpenMPOffloadPrivatizationPrepare.h in Pipelines.h. In…
bhandarkar-pranav 0829719
Move PrepareForOMPOffloadPrivatizationPass from Transforms in LLVMIR …
bhandarkar-pranav 01d1f69
Add a lit test for boxchars
bhandarkar-pranav d595572
Make createFuncForRegionAndCallIt take an arrayref as argumen
bhandarkar-pranav bf949fa
clean up
bhandarkar-pranav 72a769f
make clang-format happy
bhandarkar-pranav 061669f
Add some more comments and fix a typo
bhandarkar-pranav e036923
Checkpoint commit - dealloc working - need to fix lit testcase to tes…
bhandarkar-pranav 5b78bab
fix lit testcase for dealloc region generation
bhandarkar-pranav b34b0e0
fix clang-format problems
bhandarkar-pranav 4c5d8d8
Update test for differences between downstream and upstream
bhandarkar-pranav 6288da9
Make changes requested by reviewers - Formatting changes requested by…
bhandarkar-pranav 0a4ef58
Update test (again) for differences between downstream and upstream
bhandarkar-pranav 5a0d5d7
Address reviewers comments - Main change - Converted pass from one op…
bhandarkar-pranav da1279f
Split testcase
bhandarkar-pranav 4a0321f
Remove OpenMPOffloadPrivatizationPrepare.h
bhandarkar-pranav 1a237c0
fix formatting issues
bhandarkar-pranav 13508a9
Do not use exit_release_or_enter_alloc
bhandarkar-pranav 9e0af19
Fix testcase basic-program.fir
bhandarkar-pranav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| set(LLVM_TARGET_DEFINITIONS Passes.td) | ||
| mlir_tablegen(Passes.h.inc -gen-pass-decls -name OpenMP) | ||
| add_public_tablegen_target(MLIROpenMPPassIncGen) | ||
|
|
||
| add_mlir_doc(Passes OpenMPPasses ./ -gen-pass-doc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| //===- Passes.h - OpenMP Pass Construction and Registration -----*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef MLIR_DIALECT_OPENMP_TRANSFORMS_PASSES_H | ||
| #define MLIR_DIALECT_OPENMP_TRANSFORMS_PASSES_H | ||
|
|
||
| #include "mlir/Pass/Pass.h" | ||
|
|
||
| namespace mlir { | ||
|
|
||
| namespace omp { | ||
|
|
||
| /// Generate the code for registering conversion passes. | ||
| #define GEN_PASS_DECL | ||
| #define GEN_PASS_REGISTRATION | ||
| #include "mlir/Dialect/OpenMP/Transforms/Passes.h.inc" | ||
|
|
||
| } // namespace omp | ||
| } // namespace mlir | ||
|
|
||
| #endif // MLIR_DIALECT_LLVMIR_TRANSFORMS_PASSES_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| //===-- Passes.td - OpenMP pass definition file ------------*- tablegen -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef MLIR_DIALECT_OPENMP_TRANSFORMS_PASSES | ||
| #define MLIR_DIALECT_OPENMP_TRANSFORMS_PASSES | ||
|
|
||
| include "mlir/Pass/PassBase.td" | ||
|
|
||
| def PrepareForOMPOffloadPrivatizationPass : Pass<"omp-offload-privatization-prepare", "ModuleOp"> { | ||
| let summary = "Prepare OpenMP maps for privatization for deferred target tasks"; | ||
| let description = [{ | ||
| When generating LLVMIR for privatized variables in an OpenMP offloading directive (eg. omp::TargetOp) | ||
| that creates a deferred target task (when the nowait clause is used), we need to copy the privatized | ||
| variable out of the stack of the generating task and into the heap so that the deferred target task | ||
| can still access it. However, if such a privatized variable is also mapped, typically the case for | ||
| allocatables, then the corresponding `omp::MapInfoOp` needs to be fixed up to map the new heap-allocated | ||
| variable and not the original variable. | ||
| }]; | ||
| let dependentDialects = ["LLVM::LLVMDialect"]; | ||
| } | ||
| #endif // MLIR_DIALECT_OPENMP_TRANSFORMS_PASSES | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| add_subdirectory(Transforms) | ||
|
|
||
| add_mlir_dialect_library(MLIROpenMPDialect | ||
| IR/OpenMPDialect.cpp | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| add_mlir_dialect_library(MLIROpenMPTransforms | ||
| OpenMPOffloadPrivatizationPrepare.cpp | ||
|
|
||
| DEPENDS | ||
| MLIROpenMPPassIncGen | ||
|
|
||
| LINK_LIBS PUBLIC | ||
| MLIRIR | ||
| MLIRFuncDialect | ||
| MLIRLLVMDialect | ||
| MLIROpenMPDialect | ||
| MLIRPass | ||
| MLIRTransforms | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to add
mlir::omp::OpenMPDialectas well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had added
mlir::omp::OpenMPDialectbut @joker-eph pointed out that was wrong since this pass doesn't create any new OpenMPDialect ops. See this conversation #155348 (comment)