Skip to content

Conversation

@majocha
Copy link
Contributor

@majocha majocha commented Oct 14, 2025

This fixes remaining CI failures and enables by default --parallelcompilation. This includes:

NOTE: For deterministic builds only parallel reference resolution will be enabled.

--parallelcompilation- switch can be used to revert all of the above to previous behavior.

See tracking issue #18989

TODO:

  • restore switches
  • double check that with everything off things still work

Some il baselines changed because of reordered methods.

This work was encouraged and kindly sponsored by Amplifying F# initiative 🚀

@github-actions
Copy link
Contributor

github-actions bot commented Oct 14, 2025

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/11.0.0.md

@T-Gro
Copy link
Member

T-Gro commented Oct 15, 2025

Can I ignore the other three?
This one is fully green now.

@majocha
Copy link
Contributor Author

majocha commented Oct 15, 2025

Can I ignore the other three? This one is fully green now.

Yes, we can continue with just this one.

@majocha
Copy link
Contributor Author

majocha commented Oct 15, 2025

System.Exception : EVIL_PROVIDER_NamespaceName_Exception.err EVIL_PROVIDER_NamespaceName_Exception.bsl differ; "diff between [D:\a_work\1\s\artifacts\Temp\FSharp.Test.Utilities\72306301\6278ff13\typeProviders\negTests\EVIL_PROVIDER_NamespaceName_Exception.bsl] and [D:\a_work\1\s\artifacts\Temp\FSharp.Test.Utilities\72306301\6278ff13\typeProviders\negTests\EVIL_PROVIDER_NamespaceName_Exception.err]
diff at line 4
+



Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.

at [email protected](TcImportsLockToken tcitok)

at Internal.Utilities.Library.Lock1.AcquireLock[a](FSharpFunc2 f)

at FSharp.Compiler.CompilerImports.TcImportsSafeDisposal.Finalize()
"

Type providers don't like parallel imports, another random fail in evil provider.

@T-Gro
Copy link
Member

T-Gro commented Oct 16, 2025

Type providers don't like parallel imports, another random fail in evil provider.

I wonder if it because of the evil provider, or if the compiler should not synchronizing access to type provider code for all of them. (I assume that at time of TP creation, nothing in the compiler was parallel and access to TP libraries was always sequential).

@majocha
Copy link
Contributor Author

majocha commented Oct 16, 2025

Type providers don't like parallel imports, another random fail in evil provider.

I wonder if it because of the evil provider, or if the compiler should not synchronizing access to type provider code for all of them. (I assume that at time of TP creation, nothing in the compiler was parallel and access to TP libraries was always sequential).

I suspect it was because of one missing lock 6b96083
There was a comment that this requires a lock, but the lock was not there.

@majocha
Copy link
Contributor Author

majocha commented Oct 16, 2025

Type providers don't like parallel imports, another random fail in evil provider.

I wonder if it because of the evil provider, or if the compiler should not synchronizing access to type provider code for all of them. (I assume that at time of TP creation, nothing in the compiler was parallel and access to TP libraries was always sequential).

Yes, the oldest thing I remember was the Reactor, that made everything sequential. But then there's this #10310

@T-Gro
Copy link
Member

T-Gro commented Oct 16, 2025

Ok this makes sense, all access to TP synchronized.
We cannot tell from the outside if TP internals are thread safe or not.

@majocha majocha marked this pull request as ready for review October 16, 2025 18:55
@majocha majocha requested a review from a team as a code owner October 16, 2025 18:55
@majocha
Copy link
Contributor Author

majocha commented Oct 20, 2025

I suspect there is still a lot that can be optimized w.r.t. graph creation and how Transparent Compiler caches it. But I feel it would be best to do it separately.

@T-Gro T-Gro requested review from T-Gro, abonie and Copilot October 21, 2025 07:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables parallel compilation features by default after stabilization, including parallel reference resolution, parallel optimizations, parallel ILxGen, and graph-based type checking. The --parallelcompilation- switch can be used to revert to previous behavior. Setting --deterministic also makes compilation sequential except for parallel imports. IL baselines changed due to reordered methods from parallel processing.

Key Changes:

  • Enabled parallel compilation by default in configuration and build settings
  • Fixed deterministic mode to exclude graph-based type checking
  • Improved script handling and signature-to-implementation file mapping in graph checking
  • Updated thread safety for type provider disposal

Reviewed Changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/FSharp.Build/Microsoft.FSharp.NetSdk.props Changed ParallelCompilation default to true
src/FSharp.Build/Fsc.fs Changed ParallelCompilation default from false to true
src/Compiler/Optimize/Optimizer.fs Changed default processing mode from Sequential to Parallel
src/Compiler/Driver/ParseAndCheckInputs.fs Added deterministic mode check to exclude graph-based type checking
src/Compiler/Driver/GraphChecking/Types.fsi Added IsScript property and TryGetWrongOrderSignatureToImplementationIndex method
src/Compiler/Driver/GraphChecking/Types.fs Improved file pair mapping logic and added script detection
src/Compiler/Driver/GraphChecking/DependencyResolution.fs Added script compilation handling and wrong-order signature detection
src/Compiler/Driver/CompilerOptions.fs Updated parallel compilation switch to control reference resolution
src/Compiler/Driver/CompilerImports.fs Refactored assembly import to be fully async and fixed thread safety
src/Compiler/Driver/CompilerConfig.fs Changed defaults to enable parallel features
docs/release-notes/.FSharp.Compiler.Service/11.0.0.md Added release notes entry
tests/fsharp/typecheck/sigs/neg56_a.bsl Updated baseline with new error
tests/fsharp/typecheck/sigs/neg14.bsl Updated baseline with reordered errors
tests/fsharp/tests.fs Removed skipped test
tests/FSharp.Compiler.ComponentTests/Miscellaneous/MigratedTypeCheckTests.fs Re-enabled previously skipped test
Multiple IL baseline files Updated baselines reflecting method reordering from parallel compilation

@T-Gro T-Gro merged commit 36645e1 into dotnet:main Oct 22, 2025
38 checks passed
Copy link
Contributor

@nojaf nojaf left a comment

Choose a reason for hiding this comment

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

Great to see another step in the right direction. That said, don’t present this as "everything is now parallel." It needs more transparency and nuance.


### Changed

* Parallel compilation stabilised and enabled by default ([PR #18998](https://github.com/dotnet/fsharp/pull/18998))
Copy link
Contributor

Choose a reason for hiding this comment

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

This is quite vague about what is actually changed here. Anyone reading this, will need to scour through the PR to know what is actual up.

@majocha
Copy link
Contributor Author

majocha commented Oct 22, 2025

@nojaf thanks for the careful review👍 , I'll do a follow up addressing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants