Chore: Eliminate debug/release IL baseline duality#19611
Conversation
|
dc36f56 to
c0c214f
Compare
| <!-- .tail annotations always emitted for this binary, even in debug mode --> | ||
| <Tailcalls>true</Tailcalls> | ||
| <!-- Optimization always enabled for this binary, even in debug mode --> | ||
| <Optimize>true</Optimize> |
There was a problem hiding this comment.
I tend to think this could make debugging FSharp.Core much more difficult. Maybe we could force the tests to use the release build of it instead?
There was a problem hiding this comment.
It would then force people to build it twice (and maybe even having to remember to run build script twice, which I wanted to avoid). The config of Fsharp.Core flows to all projects involved in the run.
I would say that changes affecting any form of IL layout outnumber the need for FSharp.Core debugging, so I would leave the default as is in this PR now.
Once the need comes, to avoid fiddling a property, we can do a new target for FSharpCoreDebugging perharps?
There was a problem hiding this comment.
If you wanted to force all ProjectReferences to FSharp.Core to use Release mode (to prevent double-builds, etc) you can do that via the SetConfiguration metadata on the ProjectReference:
<ProjectReference Include="../FSharp.Core/FSharp.Core.fsproj" SetConfiguration="Configuration=Release" />You can do similar with TargetFramework, and any other special properties you may need. Doing this skips portions of the ProjectReference protocol entirely (because we no longer need to ask which config to use for this reference).
There was a problem hiding this comment.
Thanks @baronfel , this fits nicely - I think by default, I would want most stuff reference Optimized FSharp.Core, but I can introduce a new configuration (Since based on docs I cannot do SetCustomProperty=false) just for Fsharp.Core.UnitTests when those are ran in Debug.
c0c214f to
e506866
Compare
- Add <Optimize>true</Optimize> to FSharp.Core.fsproj so Debug and Release FSharp.Core produce equivalent IL, eliminating the root cause of debug/release baseline differences in EmittedIL tests. - Remove debug/release config branching from Compiler.fs IL baseline resolution (baselineIsDebug, configTag, TEST_BASELINE_CONFIG). - Consolidate 151 .release.bsl files into generic .bsl files. - Delete 176 .debug.bsl files that are now redundant. - Unify #if Release/#else IL forks in Inlining.fs and StaticsInInterfaces.fs test files (FSharp.Core inlining now identical in both configs). - Revert WindowsDebugBaselines CI job from azure-pipelines-PR.yml. - SurfaceArea baselines intentionally kept separate (MethodHandleOf is public in Debug, internal in Release via #if DEBUG in FSharp.Core). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
e506866 to
05f1130
Compare
Address review feedback by adding a note on how to disable optimization for local FSharp.Core debugging (dotnet build -p:Optimize=false). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2a1b0f0 to
a1e618c
Compare
Summary
Eliminates the meaningless debug/release distinction in IL test baselines by fixing the root cause: FSharp.Core was unoptimized in Debug builds, causing different IL when tests referenced it.
Changes
Root cause fix
FSharp.Core.fsproj: Added<Optimize>true</Optimize>(alongside existing<Tailcalls>true</Tailcalls>) so Debug FSharp.Core produces equivalent IL to Release.Test infrastructure simplification
Compiler.fs: RemovedbaselineIsDebug,configTag, andTEST_BASELINE_CONFIGenv var from IL baseline resolution. Fallback chain simplified from 4 paths to 2 (*.il.netcore.bslthen*.il.bslor*.il.net472.bslthen*.il.bsl).Inlining.fs: Removed#if Release/#elsefork - NaN is now inlined in both configs.StaticsInInterfaces.fs: Removed#if Release/#elsefork -Failureis now inlined in both configs.azure-pipelines-PR.yml: RevertedWindowsDebugBaselinesCI job (no longer needed).Baseline consolidation
.release.bslto generic.bsl.debug.bslIntentionally kept separate
FSharp.Core.SurfaceArea.*.{debug,release}.bsl):MethodHandleOfispublicin Debug butinternalin Release via#if DEBUGin FSharp.Core source. This is a genuine API surface difference.Validation