-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[flang][DRAFT-DEV][DO NOT REVIEW] Copy-in/Copy-out determination #151426
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
Draft
eugeneepshteyn
wants to merge
49
commits into
llvm:main
Choose a base branch
from
eugeneepshteyn:copy-inout-dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+250
−5
Conversation
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
Plumbing/API for copy-in/copy-out
You can test this locally with the following command:git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- flang/include/flang/Evaluate/call.h flang/include/flang/Evaluate/characteristics.h flang/include/flang/Evaluate/check-expression.h flang/include/flang/Evaluate/tools.h flang/include/flang/Lower/CallInterface.h flang/lib/Evaluate/call.cpp flang/lib/Evaluate/check-expression.cpp flang/lib/Evaluate/tools.cpp flang/lib/Lower/ConvertCall.cpp flang/lib/Semantics/expression.cpp View the diff from clang-format here.diff --git a/flang/lib/Evaluate/call.cpp b/flang/lib/Evaluate/call.cpp
index e79a314c8..29f2f3d41 100644
--- a/flang/lib/Evaluate/call.cpp
+++ b/flang/lib/Evaluate/call.cpp
@@ -260,8 +260,8 @@ static void DetermineCopyInOutArgument(
// Actual argument expressions that aren’t variables are copy-in, but
// not copy-out.
actual.SetMayNeedCopyIn();
- } else if (bool actualIsArray{actual.Rank() > 0}; actualIsArray &&
- !IsSimplyContiguous(actual, sc.foldingContext())) {
+ } else if (bool actualIsArray{actual.Rank() > 0};
+ actualIsArray && !IsSimplyContiguous(actual, sc.foldingContext())) {
// Actual arguments that are variables are copy-in when non-contiguous.
// They are copy-out when don't have vector subscripts
actual.SetMayNeedCopyIn();
@@ -331,8 +331,7 @@ static void DetermineCopyInOutArgument(
bool dummyIsAssumedSize{dummyObj->type.attrs().test(
characteristics::TypeAndShape::Attr::AssumedSize)};
bool dummyNeedsContiguity{dummyIsExplicitShape || dummyIsAssumedSize ||
- dummyObj->attrs.test(
- characteristics::DummyDataObject::Attr::Contiguous)};
+ dummyObj->attrs.test(characteristics::DummyDataObject::Attr::Contiguous)};
if (!actualTreatAsContiguous && dummyNeedsContiguity) {
setCopyIn();
// Cannot do copy-out for vector subscripts: there could be repeated
diff --git a/flang/lib/Lower/ConvertCall.cpp b/flang/lib/Lower/ConvertCall.cpp
index 610dd6315..1d92a6340 100644
--- a/flang/lib/Lower/ConvertCall.cpp
+++ b/flang/lib/Lower/ConvertCall.cpp
@@ -1257,10 +1257,9 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
// The simple contiguity of the actual is "lost" when passing a polymorphic
// to a non polymorphic entity because the dummy dynamic type matters for
// the contiguity.
- bool mustDoCopyIn =
- actual.isArray() && arg.mustBeMadeContiguous() &&
- (passingPolymorphicToNonPolymorphic ||
- !isSimplyContiguous(*arg.entity, foldingContext));
+ bool mustDoCopyIn = actual.isArray() && arg.mustBeMadeContiguous() &&
+ (passingPolymorphicToNonPolymorphic ||
+ !isSimplyContiguous(*arg.entity, foldingContext));
bool mustDoCopyOut = mustDoCopyIn && arg.mayBeModifiedByCall();
bool newMustDoCopyIn = false;
bool newMustDoCopyOut = false;
@@ -1268,15 +1267,15 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
newMustDoCopyIn = arg.entity->GetMayNeedCopyIn();
newMustDoCopyOut = arg.entity->GetMayNeedCopyOut();
#if 1
- llvm::dbgs() << "copyinout: CALLER " <<
- "copy-in: old=" << mustDoCopyIn << ", new=" << newMustDoCopyIn <<
- "| copy-out: old=" << mustDoCopyOut << ", new=" << newMustDoCopyOut <<
- "\n";
+ llvm::dbgs() << "copyinout: CALLER " << "copy-in: old=" << mustDoCopyIn
+ << ", new=" << newMustDoCopyIn
+ << "| copy-out: old=" << mustDoCopyOut
+ << ", new=" << newMustDoCopyOut << "\n";
#endif
} else {
#if 1
- llvm::dbgs() << "copyinout: CALLEE " <<
- "copy-in=" << mustDoCopyIn << ", copy-out=" << mustDoCopyOut << "\n";
+ llvm::dbgs() << "copyinout: CALLEE " << "copy-in=" << mustDoCopyIn
+ << ", copy-out=" << mustDoCopyOut << "\n";
#endif
}
mustDoCopyIn = newMustDoCopyIn;
|
interfaces. Certain helper routines gained overloads to work with ActualArgument.
…icitShape(const Shape&)
…ring, have LIT test failures
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When creating ProcedureRef, determine copy-in/copy-out needs
DEVELOPMENT PR NOT FOR REVIEW.