Skip to content
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

Refactoring the generic-math CreateChecked/Saturating/Truncating APIs to match API review #69756

Merged
merged 23 commits into from
May 28, 2022

Conversation

tannergooding
Copy link
Member

@tannergooding tannergooding commented May 24, 2022

The git-diff is pretty bad so it might be easier to review this "by commit".

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

Copy link
Contributor

@dakersnar dakersnar left a comment

Choose a reason for hiding this comment

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

It seems like most of this "if it compiles it's correct" type of code. Testing should validate the small amounts of logic present, mostly in the Saturating code. Additionally, anywhere where you have introduced new explicit converters should be tested (Half, Int128, NFloat, BigInteger, Complex, etc). The CreateChecked tests look good, assuming you add CreateSaturating and CreateTruncated later, this looks good to me!

@tannergooding
Copy link
Member Author

CC. @MichalStrehovsky, @jeffhandley. NativeAOT seems to be unhappy with something here.

I'd guess its due to the first use of static virtual, but that is just a guess.

@tannergooding
Copy link
Member Author

Seems the compilation failures are a bit more widespread. CC @trylek and @davidwrighton

This is the first PR using the static virtuals feature via Roslyn. It seems various jobs are very unhappy with the IL.

@tannergooding
Copy link
Member Author

Likewise seems that Mono is doing odd things with IntPtr and overflow.

@tannergooding
Copy link
Member Author

The main issue looks to be:

System.NullReferenceException: Object reference not set to an instance of an object.
     at ILCompiler.DependencyAnalysis.ConstrainedMethodUseLookupResult.GetTarget(NodeFactory factory, GenericLookupResultContext dictionary) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericLookupResult.cs:line 1456
     at ILCompiler.DependencyAnalysis.ReadyToRunGenericHelperNode.InstantiateDependencies(NodeFactory factory, Instantiation typeInstantiation, Instantiation methodInstantiation) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReadyToRunGenericHelperNode.cs:line 167
     at ILCompiler.DependencyAnalysis.ShadowConcreteMethodNode.GetStaticDependencies(NodeFactory factory) in /_/src/coreclr/tools/Common/Compiler/DependencyAnalysis/ShadowConcreteMethodNode.cs:line 80
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1 node) in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 181
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 319
     at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan() in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs:line 140
     at ILCompiler.Program.Run(String[] args) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 828
     at ILCompiler.Program.Main(String[] args) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 1085

You can likewise see the below, where Linq is currently using generic math and so would trigger the use of static virtuals:

D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Debug\build\Microsoft.NETCore.Native.targets(270,5): error MSB3073: The command ""D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Debug\ilc\\ilc" @"D:\a\_work\1\s\artifacts\tests\coreclr/obj/windows.x64.Debug/Managed/.\build\/NativeAOTFX\System.Linq.ilc.rsp"" exited with code 57005. [D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Debug\build\BuildFrameworkNativeObjects.proj]
D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Debug\build\Microsoft.NETCore.Native.targets(270,5): error MSB3073: The command ""D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Debug\ilc\\ilc" @"D:\a\_work\1\s\artifacts\tests\coreclr/obj/windows.x64.Debug/Managed/.\build\/NativeAOTFX\System.Linq.Queryable.ilc.rsp"" exited with code 57005. [D:\a\_work\1\s\artifacts\bin\coreclr\windows.x64.Debug\build\BuildFrameworkNativeObjects.proj]

and another one:

EXEC : error : One or more errors occurred. (Code generation failed for method '[System.Linq]System.Linq.Enumerable.Sum<__Canon,int32,int32>(IEnumerable`1<__Canon>,Func`2<__Canon,int32>)') [D:\a\_work\1\s\src\coreclr\tools\aot\crossgen2\crossgen2.csproj]
##[error]EXEC(0,0): error : (NETCORE_ENGINEERING_TELEMETRY=Build) One or more errors occurred. (Code generation failed for method '[System.Linq]System.Linq.Enumerable.Sum<__Canon,int32,int32>(IEnumerable`1<__Canon>,Func`2<__Canon,int32>)')
  System.AggregateException: One or more errors occurred. (Code generation failed for method '[System.Linq]System.Linq.Enumerable.Sum<__Canon,int32,int32>(IEnumerable`1<__Canon>,Func`2<__Canon,int32>)')
   ---> ILCompiler.CodeGenerationFailedException: Code generation failed for method '[System.Linq]System.Linq.Enumerable.Sum<__Canon,int32,int32>(IEnumerable`1<__Canon>,Func`2<__Canon,int32>)'
   ---> System.NotImplementedException: The method or operation is not implemented.
     at ILCompiler.Compilation.ComputeConstantLookup(ReadyToRunHelperId lookupKind, Object targetOfLookup) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs:line 328
     at Internal.JitInterface.CorInfoImpl.ComputeLookup(CORINFO_RESOLVED_TOKEN& pResolvedToken, Object entity, ReadyToRunHelperId helperId, CORINFO_LOOKUP& lookup) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs:line 302
     at Internal.JitInterface.CorInfoImpl.getCallInfo(CORINFO_RESOLVED_TOKEN& pResolvedToken, CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken, CORINFO_METHOD_STRUCT_* callerHandle, CORINFO_CALLINFO_FLAGS flags, CORINFO_CALL_INFO* pResult) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs:line 1483
     at Internal.JitInterface.CorInfoImpl._getCallInfo(IntPtr thisHandle, IntPtr* ppException, CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken, CORINFO_METHOD_STRUCT_* callerHandle, CORINFO_CALLINFO_FLAGS flags, CORINFO_CALL_INFO* pResult) in /_/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs:line 2060
     --- End of inner exception stack trace ---
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL) in /_/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs:line 338
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs:line 63
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 190
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(MethodCodeNode methodCodeNodeNeedingCode) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 175
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
  --- End of stack trace from previous location ---
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
     at System.Threading.Tasks.TaskReplicator.Replica.Execute()
     --- End of inner exception stack trace ---
     at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure)
     at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
  --- End of stack trace from previous location ---
     at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
     at ILCompiler.RyuJitCompilation.CompileMultiThreaded(List`1 methodsToCompile) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 150
     at ILCompiler.RyuJitCompilation.ComputeDependencyNodeDependencies(List`1 obj) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 140
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in /_/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs:line 315
     at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper) in /_/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs:line 88
     at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper) in /_/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Compilation.cs:line 526
     at ILCompiler.Program.Run(String[] args) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 893
     at ILCompiler.Program.Main(String[] args) in /_/src/coreclr/tools/aot/ILCompiler/Program.cs:line 1085

@tannergooding
Copy link
Member Author

There are some Mono failures that look to be Mono related.

There are some 32-bit failures that look like an error in the test logic I wrote.

@MichalStrehovsky
Copy link
Member

CC. @MichalStrehovsky, @jeffhandley. NativeAOT seems to be unhappy with something here.

It's unhappy about the INumberBase.CreateChecked. It's a default interface method. I didn't realize we have static default interface methods (I thought that's what the WIP pull request #66887 is about?).

I'm looking into it. Does this need to go in Preview 5?

@tannergooding
Copy link
Member Author

It's unhappy about the INumberBase.CreateChecked. It's a default interface method. I didn't realize we have static default interface methods (I thought that's what the WIP pull request #66887 is about?).

During the last status sync it was indicated that things should be generally working with just a few remaining edge cases. Apparently those edges are a bit more visible than expected

I'm looking into it. Does this need to go in Preview 5?

The plan was for this to be in P5 yes. Worst case I'll need to remove the DIM and manually declare the implementation for all 20 types.

@tannergooding
Copy link
Member Author

Worst case I'll need to remove the DIM and manually declare the implementation for all 20 types.

I've done this with baf69de. You'll want to remember to revert this if trying to repro the failures above

@MichalStrehovsky
Copy link
Member

Worst case I'll need to remove the DIM and manually declare the implementation for all 20 types.

I've done this with baf69de. You'll want to remember to revert this if trying to repro the failures above

#69783 will also fix this from the NativeAOT side.

@tannergooding
Copy link
Member Author

@MichalStrehovsky there's another ILC failure. It's unclear what is causing this one:

/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : Error: [S.P.CoreLib]System.Runtime.InteropServices.NFloat._value [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build) Error: [S.P.CoreLib]System.Runtime.InteropServices.NFloat._value
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : System.NotImplementedException: [S.P.CoreLib]System.Runtime.InteropServices.NFloat._value [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build) System.NotImplementedException: [S.P.CoreLib]System.Runtime.InteropServices.NFloat._value
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.DependencyAnalysis.ReadyToRun.ModuleTokenResolver.GetModuleTokenForField(FieldDesc field, Boolean throwIfNotFound) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ModuleTokenResolver.cs:line 122 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.DependencyAnalysis.ReadyToRun.ModuleTokenResolver.GetModuleTokenForField(FieldDesc field, Boolean throwIfNotFound) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ModuleTokenResolver.cs:line 122
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.DependencyAnalysis.ReadyToRun.SignatureContext.GetModuleTokenForField(FieldDesc field, Boolean throwIfNotFound) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/SignatureContext.cs:line 86 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.DependencyAnalysis.ReadyToRun.SignatureContext.GetModuleTokenForField(FieldDesc field, Boolean throwIfNotFound) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/SignatureContext.cs:line 86
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.DependencyAnalysis.ReadyToRun.SignatureContext.GetTargetModule(FieldDesc field) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/SignatureContext.cs:line 71 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.DependencyAnalysis.ReadyToRun.SignatureContext.GetTargetModule(FieldDesc field) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/SignatureContext.cs:line 71
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.DependencyAnalysis.ReadyToRun.FieldFixupSignature.GetData(NodeFactory factory, Boolean relocsOnly) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/FieldFixupSignature.cs:line 42 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.DependencyAnalysis.ReadyToRun.FieldFixupSignature.GetData(NodeFactory factory, Boolean relocsOnly) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/FieldFixupSignature.cs:line 42
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.DependencyAnalysis.ReadyToRun.ImportSectionNode.MaterializeSignature(NodeFactory r2rFactory) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ImportSectionNode.cs:line 59 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.DependencyAnalysis.ReadyToRun.ImportSectionNode.MaterializeSignature(NodeFactory r2rFactory) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ImportSectionNode.cs:line 59
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.DependencyAnalysis.ReadyToRun.ImportSectionsTableNode.MaterializeSignature() in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ImportSectionsTableNode.cs:line 27 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.DependencyAnalysis.ReadyToRun.ImportSectionsTableNode.MaterializeSignature() in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ImportSectionsTableNode.cs:line 27
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.DependencyAnalysis.ReadyToRun.ManifestMetadataTableNode.ComputeLastSetOfModuleIndices() in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestMetadataTableNode.cs:line 198 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.DependencyAnalysis.ReadyToRun.ManifestMetadataTableNode.ComputeLastSetOfModuleIndices() in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestMetadataTableNode.cs:line 198
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.DependencyAnalysis.ReadyToRun.ManifestMetadataTableNode.GetManifestAssemblyMvidTableData() in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestMetadataTableNode.cs:line 311 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.DependencyAnalysis.ReadyToRun.ManifestMetadataTableNode.GetManifestAssemblyMvidTableData() in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestMetadataTableNode.cs:line 311
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.DependencyAnalysis.ReadyToRun.ManifestAssemblyMvidHeaderNode.GetData(NodeFactory factory, Boolean relocsOnly) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestAssemblyMvidHeaderNode.cs:line 58 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.DependencyAnalysis.ReadyToRun.ManifestAssemblyMvidHeaderNode.GetData(NodeFactory factory, Boolean relocsOnly) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ManifestAssemblyMvidHeaderNode.cs:line 58
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.DependencyAnalysis.ReadyToRunObjectWriter.EmitPortableExecutable() in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs:line 256 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.DependencyAnalysis.ReadyToRunObjectWriter.EmitPortableExecutable() in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs:line 256
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.ReadyToRunCodegenCompilation.Compile(String outputFile) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs:line 347 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.ReadyToRunCodegenCompilation.Compile(String outputFile) in /_/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs:line 347
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.Program.RunSingleCompilation(Dictionary`2 inFilePaths, InstructionSetSupport instructionSetSupport, String compositeRootPath, Dictionary`2 unrootedInputFilePaths, HashSet`1 versionBubbleModulesHash, CompilerTypeSystemContext typeSystemContext) in /_/src/coreclr/tools/aot/crossgen2/Program.cs:line 769 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.Program.RunSingleCompilation(Dictionary`2 inFilePaths, InstructionSetSupport instructionSetSupport, String compositeRootPath, Dictionary`2 unrootedInputFilePaths, HashSet`1 versionBubbleModulesHash, CompilerTypeSystemContext typeSystemContext) in /_/src/coreclr/tools/aot/crossgen2/Program.cs:line 769
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.Program.Run(String[] args) in /_/src/coreclr/tools/aot/crossgen2/Program.cs:line 545 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.Program.Run(String[] args) in /_/src/coreclr/tools/aot/crossgen2/Program.cs:line 545
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error :    at ILCompiler.Program.Main(String[] args) in /_/src/coreclr/tools/aot/crossgen2/Program.cs:line 1055 [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(463,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build)    at ILCompiler.Program.Main(String[] args) in /_/src/coreclr/tools/aot/crossgen2/Program.cs:line 1055
/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(351,5): error NETSDK1096: Optimizing assemblies for performance failed. You can either exclude the failing assemblies from being optimized, or set the PublishReadyToRun property to false. [/Users/runner/work/1/s/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.sfxproj]
##[error]artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets(351,5): error NETSDK1096: (NETCORE_ENGINEERING_TELEMETRY=Build) Optimizing assemblies for performance failed. You can either exclude the failing assemblies from being optimized, or set the PublishReadyToRun property to false.

@MichalStrehovsky
Copy link
Member

@MichalStrehovsky there's another ILC failure. It's unclear what is causing this one:

That one is crossgen2 (/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets)

@tannergooding
Copy link
Member Author

That one is crossgen2 (/Users/runner/work/1/s/artifacts/bin/Crossgen2Tasks/Debug/net7.0/Microsoft.NET.CrossGen.targets)

Is there a good way to debug into this. It looks like an opaque MSBuild task and not some command line I can just run with an attached debugger.

@MichalStrehovsky
Copy link
Member

Is there a good way to debug into this. It looks like an opaque MSBuild task and not some command line I can just run with an attached debugger.

@dotnet/crossgen-contrib might help.

But it looks like the task dumps a response file somewhere and invokes crossgen2 with the response file.

@tannergooding
Copy link
Member Author

Crossgen2 seems to be unhappy with some of the existing [NonVersionable] that was on NFloat now that its being used from System.Runtime.Numerics.

I've removed the attributes.

@jkotas
Copy link
Member

jkotas commented May 25, 2022

Crossgen2 seems to be unhappy with some of the existing [NonVersionable] that was on NFloat now that its being used from System.Runtime.Numerics.

We should get an issue opened on this if you plan to merge this workaround.

@lewing
Copy link
Member

lewing commented May 26, 2022

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@premun
Copy link
Member

premun commented May 26, 2022

/azp run

@azure-pipelines
Copy link

You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

Comment on lines 603 to 604
// specially handle NaN otherwise we return (Int64.MaxValue + 1)
ret = 0;
Copy link
Member Author

@tannergooding tannergooding May 27, 2022

Choose a reason for hiding this comment

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

This was being incorrectly handled resulting in invalid results for Arm32.

This entire method could likely be simplified to just (UINT64)val like I had prototyped in #61761, but it should be handled in a separate PR.

I'd like to actually get #61761 completed and in, but its likely too late in the cycle for .NET 7 to take such a big "break". It was effectively "done" other than the Mono work and perf cleanup to avoid calls on x64.

Copy link
Member Author

Choose a reason for hiding this comment

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

Reverted this in favor of just explicitly checking for NaN and returning 0 in the relevant APIs to simplify code churn for the time being.

@tannergooding
Copy link
Member Author

Failure is unrelated: #60705

@tannergooding tannergooding merged commit 748dfb7 into dotnet:main May 28, 2022
@tannergooding
Copy link
Member Author

/backport release/7.0-preview5

@tannergooding
Copy link
Member Author

/backport to release/7.0-preview5

@github-actions
Copy link
Contributor

Started backporting to release/7.0-preview5: https://github.com/dotnet/runtime/actions/runs/2416671628

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants