Skip to content

[CSBindings] Detect situations when type variable bindings could be i… #20205

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
merged 1 commit into from
Nov 2, 2018

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Nov 1, 2018

…ncomplete

When bind param constraint is associated with a given type
variable a set of bindings collected for it is potentially
incomplete, because binding gathering doesn't look through related
type variables. Which means that such type variable has to be
de-prioritized until bind param constraint is resolved
or there is just nothing else to try, otherwise there is a
risk that solver would skip some of the valid solutions.

Resolves: rdar://problem/45659733

@xedin xedin requested a review from slavapestov November 1, 2018 00:44
@xedin
Copy link
Contributor Author

xedin commented Nov 1, 2018

/cc @rudkx

@xedin
Copy link
Contributor Author

xedin commented Nov 1, 2018

In the future we'd be better off merging fully bound and other flags with this "incomplete" flag.

@xedin
Copy link
Contributor Author

xedin commented Nov 1, 2018

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Nov 1, 2018

@swift-ci please test source compatibility

@swiftlang swiftlang deleted a comment from swift-ci Nov 1, 2018
@swiftlang swiftlang deleted a comment from swift-ci Nov 1, 2018
@xedin xedin requested a review from DougGregor November 1, 2018 00:56
…ncomplete

When `bind param` constraint is associated with a given type
variable a set of bindings collected for it is potentially
incomplete, because binding gathering doesn't look through related
type variables. Which means that such type variable has to be
de-prioritized until `bind param` constraint is resolved
or there is just nothing else to try, otherwise there is a
risk that solver would skip some of the valid solutions.

Resolves: rdar://problem/45659733
@xedin
Copy link
Contributor Author

xedin commented Nov 1, 2018

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Nov 1, 2018

@swift-ci please test source compatibility

@swiftlang swiftlang deleted a comment from swift-ci Nov 1, 2018
@swiftlang swiftlang deleted a comment from swift-ci Nov 1, 2018
@xedin
Copy link
Contributor Author

xedin commented Nov 1, 2018

@swift-ci please smoke test compiler performance

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented Nov 1, 2018

@swift-ci please smoke test compiler performance


// As a last resort, let's check if the bindings are
// potentially incomplete, and if so, let's de-prioritize them.
return x.PotentiallyIncomplete < y.PotentiallyIncomplete;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's Yet Another ranking step for potential bindings, and I agree with you that this should be merged back with FullyBound (or something like it) at some point. If you need this PR to make progress... okay...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually tried to make it so FullyBound is set when there is a bind param constraint but it breaks ordering even worse (tried a bunch of different combinations), I’m hoping to re-visit fully bound soon. Trying to unblock some code with this PR...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the best possible answer here is to re-work bind param itself, so we don’t get into situations like that, or make some of the choices retry-able

@swift-ci
Copy link
Contributor

swift-ci commented Nov 1, 2018

Build comment file:

Summary for master smoketest

Unexpected test results, excluded stats for Kingfisher, ReactiveCocoa, ReactiveSwift

No regressions above thresholds

Debug

debug brief

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (3)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 80,482,651,641 80,534,212,473 51,560,832 0.06%
LLVM.NumLLVMBytesOutput 2,898,548 2,898,548 0 0.0%
time.swift-driver.wall 11.0s 11.0s 10.7ms 0.1%

debug detailed

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (23)
name old new delta delta_pct
AST.NumImportedExternalDefinitions 3,577 3,577 0 0.0%
AST.NumLoadedModules 654 654 0 0.0%
AST.NumTotalClangImportedEntities 13,508 13,508 0 0.0%
AST.NumUsedConformances 508 508 0 0.0%
IRModule.NumIRBasicBlocks 12,092 12,092 0 0.0%
IRModule.NumIRFunctions 5,240 5,240 0 0.0%
IRModule.NumIRGlobals 4,708 4,708 0 0.0%
IRModule.NumIRInsts 133,974 133,974 0 0.0%
IRModule.NumIRValueSymbols 9,677 9,677 0 0.0%
LLVM.NumLLVMBytesOutput 2,898,548 2,898,548 0 0.0%
SILModule.NumSILGenFunctions 2,482 2,482 0 0.0%
SILModule.NumSILOptFunctions 3,541 3,541 0 0.0%
Sema.NumConformancesDeserialized 8,942 8,942 0 0.0%
Sema.NumConstraintScopes 43,096 43,076 -20 -0.05%
Sema.NumDeclsDeserialized 97,842 97,842 0 0.0%
Sema.NumDeclsValidated 5,358 5,358 0 0.0%
Sema.NumFunctionsTypechecked 3,274 3,274 0 0.0%
Sema.NumGenericSignatureBuilders 2,738 2,738 0 0.0%
Sema.NumLazyGenericEnvironments 20,626 20,626 0 0.0%
Sema.NumLazyGenericEnvironmentsLoaded 432 432 0 0.0%
Sema.NumLazyIterableDeclContexts 18,938 18,938 0 0.0%
Sema.NumTypesDeserialized 39,229 39,229 0 0.0%
Sema.NumTypesValidated 3,385 3,385 0 0.0%

Release

release brief

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (3)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 96,093,480,692 96,059,692,258 -33,788,434 -0.04%
LLVM.NumLLVMBytesOutput 3,076,532 3,076,516 -16 -0.0%
time.swift-driver.wall 18.1s 18.1s -1.4ms -0.01%

release detailed

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (23)
name old new delta delta_pct
AST.NumImportedExternalDefinitions 829 829 0 0.0%
AST.NumLoadedModules 65 65 0 0.0%
AST.NumTotalClangImportedEntities 3,124 3,124 0 0.0%
AST.NumUsedConformances 508 508 0 0.0%
IRModule.NumIRBasicBlocks 13,533 13,533 0 0.0%
IRModule.NumIRFunctions 4,221 4,221 0 0.0%
IRModule.NumIRGlobals 4,218 4,218 0 0.0%
IRModule.NumIRInsts 116,051 116,051 0 0.0%
IRModule.NumIRValueSymbols 8,318 8,318 0 0.0%
LLVM.NumLLVMBytesOutput 3,076,532 3,076,516 -16 -0.0%
SILModule.NumSILGenFunctions 1,959 1,959 0 0.0%
SILModule.NumSILOptFunctions 2,720 2,720 0 0.0%
Sema.NumConformancesDeserialized 5,676 5,676 0 0.0%
Sema.NumConstraintScopes 37,838 37,818 -20 -0.05%
Sema.NumDeclsDeserialized 21,982 21,982 0 0.0%
Sema.NumDeclsValidated 3,000 3,000 0 0.0%
Sema.NumFunctionsTypechecked 1,676 1,676 0 0.0%
Sema.NumGenericSignatureBuilders 632 632 0 0.0%
Sema.NumLazyGenericEnvironments 4,473 4,473 0 0.0%
Sema.NumLazyGenericEnvironmentsLoaded 82 82 0 0.0%
Sema.NumLazyIterableDeclContexts 3,224 3,224 0 0.0%
Sema.NumTypesDeserialized 11,538 11,538 0 0.0%
Sema.NumTypesValidated 1,517 1,517 0 0.0%

@xedin
Copy link
Contributor Author

xedin commented Nov 1, 2018

@swift-ci please smoke test

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented Nov 1, 2018

@swift-ci please smoke test

@xedin
Copy link
Contributor Author

xedin commented Nov 1, 2018

I'll run smoke test one more time before merging, just in case...

@xedin
Copy link
Contributor Author

xedin commented Nov 1, 2018

@swift-ci please smoke test Linux platform

2 similar comments
@xedin
Copy link
Contributor Author

xedin commented Nov 2, 2018

@swift-ci please smoke test Linux platform

@xedin
Copy link
Contributor Author

xedin commented Nov 2, 2018

@swift-ci please smoke test Linux platform

@xedin xedin merged commit a3ce27c into swiftlang:master Nov 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants