Skip to content

[Constraint graph] Restrict connected components to requested type variables #26369

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

DougGregor
Copy link
Member

The API of the connected-components algorithm asks clients to
provide the set of type variables of interest. However, the connected
components algorithm itself was operating across the entire set of
type variables, then narrowing the result down to the type variables
of interest. Instead, only perform connected components on those type
variables of interest, so that we are only doing work proportional to
the subgraph we're working in.

…riables.

The API of the connected-components algorithm asks clients to
provide the set of type variables of interest. However, the connected
components algorithm itself was operating across the entire set of
type variables, then narrowing the result down to the type variables
of interest. Instead, only perform connected components on those type
variables of interest, so that we are only doing work proportional to
the subgraph we're working in.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please test compiler performance

@DougGregor
Copy link
Member Author

In local testing, this took validation-test/Sema/type_checker_perf/fast/rdar29358447.swift.gyb from 69s down to 16s.

@DougGregor
Copy link
Member Author

Well, that was unexpected. Looks like more debugging to do.

Address a silly mistake that meant we were miscomputing connected
components.
…iables.

Simplify the connected-components computation slightly and make sure
that it never performs work outside of the subgraph described by the
input set of type variables.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please test compiler performance

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci please test compiler performance

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@swift-ci
Copy link
Contributor

Summary for master full

Unexpected test results, excluded stats for RxCocoa, Deferred, Wordy

Regressions found (see below)

Debug-batch

debug-batch 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 43,294,590,179,658 43,057,805,175,310 -236,785,004,348 -0.55%
LLVM.NumLLVMBytesOutput 1,755,817,924 1,755,813,822 -4,102 -0.0%
time.swift-driver.wall 4361.0s 4358.3s -2.8s -0.06%

debug-batch detailed

Regressed (2)
name old new delta delta_pct
Driver.NumDriverPipePolls 79,434 80,662 1,228 1.55% ⛔
Driver.NumDriverPipeReads 73,632 75,202 1,570 2.13% ⛔
Improved (3)
name old new delta delta_pct
Sema.CollectOverriddenDeclsRequest 6,415,492 6,340,248 -75,244 -1.17% ✅
Sema.ProvideDefaultImplForRequest 6,415,492 6,340,248 -75,244 -1.17% ✅
Sema.USRGenerationRequest 7,586,798 7,507,985 -78,813 -1.04% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (127)
name old new delta delta_pct
AST.NumASTBytesAllocated 63,926,856,229 63,711,308,159 -215,548,070 -0.34%
AST.NumDecls 138,061 138,061 0 0.0%
AST.NumDependencies 314,377 314,374 -3 -0.0%
AST.NumInfixOperators 53,208 53,208 0 0.0%
AST.NumLinkLibraries 0 0 0 0.0%
AST.NumLoadedModules 389,794 389,794 0 0.0%
AST.NumLocalTypeDecls 246 246 0 0.0%
AST.NumObjCMethods 24,686 24,686 0 0.0%
AST.NumPostfixOperators 23 23 0 0.0%
AST.NumPrecedenceGroups 25,153 25,153 0 0.0%
AST.NumPrefixOperators 164 164 0 0.0%
AST.NumReferencedDynamicNames 189 189 0 0.0%
AST.NumReferencedMemberNames 6,312,736 6,312,736 0 0.0%
AST.NumReferencedTopLevelNames 467,699 467,699 0 0.0%
AST.NumSourceBuffers 552,727 552,727 0 0.0%
AST.NumSourceLines 4,663,328 4,663,328 0 0.0%
AST.NumSourceLinesPerSecond 3,585,338 3,608,273 22,935 0.64%
AST.NumTotalClangImportedEntities 6,698,286 6,688,840 -9,446 -0.14%
Driver.ChildrenMaxRSS 212,724,668,416 211,916,240,896 -808,427,520 -0.38%
Driver.DriverDepCascadingDynamic 0 0 0 0.0%
Driver.DriverDepCascadingExternal 0 0 0 0.0%
Driver.DriverDepCascadingMember 0 0 0 0.0%
Driver.DriverDepCascadingNominal 0 0 0 0.0%
Driver.DriverDepCascadingTopLevel 0 0 0 0.0%
Driver.DriverDepDynamic 0 0 0 0.0%
Driver.DriverDepExternal 0 0 0 0.0%
Driver.DriverDepMember 0 0 0 0.0%
Driver.DriverDepNominal 0 0 0 0.0%
Driver.DriverDepTopLevel 0 0 0 0.0%
Driver.NumDriverJobsRun 26,758 26,758 0 0.0%
Driver.NumDriverJobsSkipped 0 0 0 0.0%
Driver.NumProcessFailures 0 0 0 0.0%
Frontend.MaxMallocUsage 1,261,534,801,864 1,259,150,962,720 -2,383,839,144 -0.19%
Frontend.NumInstructionsExecuted 43,294,590,179,658 43,057,805,175,310 -236,785,004,348 -0.55%
Frontend.NumProcessFailures 0 0 0 0.0%
IRModule.NumIRAliases 194,005 194,005 0 0.0%
IRModule.NumIRBasicBlocks 7,014,187 7,014,187 0 0.0%
IRModule.NumIRComdatSymbols 0 0 0 0.0%
IRModule.NumIRFunctions 3,278,776 3,278,776 0 0.0%
IRModule.NumIRGlobals 3,358,590 3,358,590 0 0.0%
IRModule.NumIRIFuncs 0 0 0 0.0%
IRModule.NumIRInsts 85,574,577 85,574,577 0 0.0%
IRModule.NumIRNamedMetaData 129,435 129,435 0 0.0%
IRModule.NumIRValueSymbols 5,997,660 5,997,660 0 0.0%
LLVM.NumLLVMBytesOutput 1,755,817,924 1,755,813,822 -4,102 -0.0%
Parse.NumFunctionsParsed 264,509 264,509 0 0.0%
Parse.NumIterableDeclContextParsed 1,808,927 1,808,927 0 0.0%
SILModule.NumSILGenDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILGenFunctions 1,697,277 1,697,277 0 0.0%
SILModule.NumSILGenGlobalVariables 62,988 62,988 0 0.0%
SILModule.NumSILGenVtables 17,421 17,421 0 0.0%
SILModule.NumSILGenWitnessTables 71,193 71,193 0 0.0%
SILModule.NumSILOptDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILOptFunctions 2,383,949 2,383,949 0 0.0%
SILModule.NumSILOptGlobalVariables 64,608 64,608 0 0.0%
SILModule.NumSILOptVtables 29,738 29,738 0 0.0%
SILModule.NumSILOptWitnessTables 156,149 156,149 0 0.0%
Sema.AccessLevelRequest 10,743,473 10,657,102 -86,371 -0.8%
Sema.AttachedFunctionBuilderRequest 4 4 0 0.0%
Sema.AttachedPropertyWrapperTypeRequest 510,712 510,712 0 0.0%
Sema.AttachedPropertyWrappersRequest 2,417,251 2,417,251 0 0.0%
Sema.CursorInfoRequest 0 0 0 0.0%
Sema.CustomAttrNominalRequest 14 14 0 0.0%
Sema.DefaultAndMaxAccessLevelRequest 95,562 95,550 -12 -0.01%
Sema.DefaultDefinitionTypeRequest 8,076 8,076 0 0.0%
Sema.DefaultTypeRequest 501,908 501,908 0 0.0%
Sema.EnumRawTypeRequest 25,284 25,284 0 0.0%
Sema.ExistentialConformsToSelfRequest 22,710 22,717 7 0.03%
Sema.ExistentialTypeSupportedRequest 17,169 17,169 0 0.0%
Sema.ExtendedNominalRequest 5,285,401 5,275,198 -10,203 -0.19%
Sema.FunctionBuilderTypeRequest 4 4 0 0.0%
Sema.InheritedDeclsReferencedRequest 6,109,683 6,085,230 -24,453 -0.4%
Sema.InheritedTypeRequest 333,452 333,547 95 0.03%
Sema.IsDeclApplicableRequest 0 0 0 0.0%
Sema.IsDynamicRequest 1,691,901 1,691,901 0 0.0%
Sema.IsFinalRequest 4,420,405 4,413,962 -6,443 -0.15%
Sema.IsGetterMutatingRequest 498,577 498,577 0 0.0%
Sema.IsObjCRequest 1,666,666 1,666,205 -461 -0.03%
Sema.IsSetterMutatingRequest 378,879 378,879 0 0.0%
Sema.LazyStoragePropertyRequest 3,205 3,205 0 0.0%
Sema.MangleLocalTypeDeclRequest 492 492 0 0.0%
Sema.NamedLazyMemberLoadFailureCount 34,720 34,658 -62 -0.18%
Sema.NamedLazyMemberLoadSuccessCount 31,388,870 31,375,522 -13,348 -0.04%
Sema.NominalTypeLookupDirectCount 37,548,752 37,509,221 -39,531 -0.11%
Sema.NumAccessorBodiesSynthesized 186,104 186,104 0 0.0%
Sema.NumAccessorsSynthesized 403,144 403,144 0 0.0%
Sema.NumConformancesDeserialized 9,245,607 9,208,690 -36,917 -0.4%
Sema.NumConstraintScopes 24,894,395 24,891,184 -3,211 -0.01%
Sema.NumConstraintsConsideredForEdgeContraction 74,860,319 74,859,317 -1,002 -0.0%
Sema.NumDeclsDeserialized 70,928,588 70,644,510 -284,078 -0.4%
Sema.NumDeclsFinalized 717,993 717,993 0 0.0%
Sema.NumDeclsTypechecked 1,390,991 1,390,991 0 0.0%
Sema.NumDeclsValidated 2,776,134 2,776,086 -48 -0.0%
Sema.NumFunctionsTypechecked 519,306 519,306 0 0.0%
Sema.NumGenericSignatureBuilders 1,447,866 1,445,677 -2,189 -0.15%
Sema.NumLazyGenericEnvironments 12,821,200 12,782,102 -39,098 -0.3%
Sema.NumLazyGenericEnvironmentsLoaded 312,751 312,857 106 0.03%
Sema.NumLazyIterableDeclContexts 9,453,475 9,437,263 -16,212 -0.17%
Sema.NumLazyRequirementSignatures 998,477 997,956 -521 -0.05%
Sema.NumLazyRequirementSignaturesLoaded 646,492 645,967 -525 -0.08%
Sema.NumLeafScopes 16,093,770 16,090,933 -2,837 -0.02%
Sema.NumTypesDeserialized 21,345,087 21,298,288 -46,799 -0.22%
Sema.NumTypesValidated 2,421,306 2,421,235 -71 -0.0%
Sema.NumUnloadedLazyIterableDeclContexts 6,254,201 6,252,304 -1,897 -0.03%
Sema.OpaqueReadOwnershipRequest 531,878 531,878 0 0.0%
Sema.OverriddenDeclsRequest 2,352,399 2,345,622 -6,777 -0.29%
Sema.PropertyWrapperBackingPropertyInfoRequest 505,408 505,408 0 0.0%
Sema.PropertyWrapperBackingPropertyTypeRequest 510,712 510,712 0 0.0%
Sema.PropertyWrapperTypeInfoRequest 4 4 0 0.0%
Sema.ProtocolRequiresClassRequest 92,602 92,706 104 0.11%
Sema.RangeInfoRequest 0 0 0 0.0%
Sema.RequirementRequest 109,445 109,442 -3 -0.0%
Sema.RequirementSignatureRequest 748,973 748,530 -443 -0.06%
Sema.ResolveProtocolNameRequest 0 0 0 0.0%
Sema.SelfAccessKindRequest 6,640,047 6,630,300 -9,747 -0.15%
Sema.SelfBoundsFromWhereClauseRequest 7,830,840 7,796,943 -33,897 -0.43%
Sema.SetterAccessLevelRequest 149,277 149,277 0 0.0%
Sema.StorageImplInfoRequest 932,490 932,490 0 0.0%
Sema.StoredPropertiesAndMissingMembersRequest 31,962 31,962 0 0.0%
Sema.StoredPropertiesRequest 399,620 399,620 0 0.0%
Sema.StructuralTypeRequest 0 0 0 0.0%
Sema.SuperclassDeclRequest 499,073 498,858 -215 -0.04%
Sema.SuperclassTypeRequest 62,030 62,030 0 0.0%
Sema.TypeCheckFunctionBodyUntilRequest 519,306 519,306 0 0.0%
Sema.TypeDeclsFromWhereClauseRequest 50,119 50,107 -12 -0.02%
Sema.TypeRelationCheckRequest 0 0 0 0.0%
Sema.UnderlyingTypeDeclsReferencedRequest 274,766 274,356 -410 -0.15%

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 46,380,367,994,004 46,263,630,726,993 -116,737,267,011 -0.25%
LLVM.NumLLVMBytesOutput 1,549,388,116 1,549,394,516 6,400 0.0%
time.swift-driver.wall 7979.8s 7983.4s 3.6s 0.04%

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) (21)
name old new delta delta_pct
AST.NumLoadedModules 27,679 27,679 0 0.0%
AST.NumTotalClangImportedEntities 1,235,106 1,235,106 0 0.0%
IRModule.NumIRBasicBlocks 6,367,333 6,367,333 0 0.0%
IRModule.NumIRFunctions 2,800,642 2,800,642 0 0.0%
IRModule.NumIRGlobals 2,975,004 2,975,004 0 0.0%
IRModule.NumIRInsts 55,881,106 55,881,106 0 0.0%
IRModule.NumIRValueSymbols 5,428,489 5,428,489 0 0.0%
LLVM.NumLLVMBytesOutput 1,549,388,116 1,549,394,516 6,400 0.0%
SILModule.NumSILGenFunctions 1,188,843 1,188,843 0 0.0%
SILModule.NumSILOptFunctions 1,593,141 1,593,141 0 0.0%
Sema.NumConformancesDeserialized 3,674,960 3,674,960 0 0.0%
Sema.NumConstraintScopes 24,451,614 24,451,614 0 0.0%
Sema.NumDeclsDeserialized 9,770,225 9,770,225 0 0.0%
Sema.NumDeclsValidated 1,834,429 1,834,429 0 0.0%
Sema.NumFunctionsTypechecked 523,120 523,120 0 0.0%
Sema.NumGenericSignatureBuilders 285,653 285,653 0 0.0%
Sema.NumLazyGenericEnvironments 1,893,526 1,893,526 0 0.0%
Sema.NumLazyGenericEnvironmentsLoaded 34,557 34,557 0 0.0%
Sema.NumLazyIterableDeclContexts 1,214,438 1,214,438 0 0.0%
Sema.NumTypesDeserialized 5,050,738 5,050,738 0 0.0%
Sema.NumTypesValidated 1,117,659 1,117,659 0 0.0%

@DougGregor DougGregor merged commit 7758857 into swiftlang:master Jul 27, 2019
@DougGregor DougGregor deleted the constraint-graph-connected-components-subgraph branch July 27, 2019 23:47
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.

2 participants