Skip to content

Commit 40178e3

Browse files
safesparrowT-Gro
andauthored
Parallel optimization - behind a test flag --test:ParallelOptimization (#14390)
Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>
1 parent 5b74995 commit 40178e3

File tree

8 files changed

+520
-118
lines changed

8 files changed

+520
-118
lines changed

src/Compiler/Driver/CompilerConfig.fs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ open System
77
open System.Collections.Concurrent
88
open System.Runtime.InteropServices
99
open System.IO
10+
open FSharp.Compiler.Optimizer
1011
open Internal.Utilities
1112
open Internal.Utilities.FSharpEnvironment
1213
open Internal.Utilities.Library
@@ -748,7 +749,14 @@ type TcConfigBuilder =
748749
doTLR = false
749750
doFinalSimplify = false
750751
optsOn = false
751-
optSettings = Optimizer.OptimizationSettings.Defaults
752+
optSettings =
753+
{ OptimizationSettings.Defaults with
754+
processingMode =
755+
if FSharpExperimentalFeaturesEnabledAutomatically then
756+
OptimizationProcessingMode.Parallel
757+
else
758+
OptimizationProcessingMode.Sequential
759+
}
752760
emitTailcalls = true
753761
deterministic = false
754762
concurrentBuild = true

src/Compiler/Driver/CompilerOptions.fs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module internal FSharp.Compiler.CompilerOptions
77
open System
88
open System.Diagnostics
99
open System.IO
10+
open FSharp.Compiler.Optimizer
1011
open Internal.Utilities.Library
1112
open Internal.Utilities.Library.Extras
1213
open FSharp.Compiler.AbstractIL.IL
@@ -1384,6 +1385,11 @@ let testFlag tcConfigB =
13841385
DumpGraph = true
13851386
}
13861387
| "DumpSignatureData" -> tcConfigB.dumpSignatureData <- true
1388+
| "ParallelOptimization" ->
1389+
tcConfigB.optSettings <-
1390+
{ tcConfigB.optSettings with
1391+
processingMode = OptimizationProcessingMode.Parallel
1392+
}
13871393
#if DEBUG
13881394
| "ShowParserStackOnParseError" -> showParserStackOnParseError <- true
13891395
#endif

0 commit comments

Comments
 (0)