Skip to content

Conversation

@StephanTLavavej
Copy link
Member

This ports Microsoft-internal MSVC-PR-279169, which merged accumulated work from the compiler back-end team in their prod/be MSVC branch. After applying the git diff --binary patch with no conflicts or manual edits, I verified that the GitHub and MSVC repos are binary-identical. (Note that I did not copy-overwrite, which would pick up unintentional divergence; this was a proper patch, as always.)

@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Oct 5, 2020
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner October 5, 2020 19:38
stl/msbuild/stl_2/md/msvcp_2_app/msvcp_2.nativeproj
Fix indentation.

stl/msbuild/stl_atomic_wait/stl_atomic_wait.files.settings.targets
Strip trailing whitespace.

stl/src/special_math.cpp
Cleanup comments.
#undef new

#if (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE) && !defined(_M_HYBRID)
#if (defined(_M_IX86) || defined(_M_X64) && !defined(_M_ARM64EC)) && !defined(_M_CEE_PURE) && !defined(_M_HYBRID)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think either _M_HYBRID should moved to be next to _M_IX86 or _M_ARM64EC should be moved to the end of this line.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree. I'm going to go ahead and merge this PR because getting MSVC and GitHub back in sync is critical, but I'll investigate this for a followup PR (while I am generally reluctant to mess with this stuff, this seems fairly straightforward and if it causes problems they will be immediately obvious, hopefully).

// Do not include or define anything else here.
// In particular, basic_string must not be included here.
#if (defined(_M_IX86) || defined(_M_X64)) && !defined(_M_CEE_PURE)
#if (defined(_M_IX86) || defined(_M_X64) && !defined(_M_ARM64EC)) && !defined(_M_CEE_PURE)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm vaguely surprised that this line doesn't require a !defined(_M_HYBRID). Maybe I'm missing something in my mental model on how ARM64EC is supposed to work.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the reason is that vector_algorithms.cpp was added to the list of files to compile for EC, but I bet it's not being compiled at all for Hybrid. (My understanding of these is near-zero.) I can investigate this as a cleanup for a later PR.

@StephanTLavavej StephanTLavavej merged commit b1ed29c into microsoft:master Oct 5, 2020
@StephanTLavavej StephanTLavavej deleted the msvc_merge branch October 5, 2020 23:18
StephanTLavavej added a commit to StephanTLavavej/STL that referenced this pull request Oct 6, 2020
@MikeGitb
Copy link

MikeGitb commented Oct 6, 2020

Not complaining or anything, but adding a short description of what the patch does in the comit message for people that don't have access to the internal repository would be nice.

@StephanTLavavej
Copy link
Member Author

Yeah, I really phoned it in on this one, sorry about that. I tried to summarize the story in this PR's description (we've generally been writing detailed PR descriptions, but not copying them to commit messages, under the theory that the PR number is enough to find the details) but even that summary is very vague - because I understood few of the details myself.

The background is that the MSVC-internal repo has two major branches, prod/fe where the compiler front-end and libraries team work (the STL constantly needs new FE features and fixes so we work together), while prod/be is where the compiler back-end team (codegen, optimization, linking, etc.) works. The microsoft/STL repo is constantly in sync with prod/fe, but merges with prod/be happen infrequently. We generally ask that any changes affecting the STL be performed in prod/fe so we can sync them up immediately (code divergence is concerning; nobody worries about it more than I do), but in this case the back-end team needed to do major work with peripheral STL impact so it made sense to do it in their branch.

After porting this today, I asked the BE devs for more info, so now I understand it in a little more detail than "mysterious architecture macros" which was my earlier understanding. This is related to the x64 emulation on ARM64 that we announced last week; EC means "emulation compatible". There are a lot of changes to the MS-internal build system here (which don't yet affect the GitHub CMake/Ninja build system because our migration work is ongoing - we would like to stop using MSBuild as soon as possible but C++20 is keeping us busy) and a few changes to product code, especially where intrinsics are involved (e.g. even when emulating code with compiler magic, atomics really need to care about ARM64's memory model).

@MikeGitb
Copy link

MikeGitb commented Oct 6, 2020

Yeah, I really phoned it in on this one, sorry about that.

No worries, I was just curious.

You can probably not give an answer to this, but that sounds as if one would have to compile in a special mode, if a program is supposed to run on a Windows on ARM device via x64 Emulation, which would kind of defeat the purpose of the emulation. Or is this behind a runtime dispatcher?

@StephanTLavavej
Copy link
Member Author

I am far from qualified to answer that, but my understanding is that "normal" x64 programs will automatically work; this ARM64EC stuff is intended for OS binaries and libraries like the STL that need to do special things like atomics. (Observe that the vast majority of the STL's code doesn't care about this macro, just 32/64-bit.)

This was referenced Oct 7, 2020
StephanTLavavej added a commit to StephanTLavavej/STL that referenced this pull request Oct 8, 2020
Followup to microsoftGH-1344.

Code review feedback.
This was referenced Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants