-
Notifications
You must be signed in to change notification settings - Fork 197
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
Add project for LLVM backend (supports Wasm) #247
Conversation
src/libraries/Directory.Build.props
Outdated
<ToolRuntimeRID Condition="'$(RuntimeOS)' == 'browser' and '$(TargetOS)' != 'windows' and !$(_buildingInOSX)">linux-x64</ToolRuntimeRID> | ||
|
||
<!-- this line seems to cause a failure with _SuppressSdkImports . Doesn't make sense to me --> | ||
<!-- <ToolRuntimeRID Condition="'$(RuntimeOS)' == 'browser' and '$(TargetOS)' != 'windows' and !$(_buildingInOSX)" and !$(_buildingInWindows)">linux-x64</ToolRuntimeRID> --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this. The condition shouldn't even be met as buildingInWindows
is true so why it causes an error I don't know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it may a problem with evaluation order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging the latest got rid of this
I'm going to release this now for review. Sorry it's rather long. If you want to know what each change fixes I can revert it and show the error. It will publish and run the Samples\HelloWorld (with https://github.com/dotnet/runtimelab/pull/247/files#diff-95c7fc3099f2a4f95cd78e2aae618395f1a7aef4e88e34d30d957f4814bf688e) and that's as far as I've taken it. Once it goes in I could either:
|
eng/native/build-commons.ps1
Outdated
@@ -0,0 +1,21 @@ | |||
if ( -not (Test-Path -LiteralPath $Env:__versionSourceFile)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's wrong with the default version.c/.h generation that you had to duplicate it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted. Whatever reason I had has gone.
eng/native/configurecompiler.cmake
Outdated
# The -fms-extensions enable the stuff like __if_exists, __declspec(uuid()), etc. | ||
add_compile_options(-fms-extensions) | ||
add_compile_options(-Wno-invalid-offsetof) | ||
add_compile_options(-Wno-tautological-undefined-compare) # this == NULL warning suppression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that we have cleaned up all these in dotnet/runtime. Are these warning suppressions and -fms-extension
really required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ms-extensions
I believe is preventing
In file included from E:\GitHub\runtimelab\src\coreclr\src\nativeaot\Runtime\allocheap.cpp:9:
E:/GitHub/runtimelab/src/coreclr/src/nativeaot/Runtime/./PalRedhawk.h:658:1: error: unknown type name '__forceinline'
__forceinline
^
In file included from E:\GitHub\runtimelab\src\coreclr\src\nativeaot\Runtime\allocheap.cpp:9:
In file included from E:/GitHub/runtimelab/src/coreclr/src/nativeaot/Runtime/./PalRedhawk.h:873:
-Wno-invalid-offsetof
is stopping:
In file included from E:\GitHub\runtimelab\src\coreclr\src\nativeaot\Runtime\allocheap.cpp:21:
E:/GitHub/runtimelab/src/coreclr/src/nativeaot/Runtime/./slist.inl:41:54: warning: offset of on non-standard-layout type 'AllocHeap::BlockListElem' [-Winvalid-offsetof]
return dac_cast<PTR_PTR_T>(dac_cast<TADDR>(pT) + offsetof(T, m_pNext));
^ ~~~~~~~
E:\GitHub\emsdk\upstream\emscripten\system\include\libc\stddef.h:20:32: note: expanded from macro 'offsetof'
#define offsetof(type, member) __builtin_offsetof(type, member)
^ ~~~~~~
E:/GitHub/runtimelab/src/coreclr/src/nativeaot/Runtime/./slist.inl:245:14: note: in instantiation of member function 'DefaultSListTraits<AllocHeap::BlockListElem, DoNothingFailFastPolicy>::GetNextPtr' requested here
*Traits::GetNextPtr(pItem) = *m_ppCur;
^
E:/GitHub/runtimelab/src/coreclr/src/nativeaot/Runtime/./slist.inl:85:13: note: in instantiation of member function 'SList<AllocHeap::BlockListElem, DefaultSListTraits<AllocHeap::BlockListElem, DoNothingFailFastPolicy>>::Iterator::Insert' requested here
Begin().Insert(pItem);
^
E:\GitHub\runtimelab\src\coreclr\src\nativeaot\Runtime\allocheap.cpp:100:17: note: in instantiation of member function 'SList<AllocHeap::BlockListElem, DefaultSListTraits<AllocHeap::BlockListElem, DoNothingFailFastPolicy>>::PushHead' requested here
m_blockList.PushHead(pBlock);
^
1 warning generated.
-Wno-tautological-undefined-compare
is for:
E:\GitHub\runtimelab\src\coreclr\src\nativeaot\Runtime\eetype.cpp:24:9: warning: 'this' pointer cannot be null in well-defined C++ code; comparison may be assumed to always evaluate to false [-Wtautological-undefined-compare]
if (this == NULL)
^~~~ ~~~~
1 warning generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. These and warning options are in this file under CLR_CMAKE_HOST_UNIX
. Would it make sense to change the condition on that block to !MSVC or something similar instead of duplicating them here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, moved as suggested to not duplicate.
eng/native/gen-buildsys.cmd
Outdated
@@ -24,12 +24,13 @@ set __Arch=%4 | |||
set __CmakeGenerator=Visual Studio | |||
set __UseEmcmake=0 | |||
if /i "%__Ninja%" == "1" ( | |||
echo using Ninja |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these echo statements needed? If yes, the alignment is off for this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, missed this one, deleted.
src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems
Show resolved
Hide resolved
src/libraries/Directory.Build.props
Outdated
<ToolRuntimeRID Condition="'$(RuntimeOS)' == 'browser' and '$(TargetOS)' != 'windows' and !$(_buildingInOSX)">linux-x64</ToolRuntimeRID> | ||
|
||
<!-- this line seems to cause a failure with _SuppressSdkImports . Doesn't make sense to me --> | ||
<!-- <ToolRuntimeRID Condition="'$(RuntimeOS)' == 'browser' and '$(TargetOS)' != 'windows' and !$(_buildingInOSX)" and !$(_buildingInWindows)">linux-x64</ToolRuntimeRID> --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it may a problem with evaluation order.
Could you please also update pre-release label as described in https://github.com/dotnet/runtimelab/blob/master/CreateAnExperiment.md so that the packages do not clash? |
Merge remote-tracking branch 'origin/feature/NativeAOT-LLVM' into llvm-rename # Conflicts: # src/coreclr/dir.common.props # src/libraries/Directory.Build.props
src/libraries/Directory.Build.props
Outdated
@@ -256,4 +256,7 @@ | |||
<CLSCompliant Condition="'$(CLSCompliant)' == ''">true</CLSCompliant> | |||
</PropertyGroup> | |||
|
|||
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(TargetOS)' == 'Browser'"> <!-- the Unix versions are used without this override --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the actual problem a bug in eng\Configurations.props
?
I think the block in Configurations.props should be something like:
<!-- There are no WebAssembly tools, so use the default ones -->
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser'">linux-x64</_toolRuntimeRID>
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and $([MSBuild]::IsOSPlatform('WINDOWS'))">win-x64</_toolRuntimeRID>
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and $([MSBuild]::IsOSPlatform('OSX'))">osx-x64</_toolRuntimeRID>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that looks better. Admittedly I don't know my way around the build files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition should be using the OS that the build is running on.
TargetOS should mean the OS we are compiling for, everywhere in the build system. If TargetOS means the OS that the build is running in some places, I think we should fix those place.
mono's lead on making 'is browser' decision
I am not sure what this means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TargetOS is not browser on mono when we are building for wasm today
Is it really the case? There are number of places under libraries that compare TargetOS with Browser, one example from many: https://github.com/dotnet/runtime/blob/master/src/libraries/System.Diagnostics.StackTrace/tests/System.Diagnostics.StackTrace.Tests.csproj#L16
If the TargetOS was not set correct for Browser, all these places would be broken.
In any case, I think it is a good idea to keep fixing places that use wrong meaning of TargetOS.
eng/Versions.props
Outdated
@@ -6,7 +6,7 @@ | |||
<MajorVersion>6</MajorVersion> | |||
<MinorVersion>0</MinorVersion> | |||
<PatchVersion>0</PatchVersion> | |||
<PreReleaseVersionLabel>alpha</PreReleaseVersionLabel> | |||
<PreReleaseVersionLabel>llvm</PreReleaseVersionLabel> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have realized that this won't be sufficient to avoid collisions given how nuget works and how things are setup currently.
The problem is what PackageReference Include="Microsoft.DotNet.ILCompiler" Version="6.0.0-*"
package reference is going to pick up the latest *
that will be llvm
once this starts publishing.
I think it will be best to use different package name for this branch, like Microsoft.DotNet.ILCompiler.LLVM
.
Could you please rename Microsoft.DotNet.ILCompiler
to Microsoft.DotNet.ILCompiler.LLVM
under src\installer\pkg\projects
? (Both directory names and references in sources.)
There may be a few other places througout the tree that may need similar rename.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, is the label change now superfluous ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - if you change the package name, it is not necessary to change the label.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I've gone overboard on this, I renamed the targets file and the pkgproj.
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and '$(TargetOS)' == 'windows'">win-x64</_toolRuntimeRID> | ||
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and '$(TargetOS)' != 'windows' and $(_buildingInOSX)">osx-x64</_toolRuntimeRID> | ||
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and '$(TargetOS)' != 'windows' and !$(_buildingInOSX)">linux-x64</_toolRuntimeRID> | ||
<_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser'">linux-x64</_toolRuntimeRID> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it works, it would be nice to submit this to dotnet/runtime. Also, the Android block below should get the same fix.
@@ -158,7 +158,8 @@ set __generatorArgs= | |||
if [%__Ninja%] == [1] ( | |||
set __generatorArgs= | |||
) else if [%__BuildArch%] == [wasm] ( | |||
set __generatorArgs=-j | |||
rem nmake does support -j |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can also be done in dotnet/runtime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you!
Thanks for all the help. |
No description provided.