-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CSBindings] Try Void
as a binding for closure result
type variable
#15134
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
Conversation
@swift-ci please test |
@swift-ci please test source compatibility |
/cc @slavapestov since we have |
Build failed |
Build failed |
@swift-ci please test macOS platform |
Looks like Linux is still broken :( |
@slavapestov I just wanted to run source compatibility first to make sure that I didn't break anything :) I'll add couple more tests to SILGen. |
/cc @rudkx please take a look, I can't figure out safer fix for this... (I've reverted changes to |
@swift-ci please test Linux platform |
If we could find a binding for type variable representing closure result let's also add implicit `Void` type as another pontential binding to attempt because there is an implicit conversion from `() -> T` to `() -> Void` so finding `Void` early is going to help avoid function conversions down the line. Resolves: rdar://problem/37790062
Rebased the changes to |
@swift-ci please test |
@swift-ci please test source compatibility |
@swift-ci please test Linux platform |
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.
LGTM, thank you!
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.
Otherwise LGTM.
|
||
if (auto *locator = typeVar->getImpl().getLocator()) { | ||
auto path = locator->getPath(); | ||
auto voidType = TupleType::getEmpty(getASTContext()); |
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.
ASTContext
has TheEmptyTupleType
for this (and it's already a CanType
).
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.
Included the fix to #15187
This change broke Swift on Fedora Linux 27 (built with clang+llvm ToT). The following validation tests hang:
|
Backtraces (albeit Release+Assert): |
Well look at that. "Hang" turns out to be relative. The test suite takes 10x longer on my box after this pull request. Regardless, this seems like a massive performance regression. |
@davezarzycki Are you sure that it's this change? It's only related to closure result type variable handling, in couple of narrow cases. |
@davezarzycki It doesn't seem like ci.swift.org reports that behavior change in build tests before and after this PR went it, all of the incremental builds take ~1 hour. |
I just reverified that this PR is the source of the regression. Pull #15172 was merged before this PR, and that doesn't have the performance regression, therefore this PR is the source of the problem. I'm not surprised the build bots mask the problem. They're slow. My Linux box can do a clean build and run validation suite (sans stress tests) in just a few minutes. Therefore this performance regression is quite obvious. :-/ |
Do you have any examples of expressions which became slower? 10x performance regression is not something which should leave CI times unchanged (theoretically that is). |
How do I extract the slow expressions from the tests that are slower? The test suite performance is a great example of Amdahl's Law. With just a few cores, having one test become 10x longer is hard to notice, but with many cores, one test getting longer is quite noticeable. |
Are you only talking about two tests you have mentioned? If so, they are pretty expreme cases of auto-generated code I am surprised that they don’t result in “expression to complex” to be honest. Don’t see a reason to revert this just based on such failures. |
Yes, just the two two tests. They run for almost exactly ten minutes each then exit after this PR. Here is some
|
Thanks! I will re-adjust the tests in the separate PR then. |
It's weird that on Linux it's so much slower - I just ran one of the tests locally and it only took |
Ya, I observed that at first too. Once I copied the exact process arguments from the output of |
It seems that the interaction of this pull request and |
@davezarzycki I just ran it using |
Weird. I don't personally care about the performance of |
I think it's okay if we remove |
10 and 20 seconds respectively, as I just wrote. |
Ah sorry I misread that, how about with |
They both seem to time out precisely after 10 minutes. |
That's probably because 'not' and/or test harness itself assumes success if it these two tests haven't crashed in 10 minutes. :-/ |
I just extracted the command line for the first test you mentioned and try to run it with and without Anyway, I'll modify these tests to limit type-checker runtime to 1 second which is good anyway. |
I'm running Release-Assert, if it matters. |
If we could find a binding for type variable representing closure result
let's also add implicit
Void
type as another pontential binding to attemptbecause there is an implicit conversion from
() -> T
to() -> Void
so finding
Void
early is going to help avoid function conversions downthe line.
Resolves: rdar://problem/37790062