microsoft / microsoft/STL

`CMakeLists.txt`: Should we add `/volatileMetadata-` for x86 and x64?

Open
#2,463 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance
Dominant language
C++
Stars
11.2k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

There's an undocumented /volatileMetadata option.

All I know about it is from DevCom-1538997 resolution:

The nops get inserted because of the flag /volatileMetadata which is now on by default. You can return to the old behavior by adding /volatileMetadata-, but doing so will result in worse performance if your code is ever run emulated. It’ll still be emulated correctly, but the emulator will have to pessimistically assume every load/store needs a barrier.

My understanding is that the usual x86 / x64 MSVC STL builds are not supposed to run on ARM, because there are ARM64EC builds for that.

OTOH, the impact from extra nop and binary size growth due to extra metadata is minimal and the impact from /volatileMetadata- load barriers I think is high. So probably adding /volatileMetadata- isn't worth doing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing CMakeLists.txt and the MSVC configuration for x86 and x64 builds. Read the linked /volatileMetadata and ARM64EC references to understand the performance tradeoff, then determine whether adding /volatileMetadata- is appropriate; done means reaching and documenting a decision for the affected configurations.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.