Skip to content

Automatic conversion of mutable pointers to immutable pointers. #37214

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

Closed
wants to merge 9 commits into from

Conversation

johnno1962
Copy link
Contributor

@johnno1962 johnno1962 commented May 3, 2021

Hi Apple,

These minor changes add automatic conversions from UnsafeMutableRawPointer to UnsafeRawPointer and from an UnsafeMutablePointer to an UnsafePointer where the generic parameter matches (but not vice versa). This is something I feel is missing from Swift as imports from C can be rather haphazard about mutability of pointers resulting in explicit casts and pointer conversions being required passing arguments and in pointer comparisons.

The first thing to check for whether it slows type checking which shouldn't be the case as the code is injected at the point where the type checker has done most of it's work and is looking for "fix-ups". Could someone run the standard benchmarks for me please?

I imagine this will require evolution and I'll prepare a proposal in due course after pitching to see if anyone can cite a reason why mutable pointers shouldn't be freely convertible to their immutable counterparts.

Resolves https://bugs.swift.org/browse/SR-14511.

@johnno1962
Copy link
Contributor Author

@beccadax, could you run the compiler benchmarks on this patch for me please?

@harlanhaskins
Copy link
Contributor

@swift-ci please smoke test
@swift-ci please benchmark

@harlanhaskins
Copy link
Contributor

@swift-ci please test compiler performance

@swift-ci
Copy link
Contributor

swift-ci commented May 7, 2021

Performance: -O

Improvement OLD NEW DELTA RATIO
UTF8Decode_InitFromData_ascii 299 273 -8.7% 1.10x (?)
UTF8Decode_InitFromBytes_ascii_as_ascii 512 471 -8.0% 1.09x (?)

Code size: -O

Performance: -Osize

Improvement OLD NEW DELTA RATIO
NSError 358 243 -32.1% 1.47x (?)

Code size: -Osize

Performance: -Onone

Code size: -swiftlibs

How to read the data The tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.

If you see any unexpected regressions, you should consider fixing the
regressions before you merge the PR.

Noise: Sometimes the performance results (not code size!) contain false
alarms. Unexpected regressions which are marked with '(?)' are probably noise.
If you see regressions which you cannot explain you can try to run the
benchmarks again. If regressions still show up, please consult with the
performance team (@eeckstein).

Hardware Overview
  Model Name: Mac Pro
  Model Identifier: MacPro6,1
  Processor Name: 12-Core Intel Xeon E5
  Processor Speed: 2.7 GHz
  Number of Processors: 1
  Total Number of Cores: 12
  L2 Cache (per Core): 256 KB
  L3 Cache: 30 MB
  Memory: 64 GB

@swift-ci
Copy link
Contributor

swift-ci commented May 7, 2021

Summary for main full

Regressions found (see below)

Debug-batch

debug-batch brief

Regressed (2)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 18,366,203,948,260 42,791,739,437,800 24,425,535,489,540 132.99% ⛔
LLVM.NumLLVMBytesOutput 820,779,308 1,642,227,988 821,448,680 100.08% ⛔
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (0)
name old new delta delta_pct

debug-batch detailed

Regressed (215)
name old new delta delta_pct
AST.ImportSetCacheHit 956,974 1,844,248 887,274 92.72% ⛔
AST.ImportSetCacheMiss 162,939 356,019 193,080 118.5% ⛔
AST.ImportSetFoldHit 62,186 116,288 54,102 87.0% ⛔
AST.ImportSetFoldMiss 100,753 239,731 138,978 137.94% ⛔
AST.ModuleShadowCacheHit 1,491 3,627 2,136 143.26% ⛔
AST.ModuleShadowCacheMiss 589 1,610 1,021 173.34% ⛔
AST.ModuleVisibilityCacheHit 22,282 51,165 28,883 129.62% ⛔
AST.ModuleVisibilityCacheMiss 3,240 7,038 3,798 117.22% ⛔
AST.NumASTBytesAllocated 16,790,424,450 40,633,621,561 23,843,197,111 142.0% ⛔
AST.NumASTScopeExpansions 2,554,852 5,110,628 2,555,776 100.04% ⛔
AST.NumASTScopeLookups 2,648,083 5,322,916 2,674,833 101.01% ⛔
AST.NumDecls 62,242 131,534 69,292 111.33% ⛔
AST.NumDependencies 155,442 301,582 146,140 94.02% ⛔
AST.NumIncrementalDependencies 5,054 11,658 6,604 130.67% ⛔
AST.NumLoadedModules 96,124 228,914 132,790 138.14% ⛔
AST.NumLocalTypeDecls 173 248 75 43.35% ⛔
AST.NumModuleLookupClassMember 3,437 6,793 3,356 97.64% ⛔
AST.NumModuleLookupValue 29,954,206 52,136,711 22,182,505 74.05% ⛔
AST.NumObjCMethods 23,444 26,928 3,484 14.86% ⛔
AST.NumOperators 353 581 228 64.59% ⛔
AST.NumPrecedenceGroups 57 93 36 63.16% ⛔
AST.NumReferencedDynamicNames 75 155 80 106.67% ⛔
AST.NumReferencedMemberNames 5,648,050 10,098,475 4,450,425 78.8% ⛔
AST.NumReferencedTopLevelNames 532,239 1,014,991 482,752 90.7% ⛔
AST.NumSourceBuffers 140,384 283,614 143,230 102.03% ⛔
AST.NumSourceLines 2,254,566 4,438,789 2,184,223 96.88% ⛔
AST.NumSourceLinesPerSecond 1,778,106 4,190,465 2,412,359 135.67% ⛔
AST.NumTotalClangImportedEntities 1,735,337 3,355,773 1,620,436 93.38% ⛔
Frontend.MaxMallocUsage 279,758,085,736 687,225,005,088 407,466,919,352 145.65% ⛔
Frontend.NumInstructionsExecuted 18,366,203,948,260 42,791,739,437,800 24,425,535,489,540 132.99% ⛔
Frontend.NumProcessFailures 20 21 1 5.0% ⛔
IRGen.IRGenRequest 11,895 23,664 11,769 98.94% ⛔
IRModule.NumGOTEntries 96,180 216,349 120,169 124.94% ⛔
IRModule.NumIRAliases 102,590 184,853 82,263 80.19% ⛔
IRModule.NumIRBasicBlocks 3,112,888 6,924,969 3,812,081 122.46% ⛔
IRModule.NumIRFunctions 1,580,275 3,233,966 1,653,691 104.65% ⛔
IRModule.NumIRGlobals 1,695,058 3,259,612 1,564,554 92.3% ⛔
IRModule.NumIRInsts 35,287,806 72,738,783 37,450,977 106.13% ⛔
IRModule.NumIRNamedMetaData 61,620 120,505 58,885 95.56% ⛔
IRModule.NumIRValueSymbols 3,050,410 6,045,417 2,995,007 98.18% ⛔
LLVM.NumLLVMBytesOutput 820,779,308 1,642,227,988 821,448,680 100.08% ⛔
Parse.NumFunctionsParsed 124,913 259,397 134,484 107.66% ⛔
Parse.NumIterableDeclContextParsed 232,682 498,735 266,053 114.34% ⛔
Parse.ParseAbstractFunctionBodyRequest 112,035 239,029 126,994 113.35% ⛔
Parse.ParseMembersRequest 357,681 752,408 394,727 110.36% ⛔
Parse.ParseSourceFileRequest 135,321 270,116 134,795 99.61% ⛔
SILGen.ASTLoweringRequest 12,467 24,809 12,342 99.0% ⛔
SILModule.NumSILGenFunctions 983,764 2,057,349 1,073,585 109.13% ⛔
SILModule.NumSILGenGlobalVariables 21,261 54,948 33,687 158.45% ⛔
SILModule.NumSILGenVtables 12,010 25,558 13,548 112.81% ⛔
SILModule.NumSILGenWitnessTables 64,869 128,237 63,368 97.69% ⛔
SILModule.NumSILOptFunctions 1,182,040 2,525,210 1,343,170 113.63% ⛔
SILModule.NumSILOptGlobalVariables 22,102 56,572 34,470 155.96% ⛔
SILModule.NumSILOptVtables 12,038 25,654 13,616 113.11% ⛔
SILModule.NumSILOptWitnessTables 82,122 170,163 88,041 107.21% ⛔
SILOptimizer.ExecuteSILPipelineRequest 48,173 95,846 47,673 98.96% ⛔
Sema.ABIMembersRequest 42,694 91,276 48,582 113.79% ⛔
Sema.AbstractGenericSignatureRequest 14,249 31,851 17,602 123.53% ⛔
Sema.AccessLevelRequest 4,101,258 12,661,293 8,560,035 208.72% ⛔
Sema.ActorIsolationRequest 1,221,130 2,553,593 1,332,463 109.12% ⛔
Sema.AllMembersRequest 76,017 166,187 90,170 118.62% ⛔
Sema.AnyObjectLookupRequest 107 224 117 109.35% ⛔
Sema.ApplyAccessNoteRequest 926,802 1,919,515 992,713 107.11% ⛔
Sema.AreAllStoredPropertiesDefaultInitableRequest 8,879 19,089 10,210 114.99% ⛔
Sema.AttachedPropertyWrapperTypeRequest 3,966 10,342 6,376 160.77% ⛔
Sema.AttachedPropertyWrappersRequest 57,829,077 120,023,589 62,194,512 107.55% ⛔
Sema.AttachedResultBuilderRequest 317,414 656,585 339,171 106.85% ⛔
Sema.BodyInitKindRequest 21,781 44,828 23,047 105.81% ⛔
Sema.CallerSideDefaultArgExprRequest 45,536 102,971 57,435 126.13% ⛔
Sema.CheckInconsistentImplementationOnlyImportsRequest 3,051 7,298 4,247 139.2% ⛔
Sema.CheckRedeclarationRequest 433,708 903,447 469,739 108.31% ⛔
Sema.ClassAncestryFlagsRequest 50,842 92,425 41,583 81.79% ⛔
Sema.ClosureHasExplicitResultRequest 36,948 84,432 47,484 128.52% ⛔
Sema.CollectOverriddenDeclsRequest 2,155,362 7,605,534 5,450,172 252.87% ⛔
Sema.CompareDeclSpecializationRequest 222,493 462,949 240,456 108.07% ⛔
Sema.ConditionalRequirementsRequest 192,752 441,758 249,006 129.18% ⛔
Sema.CustomAttrNominalRequest 1,234 1,908 674 54.62% ⛔
Sema.CustomAttrTypeRequest 478 876 398 83.26% ⛔
Sema.DefaultAndMaxAccessLevelRequest 24,954 53,426 28,472 114.1% ⛔
Sema.DefaultArgumentExprRequest 19,576 36,500 16,924 86.45% ⛔
Sema.DefaultArgumentInitContextRequest 153 276 123 80.39% ⛔
Sema.DefaultDefinitionTypeRequest 2,775 6,149 3,374 121.59% ⛔
Sema.DefaultTypeRequest 113,152 246,521 133,369 117.87% ⛔
Sema.DerivativeAttrOriginalDeclRequest 0 8 8 100.0% ⛔
Sema.DirectLookupRequest 19,803,439 35,636,074 15,832,635 79.95% ⛔
Sema.DirectOperatorLookupRequest 658,243 1,276,235 617,992 93.89% ⛔
Sema.DirectPrecedenceGroupLookupRequest 355,328 610,375 255,047 71.78% ⛔
Sema.DynamicallyReplacedDeclRequest 467,483 1,008,644 541,161 115.76% ⛔
Sema.EnumRawTypeRequest 10,711 23,048 12,337 115.18% ⛔
Sema.EnumRawValuesRequest 5,507 10,714 5,207 94.55% ⛔
Sema.ExistentialConformsToSelfRequest 7,481 16,207 8,726 116.64% ⛔
Sema.ExistentialTypeSupportedRequest 8,050 14,840 6,790 84.35% ⛔
Sema.ExtendedNominalRequest 225,079 467,515 242,436 107.71% ⛔
Sema.ExtendedTypeRequest 33,059 70,264 37,205 112.54% ⛔
Sema.FragileFunctionKindRequest 665,285 1,411,679 746,394 112.19% ⛔
Sema.FunctionOperatorRequest 5,566 9,591 4,025 72.31% ⛔
Sema.GenericParamListRequest 1,966,548 4,288,094 2,321,546 118.05% ⛔
Sema.GenericSignatureRequest 1,196,133 2,431,786 1,235,653 103.3% ⛔
Sema.GetDestructorRequest 11,657 22,447 10,790 92.56% ⛔
Sema.GetImplicitSendableRequest 68,782 193,891 125,109 181.89% ⛔
Sema.GlobalActorAttributeRequest 1,451,350 3,071,152 1,619,802 111.61% ⛔
Sema.GlobalActorInstanceRequest 98 182 84 85.71% ⛔
Sema.HasCircularInheritedProtocolsRequest 5,054 9,517 4,463 88.31% ⛔
Sema.HasCircularRawValueRequest 3,766 8,818 5,052 134.15% ⛔
Sema.HasDefaultInitRequest 21,807 47,727 25,920 118.86% ⛔
Sema.HasDynamicMemberLookupAttributeRequest 233,949 502,286 268,337 114.7% ⛔
Sema.HasImplementationOnlyImportsRequest 134,769 267,631 132,862 98.58% ⛔
Sema.HasMemberwiseInitRequest 8,448 20,399 11,951 141.47% ⛔
Sema.HasMissingDesignatedInitializersRequest 9,688 20,704 11,016 113.71% ⛔
Sema.HasUserDefinedDesignatedInitRequest 21,819 47,739 25,920 118.8% ⛔
Sema.InferredGenericSignatureRequest 84,683 147,060 62,377 73.66% ⛔
Sema.InheritedDeclsReferencedRequest 2,498,160 5,502,997 3,004,837 120.28% ⛔
Sema.InheritedProtocolsRequest 222,146 487,988 265,842 119.67% ⛔
Sema.InheritedTypeRequest 132,398 243,720 111,322 84.08% ⛔
Sema.InheritsSuperclassInitializersRequest 13,629 24,206 10,577 77.61% ⛔
Sema.InitKindRequest 42,657 85,372 42,715 100.14% ⛔
Sema.InterfaceTypeRequest 5,114,693 13,223,666 8,108,973 158.54% ⛔
Sema.IsABICompatibleOverrideRequest 61,084 125,042 63,958 104.7% ⛔
Sema.IsAccessorTransparentRequest 151,932 302,001 150,069 98.77% ⛔
Sema.IsActorRequest 392,846 819,172 426,326 108.52% ⛔
Sema.IsAsyncHandlerRequest 640,323 1,349,689 709,366 110.78% ⛔
Sema.IsCallableNominalTypeRequest 959 2,218 1,259 131.28% ⛔
Sema.IsDeclRefinementOfRequest 15,923 33,338 17,415 109.37% ⛔
Sema.IsDefaultActorRequest 17,878 36,935 19,057 106.59% ⛔
Sema.IsDynamicRequest 778,030 1,621,693 843,663 108.44% ⛔
Sema.IsFinalRequest 1,103,311 2,468,298 1,364,987 123.72% ⛔
Sema.IsGetterMutatingRequest 206,308 400,106 193,798 93.94% ⛔
Sema.IsImplicitlyUnwrappedOptionalRequest 1,137,781 2,290,746 1,152,965 101.33% ⛔
Sema.IsObjCRequest 701,060 1,435,174 734,114 104.71% ⛔
Sema.IsSetterMutatingRequest 156,884 323,200 166,316 106.01% ⛔
Sema.IsStaticRequest 1,066,586 1,929,700 863,114 80.92% ⛔
Sema.LazyStoragePropertyRequest 2,681 2,795 114 4.25% ⛔
Sema.LookupAllConformancesInContextRequest 508,892 1,591,655 1,082,763 212.77% ⛔
Sema.LookupConformanceInModuleRequest 15,493,501 35,556,282 20,062,781 129.49% ⛔
Sema.LookupInModuleRequest 2,886,678 6,049,765 3,163,087 109.58% ⛔
Sema.LookupInfixOperatorRequest 22,713 49,990 27,277 120.09% ⛔
Sema.LookupPostfixOperatorRequest 29 38 9 31.03% ⛔
Sema.LookupPrecedenceGroupRequest 12,443 24,183 11,740 94.35% ⛔
Sema.LookupPrefixOperatorRequest 53 130 77 145.28% ⛔
Sema.MangleLocalTypeDeclRequest 346 496 150 43.35% ⛔
Sema.ModuleImplicitImportsRequest 3,616 8,429 4,813 133.1% ⛔
Sema.ModuleQualifiedLookupRequest 1,243,342 2,845,336 1,601,994 128.85% ⛔
Sema.NamedLazyMemberLoadSuccessCount 10,730,212 19,482,983 8,752,771 81.57% ⛔
Sema.NamingPatternRequest 102,548 208,030 105,482 102.86% ⛔
Sema.NeedsNewVTableEntryRequest 344,481 655,074 310,593 90.16% ⛔
Sema.NumAccessorBodiesSynthesized 88,743 185,134 96,391 108.62% ⛔
Sema.NumAccessorsSynthesized 151,082 282,373 131,291 86.9% ⛔
Sema.NumConformancesDeserialized 3,055,305 8,601,704 5,546,399 181.53% ⛔
Sema.NumConstraintScopes 7,888,460 15,880,666 7,992,206 101.32% ⛔
Sema.NumConstraintsConsideredForEdgeContraction 167,000 943,702 776,702 465.09% ⛔
Sema.NumCyclicOneWayComponentsCollapsed 174 260 86 49.43% ⛔
Sema.NumDeclsDeserialized 25,173,223 67,233,282 42,060,059 167.08% ⛔
Sema.NumDeclsTypechecked 622,901 1,297,480 674,579 108.3% ⛔
Sema.NumGenericSignatureBuilders 455,909 1,054,925 599,016 131.39% ⛔
Sema.NumLazyIterableDeclContexts 3,216,595 7,752,053 4,535,458 141.0% ⛔
Sema.NumLazyRequirementSignatures 294,516 705,398 410,882 139.51% ⛔
Sema.NumLazyRequirementSignaturesLoaded 213,812 506,044 292,232 136.68% ⛔
Sema.NumLeafScopes 5,672,138 11,168,802 5,496,664 96.91% ⛔
Sema.NumTypesDeserialized 8,080,295 20,433,692 12,353,397 152.88% ⛔
Sema.NumUnloadedLazyIterableDeclContexts 2,065,863 4,621,927 2,556,064 123.73% ⛔
Sema.OpaqueReadOwnershipRequest 139,745 260,611 120,866 86.49% ⛔
Sema.OpaqueResultTypeRequest 234 336 102 43.59% ⛔
Sema.OperatorPrecedenceGroupRequest 418 681 263 62.92% ⛔
Sema.OverriddenDeclsRequest 1,316,214 2,994,311 1,678,097 127.49% ⛔
Sema.ParamSpecifierRequest 592,094 1,150,707 558,613 94.35% ⛔
Sema.PatternBindingEntryRequest 206,642 432,471 225,829 109.29% ⛔
Sema.PatternTypeRequest 248,573 509,268 260,695 104.88% ⛔
Sema.PolymorphicEffectKindRequest 48,998 103,300 54,302 110.82% ⛔
Sema.PreCheckResultBuilderRequest 536 761 225 41.98% ⛔
Sema.PrimarySourceFilesRequest 3,616 8,429 4,813 133.1% ⛔
Sema.PropertyWrapperAuxiliaryVariablesRequest 232,344 494,336 261,992 112.76% ⛔
Sema.PropertyWrapperBackingPropertyTypeRequest 3,966 10,342 6,376 160.77% ⛔
Sema.PropertyWrapperInitializerInfoRequest 153,801 321,616 167,815 109.11% ⛔
Sema.PropertyWrapperLValuenessRequest 389 631 242 62.21% ⛔
Sema.PropertyWrapperMutabilityRequest 283,580 563,829 280,249 98.83% ⛔
Sema.PropertyWrapperTypeInfoRequest 91 193 102 112.09% ⛔
Sema.ProtocolRequiresClassRequest 19,633 34,295 14,662 74.68% ⛔
Sema.ProvideDefaultImplForRequest 2,155,362 7,605,534 5,450,172 252.87% ⛔
Sema.QualifiedLookupRequest 2,912,725 5,824,654 2,911,929 99.97% ⛔
Sema.RequirementRequest 33,348 86,301 52,953 158.79% ⛔
Sema.RequirementSignatureRequest 245,431 561,289 315,858 128.7% ⛔
Sema.RequiresOpaqueAccessorsRequest 607,457 1,213,282 605,825 99.73% ⛔
Sema.RequiresOpaqueModifyCoroutineRequest 125,751 245,170 119,419 94.96% ⛔
Sema.ResolveImplicitMemberRequest 203,523 438,916 235,393 115.66% ⛔
Sema.ResolveTypeRequest 1,601,400 3,021,161 1,419,761 88.66% ⛔
Sema.ResultBuilderTypeRequest 161,714 335,628 173,914 107.54% ⛔
Sema.ResultTypeRequest 307,327 608,801 301,474 98.1% ⛔
Sema.SPIGroupsRequest 2,405,569 5,435,843 3,030,274 125.97% ⛔
Sema.ScopedImportLookupRequest 42 746 704 1676.19% ⛔
Sema.SelfAccessKindRequest 383,332 695,880 312,548 81.53% ⛔
Sema.SelfBoundsFromWhereClauseRequest 838,151 1,523,044 684,893 81.71% ⛔
Sema.SetterAccessLevelRequest 77,663 148,923 71,260 91.76% ⛔
Sema.SimpleDidSetRequest 740,915 2,101,967 1,361,052 183.7% ⛔
Sema.SpecializeAttrTargetDeclRequest 812 2,964 2,152 265.02% ⛔
Sema.StorageImplInfoRequest 673,467 1,380,138 706,671 104.93% ⛔
Sema.StoredPropertiesAndMissingMembersRequest 24,803 54,126 29,323 118.22% ⛔
Sema.StoredPropertiesRequest 130,327 296,407 166,080 127.43% ⛔
Sema.StructuralTypeRequest 460 1,405 945 205.43% ⛔
Sema.SuperclassDeclRequest 165,322 372,121 206,799 125.09% ⛔
Sema.SuperclassTypeRequest 21,911 44,547 22,636 103.31% ⛔
Sema.SynthesizeAccessorRequest 151,082 282,373 131,291 86.9% ⛔
Sema.SynthesizeDefaultInitRequest 2,658 4,944 2,286 86.0% ⛔
Sema.SynthesizeMainFunctionRequest 41,814 89,708 47,894 114.54% ⛔
Sema.SynthesizeMemberwiseInitRequest 1,287 3,490 2,203 171.17% ⛔
Sema.TypeCheckFunctionBodyRequest 234,396 490,521 256,125 109.27% ⛔
Sema.TypeCheckSourceFileRequest 12,355 24,141 11,786 95.39% ⛔
Sema.TypeDeclsFromWhereClauseRequest 12,335 25,460 13,125 106.4% ⛔
Sema.TypeWitnessRequest 3,404 7,379 3,975 116.77% ⛔
Sema.USRGenerationRequest 2,707,259 8,908,811 6,201,552 229.07% ⛔
Sema.UnderlyingTypeDeclsReferencedRequest 171,358 300,255 128,897 75.22% ⛔
Sema.UnderlyingTypeRequest 12,386 30,718 18,332 148.01% ⛔
Sema.UnqualifiedLookupRequest 1,973,370 3,864,177 1,890,807 95.82% ⛔
Sema.ValidatePrecedenceGroupRequest 90,926 174,082 83,156 91.45% ⛔
Sema.ValueWitnessRequest 41,372 65,503 24,131 58.33% ⛔
TBDGen.PublicSymbolsRequest 11,902 23,679 11,777 98.95% ⛔
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (35)
name old new delta delta_pct
AST.NumLinkLibraries 0 0 0 0.0%
IRGen.OptimizedIRRequest 0 0 0 0.0%
IRGen.SymbolObjectCodeRequest 0 0 0 0.0%
IRModule.NumIRComdatSymbols 0 0 0 0.0%
IRModule.NumIRIFuncs 0 0 0 0.0%
Parse.CodeCompletionSecondPassRequest 0 0 0 0.0%
SILGen.ParseSILModuleRequest 0 0 0 0.0%
SILModule.NumSILGenDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILOptDefaultWitnessTables 0 0 0 0.0%
SILOptimizer.LoweredSILRequest 0 0 0 0.0%
Sema.AsyncAlternativeRequest 0 0 0 0.0%
Sema.CanBeAsyncHandlerRequest 0 0 0 0.0%
Sema.CodeCompletionFileRequest 0 0 0 0.0%
Sema.ConformanceHasEffectRequest 0 0 0 0.0%
Sema.CursorInfoRequest 0 0 0 0.0%
Sema.DifferentiableAttributeTypeCheckRequest 0 0 0 0.0%
Sema.HasDynamicCallableAttributeRequest 0 0 0 0.0%
Sema.IsDeclApplicableRequest 0 0 0 0.0%
Sema.ModuleLibraryLevelRequest 0 0 0 0.0%
Sema.NumCrossImportsChecked 0 0 0 0.0%
Sema.NumCrossImportsFound 0 0 0 0.0%
Sema.PolymorphicEffectRequirementsRequest 0 0 0 0.0%
Sema.RangeInfoRequest 0 0 0 0.0%
Sema.ResolveEffectiveMemberwiseInitRequest 0 0 0 0.0%
Sema.ResolveProtocolNameRequest 0 0 0 0.0%
Sema.ResolveTypeEraserTypeRequest 0 0 0 0.0%
Sema.RootAndResultTypeOfKeypathDynamicMemberRequest 0 0 0 0.0%
Sema.RootTypeOfKeypathDynamicMemberRequest 0 0 0 0.0%
Sema.TangentStoredPropertyRequest 0 0 0 0.0%
Sema.TypeCheckASTNodeAtLocRequest 0 0 0 0.0%
Sema.TypeEraserHasViableInitRequest 0 0 0 0.0%
Sema.TypeRelationCheckRequest 0 0 0 0.0%
TBDGen.APIGenRequest 0 0 0 0.0%
TBDGen.GenerateTBDRequest 0 0 0 0.0%
TBDGen.SymbolSourceMapRequest 0 0 0 0.0%

Release

release brief

Regressed (2)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 46,926,532,756,111 71,155,052,243,962 24,228,519,487,851 51.63% ⛔
LLVM.NumLLVMBytesOutput 1,663,948,284 2,490,994,372 827,046,088 49.7% ⛔
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (0)
name old new delta delta_pct

release detailed

Regressed (208)
name old new delta delta_pct
AST.ImportSetCacheHit 1,194,983 1,797,420 602,437 50.41% ⛔
AST.ImportSetCacheMiss 55,683 83,713 28,030 50.34% ⛔
AST.ImportSetFoldHit 24,139 35,015 10,876 45.06% ⛔
AST.ImportSetFoldMiss 31,543 48,698 17,155 54.39% ⛔
AST.ModuleShadowCacheHit 2,935 4,762 1,827 62.25% ⛔
AST.ModuleShadowCacheMiss 1,102 1,818 716 64.97% ⛔
AST.ModuleVisibilityCacheHit 34,896 53,775 18,879 54.1% ⛔
AST.ModuleVisibilityCacheMiss 3,491 4,933 1,442 41.31% ⛔
AST.NumASTBytesAllocated 8,948,386,406 13,753,977,374 4,805,590,968 53.7% ⛔
AST.NumASTScopeExpansions 2,694,434 4,108,600 1,414,166 52.48% ⛔
AST.NumASTScopeLookups 3,913,461 5,971,483 2,058,022 52.59% ⛔
AST.NumDecls 133,165 203,507 70,342 52.82% ⛔
AST.NumDependencies 58,464 78,264 19,800 33.87% ⛔
AST.NumLoadedModules 27,135 41,571 14,436 53.2% ⛔
AST.NumLocalTypeDecls 248 323 75 30.24% ⛔
AST.NumModuleLookupClassMember 6,569 9,809 3,240 49.32% ⛔
AST.NumModuleLookupValue 28,115,093 40,330,980 12,215,887 43.45% ⛔
AST.NumObjCMethods 26,795 30,144 3,349 12.5% ⛔
AST.NumOperators 581 810 229 39.41% ⛔
AST.NumPrecedenceGroups 93 130 37 39.78% ⛔
AST.NumSourceBuffers 29,509 44,722 15,213 51.55% ⛔
AST.NumSourceLines 4,504,337 6,712,294 2,207,957 49.02% ⛔
AST.NumSourceLinesPerSecond 492,948 764,846 271,898 55.16% ⛔
AST.NumTotalClangImportedEntities 439,340 645,286 205,946 46.88% ⛔
Frontend.MaxMallocUsage 221,670,638,224 342,148,831,496 120,478,193,272 54.35% ⛔
Frontend.NumInstructionsExecuted 46,926,532,756,111 71,155,052,243,962 24,228,519,487,851 51.63% ⛔
Frontend.NumProcessFailures 2 3 1 50.0% ⛔
IRModule.NumGOTEntries 208,122 325,925 117,803 56.6% ⛔
IRModule.NumIRAliases 151,893 212,587 60,694 39.96% ⛔
IRModule.NumIRBasicBlocks 4,369,363 6,651,500 2,282,137 52.23% ⛔
IRModule.NumIRFunctions 2,605,184 3,899,836 1,294,652 49.7% ⛔
IRModule.NumIRGlobals 2,961,861 4,364,386 1,402,525 47.35% ⛔
IRModule.NumIRInsts 42,578,081 64,296,346 21,718,265 51.01% ⛔
IRModule.NumIRNamedMetaData 121,995 182,095 60,100 49.26% ⛔
IRModule.NumIRValueSymbols 5,329,293 7,902,673 2,573,380 48.29% ⛔
LLVM.NumLLVMBytesOutput 1,663,948,284 2,490,994,372 827,046,088 49.7% ⛔
Parse.NumFunctionsParsed 262,916 399,085 136,169 51.79% ⛔
Parse.NumIterableDeclContextParsed 87,971 136,271 48,300 54.9% ⛔
Parse.ParseAbstractFunctionBodyRequest 239,306 368,160 128,854 53.84% ⛔
Parse.ParseMembersRequest 576 754 178 30.9% ⛔
Parse.ParseSourceFileRequest 24,518 36,591 12,073 49.24% ⛔
SILGen.ASTLoweringRequest 1,166 1,745 579 49.66% ⛔
SILModule.NumSILGenFunctions 1,136,187 1,732,040 595,853 52.44% ⛔
SILModule.NumSILGenGlobalVariables 54,932 88,541 33,609 61.18% ⛔
SILModule.NumSILGenVtables 15,142 23,890 8,748 57.77% ⛔
SILModule.NumSILGenWitnessTables 66,840 101,294 34,454 51.55% ⛔
SILModule.NumSILOptFunctions 953,939 1,443,733 489,794 51.34% ⛔
SILModule.NumSILOptGlobalVariables 41,474 65,151 23,677 57.09% ⛔
SILModule.NumSILOptVtables 18,563 29,229 10,666 57.46% ⛔
SILModule.NumSILOptWitnessTables 68,386 103,687 35,301 51.62% ⛔
SILOptimizer.ExecuteSILPipelineRequest 4,652 6,968 2,316 49.79% ⛔
Sema.ABIMembersRequest 85,685 132,356 46,671 54.47% ⛔
Sema.AbstractGenericSignatureRequest 23,163 37,826 14,663 63.3% ⛔
Sema.AccessLevelRequest 1,471,008 2,242,002 770,994 52.41% ⛔
Sema.ActorIsolationRequest 1,223,588 1,870,483 646,895 52.87% ⛔
Sema.AllMembersRequest 84,710 130,992 46,282 54.64% ⛔
Sema.AnyObjectLookupRequest 224 341 117 52.23% ⛔
Sema.ApplyAccessNoteRequest 1,514,030 2,304,582 790,552 52.22% ⛔
Sema.AreAllStoredPropertiesDefaultInitableRequest 12,395 19,459 7,064 56.99% ⛔
Sema.AttachedPropertyWrapperTypeRequest 6,678 10,483 3,805 56.98% ⛔
Sema.AttachedPropertyWrappersRequest 98,586,170 146,552,096 47,965,926 48.65% ⛔
Sema.AttachedResultBuilderRequest 637,349 967,025 329,676 51.73% ⛔
Sema.BodyInitKindRequest 43,622 66,558 22,936 52.58% ⛔
Sema.CallerSideDefaultArgExprRequest 102,962 160,304 57,342 55.69% ⛔
Sema.CheckInconsistentImplementationOnlyImportsRequest 1,164 1,744 580 49.83% ⛔
Sema.CheckRedeclarationRequest 917,055 1,396,426 479,371 52.27% ⛔
Sema.ClassAncestryFlagsRequest 42,170 64,963 22,793 54.05% ⛔
Sema.ClosureHasExplicitResultRequest 84,247 131,281 47,034 55.83% ⛔
Sema.CompareDeclSpecializationRequest 370,123 549,508 179,385 48.47% ⛔
Sema.ConditionalRequirementsRequest 167,818 258,683 90,865 54.14% ⛔
Sema.CustomAttrNominalRequest 544 781 237 43.57% ⛔
Sema.CustomAttrTypeRequest 405 591 186 45.93% ⛔
Sema.DefaultAndMaxAccessLevelRequest 38,204 58,973 20,769 54.36% ⛔
Sema.DefaultArgumentExprRequest 36,739 53,856 17,117 46.59% ⛔
Sema.DefaultArgumentInitContextRequest 109 142 33 30.28% ⛔
Sema.DefaultDefinitionTypeRequest 2,726 4,212 1,486 54.51% ⛔
Sema.DefaultTypeRequest 237,895 366,917 129,022 54.23% ⛔
Sema.DerivativeAttrOriginalDeclRequest 4 8 4 100.0% ⛔
Sema.DirectLookupRequest 30,908,235 44,956,313 14,048,078 45.45% ⛔
Sema.DirectOperatorLookupRequest 1,143,682 1,691,914 548,232 47.94% ⛔
Sema.DirectPrecedenceGroupLookupRequest 571,861 811,921 240,060 41.98% ⛔
Sema.DynamicallyReplacedDeclRequest 744,000 1,143,908 399,908 53.75% ⛔
Sema.EnumRawTypeRequest 8,871 13,952 5,081 57.28% ⛔
Sema.EnumRawValuesRequest 9,626 14,654 5,028 52.23% ⛔
Sema.ExistentialConformsToSelfRequest 4,457 7,026 2,569 57.64% ⛔
Sema.ExistentialTypeSupportedRequest 7,700 11,321 3,621 47.03% ⛔
Sema.ExtendedNominalRequest 41,930 64,019 22,089 52.68% ⛔
Sema.ExtendedTypeRequest 41,870 63,938 22,068 52.71% ⛔
Sema.FragileFunctionKindRequest 942,738 1,443,442 500,704 53.11% ⛔
Sema.FunctionOperatorRequest 8,956 12,585 3,629 40.52% ⛔
Sema.GenericParamListRequest 1,124,615 1,714,516 589,901 52.45% ⛔
Sema.GenericSignatureRequest 956,759 1,449,830 493,071 51.54% ⛔
Sema.GetDestructorRequest 16,266 24,844 8,578 52.74% ⛔
Sema.GetImplicitSendableRequest 37,226 58,317 21,091 56.66% ⛔
Sema.GlobalActorAttributeRequest 1,462,625 2,242,123 779,498 53.29% ⛔
Sema.GlobalActorInstanceRequest 56 93 37 66.07% ⛔
Sema.HasCircularInheritedProtocolsRequest 7,946 11,718 3,772 47.47% ⛔
Sema.HasCircularRawValueRequest 8,870 13,951 5,081 57.28% ⛔
Sema.HasDefaultInitRequest 27,171 42,903 15,732 57.9% ⛔
Sema.HasDynamicMemberLookupAttributeRequest 230,366 354,731 124,365 53.99% ⛔
Sema.HasImplementationOnlyImportsRequest 24,424 36,416 11,992 49.1% ⛔
Sema.HasMemberwiseInitRequest 11,958 18,936 6,978 58.35% ⛔
Sema.HasMissingDesignatedInitializersRequest 16,537 25,828 9,291 56.18% ⛔
Sema.HasUserDefinedDesignatedInitRequest 27,171 42,903 15,732 57.9% ⛔
Sema.InferredGenericSignatureRequest 62,276 94,196 31,920 51.26% ⛔
Sema.InheritedDeclsReferencedRequest 1,029,601 1,545,224 515,623 50.08% ⛔
Sema.InheritedProtocolsRequest 90,229 137,347 47,118 52.22% ⛔
Sema.InheritedTypeRequest 140,719 217,236 76,517 54.38% ⛔
Sema.InheritsSuperclassInitializersRequest 12,431 18,808 6,377 51.3% ⛔
Sema.InitKindRequest 53,463 82,576 29,113 54.45% ⛔
Sema.InterfaceTypeRequest 3,011,830 4,596,822 1,584,992 52.63% ⛔
Sema.IsABICompatibleOverrideRequest 124,094 188,619 64,525 52.0% ⛔
Sema.IsAccessorTransparentRequest 251,384 378,203 126,819 50.45% ⛔
Sema.IsActorRequest 197,653 304,311 106,658 53.96% ⛔
Sema.IsAsyncHandlerRequest 672,073 1,024,044 351,971 52.37% ⛔
Sema.IsCallableNominalTypeRequest 2,011 3,059 1,048 52.11% ⛔
Sema.IsDeclRefinementOfRequest 20,076 31,755 11,679 58.17% ⛔
Sema.IsDefaultActorRequest 22,236 35,176 12,940 58.19% ⛔
Sema.IsDynamicRequest 1,156,317 1,771,719 615,402 53.22% ⛔
Sema.IsFinalRequest 926,821 1,397,936 471,115 50.83% ⛔
Sema.IsGetterMutatingRequest 304,101 462,848 158,747 52.2% ⛔
Sema.IsImplicitlyUnwrappedOptionalRequest 1,786,100 2,697,880 911,780 51.05% ⛔
Sema.IsObjCRequest 1,021,303 1,547,248 525,945 51.5% ⛔
Sema.IsSetterMutatingRequest 290,633 445,740 155,107 53.37% ⛔
Sema.IsStaticRequest 536,433 800,675 264,242 49.26% ⛔
Sema.LazyStoragePropertyRequest 816 872 56 6.86% ⛔
Sema.LookupAllConformancesInContextRequest 106,712 162,533 55,821 52.31% ⛔
Sema.LookupConformanceInModuleRequest 61,182,590 91,451,175 30,268,585 49.47% ⛔
Sema.LookupInModuleRequest 2,096,145 3,183,355 1,087,210 51.87% ⛔
Sema.LookupInfixOperatorRequest 49,307 76,292 26,985 54.73% ⛔
Sema.LookupPostfixOperatorRequest 38 47 9 23.68% ⛔
Sema.LookupPrecedenceGroupRequest 23,626 35,170 11,544 48.86% ⛔
Sema.LookupPrefixOperatorRequest 115 186 71 61.74% ⛔
Sema.MangleLocalTypeDeclRequest 268 343 75 27.99% ⛔
Sema.ModuleImplicitImportsRequest 1,168 1,748 580 49.66% ⛔
Sema.ModuleQualifiedLookupRequest 402,741 619,649 216,908 53.86% ⛔
Sema.NamedLazyMemberLoadSuccessCount 7,876,236 11,500,989 3,624,753 46.02% ⛔
Sema.NamingPatternRequest 65,925 98,314 32,389 49.13% ⛔
Sema.NeedsNewVTableEntryRequest 514,375 776,205 261,830 50.9% ⛔
Sema.NumAccessorBodiesSynthesized 187,348 285,918 98,570 52.61% ⛔
Sema.NumAccessorsSynthesized 190,997 290,536 99,539 52.12% ⛔
Sema.NumConformancesDeserialized 2,882,842 4,612,175 1,729,333 59.99% ⛔
Sema.NumConstraintScopes 15,290,707 22,976,457 7,685,750 50.26% ⛔
Sema.NumConstraintsConsideredForEdgeContraction 983,040 1,796,310 813,270 82.73% ⛔
Sema.NumCyclicOneWayComponentsCollapsed 260 346 86 33.08% ⛔
Sema.NumDeclsDeserialized 10,561,752 16,369,437 5,807,685 54.99% ⛔
Sema.NumDeclsTypechecked 1,316,209 2,003,236 687,027 52.2% ⛔
Sema.NumGenericSignatureBuilders 211,240 319,821 108,581 51.4% ⛔
Sema.NumLazyIterableDeclContexts 1,346,970 2,060,444 713,474 52.97% ⛔
Sema.NumLazyRequirementSignatures 110,622 167,364 56,742 51.29% ⛔
Sema.NumLazyRequirementSignaturesLoaded 86,497 131,503 45,006 52.03% ⛔
Sema.NumLeafScopes 10,690,375 15,878,458 5,188,083 48.53% ⛔
Sema.NumTypesDeserialized 4,647,980 7,242,075 2,594,095 55.81% ⛔
Sema.NumUnloadedLazyIterableDeclContexts 889,654 1,345,703 456,049 51.26% ⛔
Sema.OpaqueReadOwnershipRequest 171,184 259,592 88,408 51.65% ⛔
Sema.OpaqueResultTypeRequest 295 366 71 24.07% ⛔
Sema.OperatorPrecedenceGroupRequest 532 720 188 35.34% ⛔
Sema.OverriddenDeclsRequest 1,102,947 1,677,571 574,624 52.1% ⛔
Sema.ParamSpecifierRequest 734,854 1,105,817 370,963 50.48% ⛔
Sema.PatternBindingEntryRequest 278,041 426,112 148,071 53.26% ⛔
Sema.PatternTypeRequest 353,744 535,739 181,995 51.45% ⛔
Sema.PolymorphicEffectKindRequest 64,841 99,257 34,416 53.08% ⛔
Sema.PreCheckResultBuilderRequest 717 903 186 25.94% ⛔
Sema.PrimarySourceFilesRequest 1,168 1,748 580 49.66% ⛔
Sema.PropertyWrapperAuxiliaryVariablesRequest 323,822 497,374 173,552 53.59% ⛔
Sema.PropertyWrapperBackingPropertyTypeRequest 6,678 10,483 3,805 56.98% ⛔
Sema.PropertyWrapperInitializerInfoRequest 318,728 487,765 169,037 53.03% ⛔
Sema.PropertyWrapperLValuenessRequest 631 874 243 38.51% ⛔
Sema.PropertyWrapperMutabilityRequest 462,808 707,382 244,574 52.85% ⛔
Sema.PropertyWrapperTypeInfoRequest 52 88 36 69.23% ⛔
Sema.ProtocolRequiresClassRequest 8,516 12,358 3,842 45.12% ⛔
Sema.QualifiedLookupRequest 3,595,029 5,431,410 1,836,381 51.08% ⛔
Sema.RequirementRequest 58,348 96,244 37,896 64.95% ⛔
Sema.RequirementSignatureRequest 96,388 145,914 49,526 51.38% ⛔
Sema.RequiresOpaqueAccessorsRequest 1,078,647 1,634,213 555,566 51.51% ⛔
Sema.RequiresOpaqueModifyCoroutineRequest 167,654 256,790 89,136 53.17% ⛔
Sema.ResolveImplicitMemberRequest 345,734 531,173 185,439 53.64% ⛔
Sema.ResolveTypeRequest 1,729,864 2,620,050 890,186 51.46% ⛔
Sema.ResultBuilderTypeRequest 313,032 474,790 161,758 51.67% ⛔
Sema.ResultTypeRequest 382,224 579,373 197,149 51.58% ⛔
Sema.SPIGroupsRequest 1,705,018 2,613,029 908,011 53.26% ⛔
Sema.ScopedImportLookupRequest 793 1,544 751 94.7% ⛔
Sema.SelfAccessKindRequest 308,676 454,387 145,711 47.21% ⛔
Sema.SelfBoundsFromWhereClauseRequest 423,230 620,989 197,759 46.73% ⛔
Sema.SetterAccessLevelRequest 126,338 187,142 60,804 48.13% ⛔
Sema.SimpleDidSetRequest 314,227 472,427 158,200 50.35% ⛔
Sema.SpecializeAttrTargetDeclRequest 1,685 2,940 1,255 74.48% ⛔
Sema.StorageImplInfoRequest 1,180,438 1,787,722 607,284 51.45% ⛔
Sema.StoredPropertiesAndMissingMembersRequest 36,274 57,881 21,607 59.57% ⛔
Sema.StoredPropertiesRequest 133,846 206,498 72,652 54.28% ⛔
Sema.StructuralTypeRequest 386 674 288 74.61% ⛔
Sema.SuperclassDeclRequest 89,595 137,986 48,391 54.01% ⛔
Sema.SuperclassTypeRequest 21,204 33,105 11,901 56.13% ⛔
Sema.SynthesizeAccessorRequest 190,997 290,536 99,539 52.12% ⛔
Sema.SynthesizeDefaultInitRequest 2,989 4,324 1,335 44.66% ⛔
Sema.SynthesizeMainFunctionRequest 84,769 131,057 46,288 54.6% ⛔
Sema.SynthesizeMemberwiseInitRequest 2,330 3,737 1,407 60.39% ⛔
Sema.TypeCheckFunctionBodyRequest 494,704 754,979 260,275 52.61% ⛔
Sema.TypeCheckSourceFileRequest 24,494 36,567 12,073 49.29% ⛔
Sema.TypeDeclsFromWhereClauseRequest 19,295 30,335 11,040 57.22% ⛔
Sema.TypeWitnessRequest 3,311 5,255 1,944 58.71% ⛔
Sema.USRGenerationRequest 381,808 569,814 188,006 49.24% ⛔
Sema.UnderlyingTypeDeclsReferencedRequest 54,969 78,055 23,086 42.0% ⛔
Sema.UnderlyingTypeRequest 15,826 26,797 10,971 69.32% ⛔
Sema.UnqualifiedLookupRequest 2,033,920 3,098,796 1,064,876 52.36% ⛔
Sema.ValidatePrecedenceGroupRequest 174,207 257,612 83,405 47.88% ⛔
Sema.ValueWitnessRequest 34,148 46,940 12,792 37.46% ⛔
TBDGen.PublicSymbolsRequest 1,162 1,741 579 49.83% ⛔
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (42)
name old new delta delta_pct
AST.NumIncrementalDependencies 0 0 0 0.0%
AST.NumLinkLibraries 0 0 0 0.0%
AST.NumReferencedDynamicNames 0 0 0 0.0%
AST.NumReferencedMemberNames 3,984 3,984 0 0.0%
AST.NumReferencedTopLevelNames 352 352 0 0.0%
IRGen.IRGenRequest 12 12 0 0.0%
IRGen.OptimizedIRRequest 0 0 0 0.0%
IRGen.SymbolObjectCodeRequest 0 0 0 0.0%
IRModule.NumIRComdatSymbols 0 0 0 0.0%
IRModule.NumIRIFuncs 0 0 0 0.0%
Parse.CodeCompletionSecondPassRequest 0 0 0 0.0%
SILGen.ParseSILModuleRequest 0 0 0 0.0%
SILModule.NumSILGenDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILOptDefaultWitnessTables 0 0 0 0.0%
SILOptimizer.LoweredSILRequest 0 0 0 0.0%
Sema.AsyncAlternativeRequest 0 0 0 0.0%
Sema.CanBeAsyncHandlerRequest 0 0 0 0.0%
Sema.CodeCompletionFileRequest 0 0 0 0.0%
Sema.CollectOverriddenDeclsRequest 0 0 0 0.0%
Sema.ConformanceHasEffectRequest 0 0 0 0.0%
Sema.CursorInfoRequest 0 0 0 0.0%
Sema.DifferentiableAttributeTypeCheckRequest 0 0 0 0.0%
Sema.HasDynamicCallableAttributeRequest 0 0 0 0.0%
Sema.IsDeclApplicableRequest 0 0 0 0.0%
Sema.ModuleLibraryLevelRequest 0 0 0 0.0%
Sema.NumCrossImportsChecked 0 0 0 0.0%
Sema.NumCrossImportsFound 0 0 0 0.0%
Sema.PolymorphicEffectRequirementsRequest 0 0 0 0.0%
Sema.ProvideDefaultImplForRequest 0 0 0 0.0%
Sema.RangeInfoRequest 0 0 0 0.0%
Sema.ResolveEffectiveMemberwiseInitRequest 0 0 0 0.0%
Sema.ResolveProtocolNameRequest 0 0 0 0.0%
Sema.ResolveTypeEraserTypeRequest 0 0 0 0.0%
Sema.RootAndResultTypeOfKeypathDynamicMemberRequest 0 0 0 0.0%
Sema.RootTypeOfKeypathDynamicMemberRequest 0 0 0 0.0%
Sema.TangentStoredPropertyRequest 0 0 0 0.0%
Sema.TypeCheckASTNodeAtLocRequest 0 0 0 0.0%
Sema.TypeEraserHasViableInitRequest 0 0 0 0.0%
Sema.TypeRelationCheckRequest 0 0 0 0.0%
TBDGen.APIGenRequest 0 0 0 0.0%
TBDGen.GenerateTBDRequest 0 0 0 0.0%
TBDGen.SymbolSourceMapRequest 0 0 0 0.0%

@johnno1962
Copy link
Contributor Author

johnno1962 commented May 7, 2021

Thanks very much for doing this @harlanhaskins, the results look unbelievably bad alas. Can you help me interpret them? How could LLVM.NumLLVMBytesOutput have increased by 50%?? Interesting runtime performance seems improved for a couple of benchmarks. There was an error "No test results found.", is the easiest thing to do to just run it again?

@harlanhaskins
Copy link
Contributor

Those compiler perf results seem way off. Not sure where all that extra work is coming from but there's no way these changes caused that effect...

@johnno1962 johnno1962 force-pushed the immutable-conversions branch 2 times, most recently from eb0dae2 to 74d4597 Compare May 9, 2021 17:04
@johnno1962
Copy link
Contributor Author

I performed an analysis of the elapsed times on Friday's benchmark log elapsed.txt and can't find any systematic slowdown the summary results suggest so I'm finding the results pretty hard to believe given the microscopic scale of the proposed change. Were we just unlucky? If we ran the benchmarks again would things come right or should I commit a one line change to disable the feature and we could re-run the benchmarks to test the test?

@johnno1962
Copy link
Contributor Author

Hi @belkadan, you mentioned on the forum you thought it might be worth kicking of another run of @swift-ci please test compiler performance. Seeing as it is the weekend, do you still have the necessary?

@xwu
Copy link
Collaborator

xwu commented Jun 20, 2021

@swift-ci please test compiler performance

@swift-ci
Copy link
Contributor

Compilation-performance test failed

@johnno1962
Copy link
Contributor Author

johnno1962 commented Jun 20, 2021

Thanks, @xwu, perhaps suggesting running at the weekend wasn't such a good idea ;) I can't see why it failed checking out.

@belkadan
Copy link
Contributor

I don't think I actually have test privileges anymore, either! Thanks, Xiaodi.

@@ -6588,6 +6588,10 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
if (toType->hasUnresolvedType())
break;

if (cs.toImmutablePossible(fromType->lookThroughAllOptionalTypes(),
Copy link
Member

Choose a reason for hiding this comment

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

Here in CSApply, we need to generate a correct type-checked AST, e.g., by calling the appropriate initializer on the target type. The handling of ConversionRestrictionKind::CGFloatToDouble is a good guide here.

Copy link
Member

Choose a reason for hiding this comment

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

Also, we shouldn't be looking through optional types here. If there are optional mismatches, they'll have to be handled so the resulting type-checked AST is correct.

};

if (lhs->isUnsafeMutablePointer() && rhs->isUnsafePointer() &&
firstGenericArgument(lhs) == firstGenericArgument(rhs))
Copy link
Member

Choose a reason for hiding this comment

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

Comparing canonical types isn't enough here, because lhs or rhs could contain type variables that haven't been determined yet. When the solver determines that it's possible to convert from mutable to immutable, you'll need to introduce a same-type constraint between the arguments. I suspect you'll be able to see the problem with a test like this:

func f<T>(_: UnsafePointer<T>, _: UnsafePointer<T>) { }

func g(mut: UnsafeMutablePointer<Int>, imm: UnsafePointer<Int>) {
  f(imm, mut)
  f(mut, imm)
}

@@ -0,0 +1,55 @@
// RUN: %target-typecheck-verify-swift -parse-stdlib
Copy link
Member

Choose a reason for hiding this comment

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

This is only testing type-checking, but based on the comment I made in CSApply, I think later compiler stages (e.g., SILGen) will fail due to an AST that doesn't have well-formed types. I recommend adding some SILGen tests to ensure that the right initializers are getting called when this conversion applies.

@johnno1962
Copy link
Contributor Author

Thanks for your comment @DougGregor. This idea seems to be still under discussion on the forums as to whether to go for a more flexible "DAG" approach which would be outside my pay grade and I'm a bit hamstrung this end as I can no longer build toolchains for testing as I have an M1. I'll start looking at this again once the forum settles down or should I continue looking at the tactical approach for now?

@hborla
Copy link
Member

hborla commented Jul 30, 2021

or should I continue looking at the tactical approach for now?

The discussion on the forums about extensible implicit conversions is separable from this specific implicit conversion. I suggest fixing up the narrow implementation of this implicit conversion now to make your proposal ready for review, and the discussion about a generalized feature can happen separately.

Please let me or @xedin know if you need any further guidance on this implementation!

@hborla hborla requested review from xedin and hborla July 30, 2021 20:19
@johnno1962
Copy link
Contributor Author

johnno1962 commented Jul 30, 2021

Thanks @hborla, I'll let the forum run a bit further before I invest more time that could end up being wasted. I also am scarcely able to work on the compiler as I have an M1 (SR-14035).

Do you have an answer to my last post? Could processing custom implicit conversions in ConstraintSystem::repairFailures() be the answer to avoid type checker slow downs? Any chance you could re-run the compiler benchmarks for this PR since it's almost the weekend and we could get a data point on whether this is the case.

@johnno1962 johnno1962 closed this Jul 30, 2021
@johnno1962 johnno1962 reopened this Aug 4, 2021
@johnno1962
Copy link
Contributor Author

johnno1962 commented Aug 4, 2021

@hborla, @xedin I've restarted looking at this as the prospect of zero-cost custom implicit conversions is too tempting to not try to produce a proof of concept to keep the pitch moving. I've moved from specifying then as __conversion() functions on the from type to init(implicit:) initialisers on the to-type as it seemed a better fit with to reuse the CGFloat<->Double CSApply.cpp code. It also seems to organise the conversions better as you can see from the immutable_mutable.swift test file. I've created a new ConversionRestrictionKind::ImplicitConversion but if I use it crashes so it's time to poll for some pointers on where to go from here? Should it be a FixKind instead perhaps? But where are they "applied"?

@swift-ci
Copy link
Contributor

swift-ci commented Aug 4, 2021

Build failed before running benchmark.

@xedin
Copy link
Contributor

xedin commented Aug 4, 2021

@johnno1962 What do you mean by zero-cost? If I understand it correctly this would be costly for the solver because it would have to always form a disjunction to check whether one (or potentially more) implicit conversion could fit. Performance is a big factor when it comes to implicit conversions as was mentioned during Double <-> CGFloat pitch/proposal discussion, although that is just two types in complex expression it becomes an issue.

@johnno1962
Copy link
Contributor Author

johnno1962 commented Aug 4, 2021

I mean I'm trying to prepare a prototype that takes a different tack implementing implicit conversions in ConstraintSystem::repairFailures() rather than the type check itself. I've got to the point where new conversions type check, carefully checking using a full build of https://github.com/grpc/grpc-swift which contains a wide variety of Swift & C that compiler performance has not been degraded.

Now, I just need to "apply" the fix somehow in a way that the new init(implicit:) constructors are called as were the CGFloat/Double constructors in their conversions. It very nearly works just changing conversionsOrFixes.push_back(ConversionRestrictionKind::PointerToPointer) in the code checked in (which works for pointer types as a pointer is a pointer) to push back the new ConversionRestrictionKind::ImplicitConversion. it crashes either creating the "overload" or if I comment that out in the subsequent finishApply() around CSApply.cpp#6942.

@xedin
Copy link
Contributor

xedin commented Aug 4, 2021

I wouldn't recommend doing that since repairFailures is only triggered in diagnostic mode and that checks a lot more (overloads) than first pass does, better approach would be to use restrictions mechanism just like what Double/CGFloat conversion does.

@johnno1962 johnno1962 force-pushed the immutable-conversions branch 3 times, most recently from 47c66ad to a8880fc Compare August 7, 2021 13:41
@johnno1962 johnno1962 force-pushed the immutable-conversions branch from a8880fc to 58f57d2 Compare August 7, 2021 13:46
@johnno1962
Copy link
Contributor Author

johnno1962 commented Aug 7, 2021

Thanks for the feedback, I've moved the code around to re-use the CSApply.cpp code in ExprRewriter::coerceToType() and it nearly works but I encountered a couple of problems that I can't puzzle out. With the version checked in it is possible to run the following code (the extension enables the conversion is available otherwise it won't compile):

extension UnsafeRawPointer {
  init(implicit: UnsafeMutableRawPointer) {
    print("HERE!")
    self.init(implicit)
  }
}

let mutableRawPointer = UnsafeMutableRawPointer(bitPattern: -3)!
let immutable: UnsafeRawPointer = mutableRawPointer

print(mutableRawPointer,  immutable)

However, even though I think I've adapted the compiler to call the new constructor with the implicit: label, the text HERE| is never printed. The second problem (which is probably related?) is when I then try to run the following code:

extension Int {
  init(implicit: Int32) {
    print("HERE!")
    self.init(implicit)
  }
}

let a : Int32 = 99
let b: Int = a

Which fails further along in Sema at this point where it is a TupleExpr but the expr's type is a (paren_type (struct_type decl=Swift.(file).Int32)).

Can you think of anything obvious I could try to get moving again on either of these problems?

Cheers!

@johnno1962
Copy link
Contributor Author

Progress report, found a bad way to overload the selected solution overload when init(implicit:) constructors should be used and the print("HERE!") message is now printed. Any suggestions on how to do it in a less terrible way? Can now specify a variety of conversions except for proper treatment of generics which I imagine is going to be difficult :S

@@ -5320,7 +5390,8 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
if (kind >= ConstraintKind::Subtype &&
nominal1->getDecl() != nominal2->getDecl() &&
((nominal1->isCGFloatType() || nominal2->isCGFloatType()) &&
(nominal1->isDouble() || nominal2->isDouble()))) {
(nominal1->isDouble() || nominal2->isDouble())) ||
useRestrictions && implicitConversionAvailable(type1, type2)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please extract this into a separate check, no need to try to plug it into the Double/CGFloat. As a side note - if you are working on a more general mechanism then I think we need to remove Double/CGFloat specific logic all together from here because it would be possible to declare a init(implicit: CGFloat) on Double and reverse one of CGFloat and use new infrastructure.

return !conversionsOrFixes.empty();
}

ConstructorDecl *ConstraintSystem::implicitConversionAvailable(Type fromType, Type toType) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The implementation here would have to be more interesting, that's why we (me and @hborla) were talking about it being complex for the solver. We'd have to add a member constraint to lookup init(implicit:) on the fromType and apply found member with an argument toType to make sure that everything fits together correctly, so instead of doing manual lookup down here you'd have to always record an implicit conversion between types that didn't match but are constrained on Conversion and down in simplifyRestrictedConstraintImpl implement it as member constraint + applicable function constraint.

@xedin
Copy link
Contributor

xedin commented Aug 9, 2021

@johnno1962 I have left a couple of comments outlining a better approach.

@johnno1962
Copy link
Contributor Author

Thanks for your comments @xedin, digesting them.

@johnno1962
Copy link
Contributor Author

One quick question, can you think of a function that takes a type UnsafePointer where T is unbound and returns whether UnsafePointer is an instance of it?

@xedin
Copy link
Contributor

xedin commented Aug 9, 2021

I'm not sure exactly what you mean by "it", can you give an example?

@johnno1962
Copy link
Contributor Author

I meaning is there a function that detects that UnsafePointer is a UnsafePointer where Pointee is not specified. I'm trying to improve the matching of the init(implicit:) for generics i.e. is there something I can call that knows:

(bound_generic_struct_type decl=Swift.(file).UnsafeMutablePointer
  (struct_type decl=Swift.(file).Int))

is a:

(bound_generic_struct_type decl=Swift.(file).UnsafeMutablePointer
  (primary_archetype_type address=0x116e4fc80 name=Pointee
)) 

@xedin
Copy link
Contributor

xedin commented Aug 9, 2021

Ah, you can use getAnyPointerElementType which would give you the type of pointer it was and type of its element.

@johnno1962
Copy link
Contributor Author

johnno1962 commented Aug 11, 2021

Thanks for the pointers. An update on what I've been looking at. I lost a day trying to work out why you could add implicit conversions to some types CGFloat/Double/Int etc and not others. It turns out the ToType needs to have a label-less initialiser for the FromType already or there is no viable solution to apply by forcing the overload onto the new init(implicit:) constructor. The only difference since yesterday is that rather than have to have create two init()s to make a new type convertible the code now accepts init(_ implicit:) methods to provide the label-less initialiser for the type checker while making the conversion implicit.

Not sure how all the pieces fit together yet but it fells like the constraint system is already doing all the work required and it may just be a question of how to annotate possible conversions and perhaps zero-cost can be realised. As for the checked-in version I've been dong some benchmarking using a build of https://github.com/grpc/grpc-swift. I was hoping since I #if 0'd out the old CGFloat/Double code it might be faster but it seems not:

Benchmarks for swift-frontend built from main:
build 159.94s user 22.71s system 476% cpu 38.311 total
build 162.17s user 22.63s system 506% cpu 36.478 total
build 159.90s user 22.44s system 477% cpu 38.165 total
build 159.82s user 22.54s system 475% cpu 38.323 total
build 159.86s user 22.78s system 492% cpu 37.101 total
build 160.30s user 22.83s system 473% cpu 38.640 total
build 159.48s user 20.91s system 500% cpu 36.018 total
build 158.91s user 21.28s system 459% cpu 39.208 total
build 158.89s user 21.46s system 482% cpu 37.378 total
build 161.28s user 22.04s system 485% cpu 37.789 total

Benchmarks with my ad-hoc changes supporting adding any conversion:
build 159.27s user 22.16s system 471% cpu 38.477 total
build 159.32s user 21.94s system 496% cpu 36.512 total
build 158.71s user 21.66s system 470% cpu 38.327 total
build 160.04s user 21.75s system 500% cpu 36.289 total
build 159.78s user 21.59s system 491% cpu 36.924 total
build 158.97s user 21.64s system 504% cpu 35.808 total
build 159.42s user 21.55s system 496% cpu 36.469 total
build 160.49s user 21.87s system 508% cpu 35.875 total
build 161.92s user 21.93s system 495% cpu 37.075 total
build 159.93s user 21.50s system 507% cpu 35.745 total

@johnno1962 johnno1962 force-pushed the immutable-conversions branch from 3f56908 to 0487ea0 Compare August 12, 2021 15:20
@johnno1962
Copy link
Contributor Author

johnno1962 commented Aug 12, 2021

I've added a few example tests and I think I've taken this proof of concept as far as I'd planned. I wanted only to prove that it was possible to create a functioning prototype of the compiler where it was possible to introduce implicit conversions between meaningful and safe pairs of types that wasn't slower. Perhaps it could be useful to run the compiler benchmarks again since the code has moved on though perhaps the same problems with the benchmarks will manifest again.

I'll summarise this thought experiment on the pitch thread tomorrow unless you've anything to add. Perhaps a "proper" version of this should be implemented inside the constraint system but it seems to me that's where the anxiety about implicit conversions sets in. It is possible the naïveté of this hybrid "outside the type checker" approach is its quality.

@johnno1962
Copy link
Contributor Author

I'll close this now as clearly it shouldn't get merged but I hope someone picks up the idea of custom implicit conversions.

@johnno1962 johnno1962 closed this Aug 16, 2021
@johnno1962
Copy link
Contributor Author

johnno1962 commented Aug 18, 2021

I'm going to wrap up my conclusions from this PR in one place here rather than repeat them again on the forum.
The TLDR:

  • It seems possible to add an extensible implicit conversion mechanism to the compiler without slowing it down
  • Due to how it is implemented conversions can not be cumulative. This has two advantages: 1) it will not send the type checker off on an exponential goose-chase avoiding possible worst case slow downs. 2) As it is not a "graph" it does not have to be acyclic so implementing bidirectional conversions such as CGFloat <-> Double is not a problem.
  • In theory any conversion that can be expressed as an initialiser can be catered for. It's just a question of how involved this section of code which selects the implicit constructor becomes. By that point, the code path has already been selected on the basis of a two-axis lookup by NominalTypeDescriptor of the two types so it's not particularly important that that code be uncomplicated and performant but one wouldn't want it to become another type checker in itself. Perhaps there is an entry point elsewhere in the compiler to select the match that could be reused.

So, to the current "design".

It was not the process of selecting from of a set alternatives but fell out of wanting to be able to reuse the code that "applies" the CGFloat<->Double conversion. That said, I don't think it is a bad design. Gating conversions by an initialiser on the to type rather than a __conversion() functions on the from type groups conversions more naturally it would seem. At present a magic argument label name flags an initialiser as being implicitly applied though it could as easily be an @Attribute.

There is more detail about the design in the forum post and the link for a toolchain built with these changes applied to the 5.5 dev branch. The best summary of usage is probably the tests against this PR

The implementation (this is a naive view and possibly incorrect view of what's going on.).

Rather than adding a code path to the constraint solver process proper (in fact I removed the CGFloat<->Double path here in the end), the check for possible implicit conversions is performed in ConstraintSystem::repairFailures(). This seems to result in it not being possible to cascade conversions which is a feature for the reasons I mention above. My mental model for type checking or more specifically the constraint solver is largely based on intuition rounded out by Holly's video from 2020. In broad terms the constraint solver attempts to juggle the types and function names in an expression into a solution then, at the last stage calls ConstraintSystem::repairFailures() to provide one last chance at making the solution viable by applying some additional conversions or fixes otherwise an error is emitted. I learned that for a conversion between two types to be located as a potential solution, an unlabelled initialiser needs to be available between the two types (so the solver is already performing the bulk of the work required). In the end all this patch does is provide a new fix here to flag a solution can be viable and through a bit of code here patches the implicit constructor implementation in place of the pre-existing constructor it found. All the implicit constructor itself does is gate this process.

That's about it apart from miscellaneous changes to paper over a few assertions firing.

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.

8 participants