Skip to content

Conversation

@dsyme
Copy link
Contributor

@dsyme dsyme commented Feb 28, 2019

This makes desktop fsc.exe 32-bit again, see #6258. It includes #6223 which is not yet in master.

See #6258 (comment) for the rationale as to why.

The .NET Core fsc.exe remains 64-bit.

(Separately it would be good to know the perf implications either way, mainly out of curiosity as I don't think we'll change either choice. I guess if 64-bit is faster we could add a fscAnyCpu to the build and use it as the default desktop compiler going forward, leaving the other for stack-size/type-provider compat scenarios?)

@KevinRansom
Copy link
Contributor

@dsyme, longer term we will want to shift to the coreclr as the default compiler, and interactive, and keep the desktop around for legacy projects.

The coreclr is mostly going to be 64 bit, the 32 bit compiler is often not used or even installed.

@dsyme
Copy link
Contributor Author

dsyme commented Feb 28, 2019

@dsyme, longer term we will want to shift to the coreclr as the default compiler, and interactive, and keep the desktop around for legacy projects. The coreclr is mostly going to be 64 bit, the 32 bit compiler is often not used or even installed.

Yes understood

@KevinRansom
Copy link
Contributor

@dsyme

CompilerOptions\fsc\determinism (14) -- failed
CompilerOptions\fsc\determinism (15) -- failed
CompilerOptions\fsc\determinism (16) -- failed

@dsyme
Copy link
Contributor Author

dsyme commented Feb 28, 2019

+++ CompilerOptions\fsc\determinism (14) +++
PRECMD: [fsc --deterministic                  dummy.fs && fsiAnyCPU copyArtifacts.fsx]
Microsoft (R) F# Compiler version 10.2.3 for F# 4.5
Copyright (c) Microsoft Corporation. All Rights Reserved.
--------------------------------------------------------
Error from hosted compiler
Exit code: 0
Error:     0
Microsoft (R) F# Compiler version 10.2.3 for F# 4.5
Copyright (c) Microsoft Corporation. All Rights Reserved.
--------------------------------------------------------
Microsoft (R) F# Compiler version 10.2.3 for F# 4.5
Copyright (c) Microsoft Corporation. All Rights Reserved.
Peverify: [D:\a\1\s\tests\fsharpqa\Source\..\..\..\artifacts\bin\PEVerify\Release\net46\PEVerify.exe dummy.exe ]
Running: [ dummy.exe ]

POSTCMD: [fsiAnyCPU --nologo --quiet --exec binaryCompare.fsx true]
Expected D:\a\1\s\tests\fsharpqa\Source\CompilerOptions\fsc\determinism\dummy.exe and D:\a\1\s\tests\fsharpqa\Source\CompilerOptions\fsc\determinism\dummy2.exe to be same
Fail to execute the POSTCMD. FAIL
+++ CompilerOptions\fsc\determinism (15) +++
PRECMD: [fsc --deterministic --debug:portable dummy.fs && fsiAnyCPU copyArtifacts.fsx]
Microsoft (R) F# Compiler version 10.2.3 for F# 4.5
Copyright (c) Microsoft Corporation. All Rights Reserved.
--------------------------------------------------------
Error from hosted compiler
Exit code: 0
Error:     0
Microsoft (R) F# Compiler version 10.2.3 for F# 4.5
Copyright (c) Microsoft Corporation. All Rights Reserved.
--------------------------------------------------------
Microsoft (R) F# Compiler version 10.2.3 for F# 4.5
Copyright (c) Microsoft Corporation. All Rights Reserved.
Peverify: [D:\a\1\s\tests\fsharpqa\Source\..\..\..\artifacts\bin\PEVerify\Release\net46\PEVerify.exe dummy.exe ]
Running: [ dummy.exe ]

POSTCMD: [fsiAnyCPU --nologo --quiet --exec binaryCompare.fsx true]
Expected D:\a\1\s\tests\fsharpqa\Source\CompilerOptions\fsc\determinism\dummy.exe and D:\a\1\s\tests\fsharpqa\Source\CompilerOptions\fsc\determinism\dummy2.exe to be same
Fail to execute the POSTCMD. FAIL
+++ CompilerOptions\fsc\determinism (16) +++
PRECMD: [fsc --deterministic --debug:embedded dummy.fs && fsiAnyCPU copyArtifacts.fsx]
Microsoft (R) F# Compiler version 10.2.3 for F# 4.5
Copyright (c) Microsoft Corporation. All Rights Reserved.
--------------------------------------------------------
Error from hosted compiler
Exit code: 0
Error:     0
Microsoft (R) F# Compiler version 10.2.3 for F# 4.5
Copyright (c) Microsoft Corporation. All Rights Reserved.
--------------------------------------------------------
Microsoft (R) F# Compiler version 10.2.3 for F# 4.5
Copyright (c) Microsoft Corporation. All Rights Reserved.
Peverify: [D:\a\1\s\tests\fsharpqa\Source\..\..\..\artifacts\bin\PEVerify\Release\net46\PEVerify.exe dummy.exe ]
Running: [ dummy.exe ]

POSTCMD: [fsiAnyCPU --nologo --quiet --exec binaryCompare.fsx true]
Expected D:\a\1\s\tests\fsharpqa\Source\CompilerOptions\fsc\determinism\dummy.exe and D:\a\1\s\tests\fsharpqa\Source\CompilerOptions\fsc\determinism\dummy2.exe to be same
Fail to execute the POSTCMD. FAIL

@dsyme
Copy link
Contributor Author

dsyme commented Feb 28, 2019

It's weird, I can't repro this failure in the determinism tests locally

.\build net40 debug

cd tests\fsharpqa\Source\CompilerOptions\fsc\determinism

..\..\..\..\..\..\artifacts\bin\fsc\Debug\net46\fsc.exe --deterministic dummy.fs
fsiAnyCpu copyArtifacts.fsx
..\..\..\..\..\..\artifacts\bin\fsc\Debug\net46\fsc.exe --deterministic dummy.fs
fsiAnyCpu --quiet --exec binaryCompare.fsx true

This shows identical binaries are being produced

@dsyme
Copy link
Contributor Author

dsyme commented Feb 28, 2019

@brettfo @KevinRansom Have you ever seen these tests fail?

@KevinRansom
Copy link
Contributor

@dsyme … no.

@dsyme
Copy link
Contributor Author

dsyme commented Feb 28, 2019

I think it's that

  1. the HostedCompilerServer used by the fsharpqa tests to produce dummy.exe was running x64
  2. the fsc.exe used by the same tests to produce dumym2.exe was running x86

Surprisingly the output binaries seem to differ slightly when the compiler runs as x86 v. x64.

@KevinRansom @brettfo any idea why this may be the case?

A vague guess is that this is because the PDB generation library writes slightly different entries

@KevinRansom
Copy link
Contributor

If it's creating desktop pdbs then who knows. If it's portable pdbs, then they should be consistent.

@dsyme
Copy link
Contributor Author

dsyme commented Feb 28, 2019

OK, well, the tests pass now, but there must be some small difference. I'll see if I can figure it out

@dsyme
Copy link
Contributor Author

dsyme commented Mar 1, 2019

@KevinRansom There was a bug in --deterministic - it was using hash on strings but these hashes are not consistent between x64 and x86 (indeed .NET hashes on strings are not even the same from day to day AFAIK)

I will add the fix here

@KevinRansom
Copy link
Contributor

@dsyme , good eyes.

@cartermp cartermp changed the title Compat fix for 6258 Compat fix for 6258 and fix deterministic flag Mar 1, 2019
@dsyme
Copy link
Contributor Author

dsyme commented Mar 1, 2019

@dsyme , good eyes.

2 hours looking at hexdumps of binaries....

@dsyme dsyme merged commit 09a9870 into dotnet:master Mar 1, 2019
@cartermp
Copy link
Contributor

cartermp commented Mar 1, 2019

@KevinRansom @Pilchie We should consider servicing this in an RC service. I'll queue up a bug.

@dsyme
Copy link
Contributor Author

dsyme commented Mar 1, 2019

BTW we could make the desktop fsc.exe and fsi.exe "anycpu, 32-bit preferred". They are currently x86.

I don't really see any technical downside to doing that - it means that if they happen to be launched as 64-bit processes then they will launch and run correctly.

dsyme pushed a commit that referenced this pull request Mar 2, 2019
* Make .NET Desktop fsi.exe 32-bit again and make Desktop fsiAnyCpu.exe (64-bit) the default to launch in VS #6223

* make fsc.exe 32-bit for compat

* make fsc.exe 32-bit for compat

* improve diagnostics

* fix tests

* fix determinism
@Pilchie
Copy link
Member

Pilchie commented Mar 4, 2019

I don't see a bug yet.

@cartermp
Copy link
Contributor

cartermp commented Mar 4, 2019

I'll write one up - one-handed 🤕

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.

4 participants