Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

[x86] Do not support hardware intrinsics on x86 unix #21164

Merged
merged 1 commit into from
Nov 26, 2018
Merged

[x86] Do not support hardware intrinsics on x86 unix #21164

merged 1 commit into from
Nov 26, 2018

Conversation

kvochko
Copy link

@kvochko kvochko commented Nov 22, 2018

On x86 unix jit is compiled without hardware intrinsic support

if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR (CLR_CMAKE_TARGET_ARCH_I386 AND NOT CLR_CMAKE_PLATFORM_UNIX))

but System.Private.CoreLib is built with it. This leads to errors, like:

GC/API/GCHandle/Alloc_neg2/Alloc_neg2.sh
               BEGIN EXECUTION
               /dotnet/corert/tests/../Tools/msbuild.sh /m /p:IlcPath=/dotnet/corert/tests/../bin/Linux.armel.Debug /p:IlcTarget=armel /p:LinkerFlags=-target arm-linux-gnueabi --sysroot=/dotnet/corert/tests/../cross/rootfs/armel -B/dotnet/corert/tests/../cross/rootfs/armel/usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1 -L/dotnet/corert/tests/../cross/rootfs/armel/usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1 -lssl -lcrypto -lkeyutils -v -Wl,-v /p:Configuration=Debug Test.csproj
               Microsoft (R) Build Engine version 15.8.166+gd4e8d81a88 for .NET Core
               Copyright (C) Microsoft Corporation. All rights reserved.
               
                 /usr/bin/clang-3.9
                 Generating native code
                 
                 Unhandled Exception: System.InvalidProgramException: The JIT compiler encountered invalid IL code or an internal limitation.
                    at System.Runtime.Intrinsics.X86.Lzcnt.get_IsSupported()
                    at System.Buffers.Utilities.SelectBucketIndex(Int32 bufferSize)
                    at System.Buffers.TlsOverPerCoreLockedStacksArrayPool`1.Rent(Int32 minimumLength)
                    at System.Text.ValueUtf8Converter.ConvertAndTerminateString(ReadOnlySpan`1 value)
                    at Interop.Sys.Stat(ReadOnlySpan`1 path, FileStatus& output)
                    at System.IO.FileSystem.FileExists(ReadOnlySpan`1 fullPath, Int32 fileType, ErrorInfo& errorInfo)
                    at System.IO.FileSystem.FileExists(ReadOnlySpan`1 fullPath)
                    at System.IO.File.Exists(String path)
                    at System.CommandLine.ArgumentSyntax.ParseResponseFile(String fileName)
                    at System.CommandLine.ArgumentLexer.ExpandResponseFiles(IEnumerable`1 args, Func`2 responseFileReader)+MoveNext()
                    at System.CommandLine.ArgumentLexer.Lex(IEnumerable`1 args, Func`2 responseFileReader)
                    at System.CommandLine.ArgumentParser..ctor(IEnumerable`1 arguments, Func`2 responseFileReader)
                    at System.CommandLine.ArgumentSyntax.get_Parser()
                    at System.CommandLine.ArgumentSyntax.DefineOption[T](String name, T defaultValue, Func`2 valueConverter)
                    at System.CommandLine.ArgumentSyntax.DefineOption[T](String name, T& value, Func`2 valueConverter, String help)
                    at System.CommandLine.ArgumentSyntax.DefineOption(String name, Boolean& value, String help)
                    at ILCompiler.Program.<>c__DisplayClass44_0.<ParseCommandLine>b__0(ArgumentSyntax syntax)
                    at System.CommandLine.ArgumentSyntax.Parse(IEnumerable`1 arguments, Action`1 defineAction)
                    at ILCompiler.Program.ParseCommandLine(String[] args)
                    at ILCompiler.Program.Run(String[] args)
                    at ILCompiler.Program.Main(String[] args)
                 Aborted (core dumped)

This change disables support for hardware intrinsics in System.Private.CoreLib on x86 Unix.

@tannergooding
Copy link
Member

tannergooding commented Nov 22, 2018

What is currently broken if we do the reverse and just enable them on x86 Unix? Do any tests fail?

@kvochko
Copy link
Author

kvochko commented Nov 22, 2018

This was the commit that originally disabled them - #8335, other than that I haven't looked much into it. @parjong do you know if the issues that required disabling them were resolved? Anyway I will try to run tests soon to see if there is any regression with intrinsics enabled.

@tannergooding
Copy link
Member

Thanks! It would be nice if we had an issue tracking this if it turns out to not work, otherwise LGTM.

@tannergooding
Copy link
Member

CC. @CarolEidt, @fiigii

@fiigii
Copy link

fiigii commented Nov 22, 2018

Hardware intrinsic is supported by x86/windows. Is there any plan to enable it on x86/Unix in the future?

@parjong
Copy link

parjong commented Nov 24, 2018

@kvochko I can't remember the exact reason, but it took too much effort to enable AVX at that time. I'm not sure about the current status :)

@kvochko
Copy link
Author

kvochko commented Nov 26, 2018

Ok, thanks! @fiigii I'm not aware of such plans, but I've opened an issue to track the fact that they are disabled

Copy link

@fiigii fiigii left a comment

Choose a reason for hiding this comment

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

Thanks, the change looks good.

Copy link

@CarolEidt CarolEidt left a comment

Choose a reason for hiding this comment

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

LGTM

@CarolEidt CarolEidt merged commit 4a9b573 into dotnet:master Nov 26, 2018
@kvochko kvochko deleted the no_hw_intrinsics_x86 branch November 27, 2018 10:32
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…_x86

[x86] Do not support hardware intrinsics on x86 unix

Commit migrated from dotnet/coreclr@4a9b573
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants