Repository navigation
series: honor ExtendedVolatileMetadata ranges and whole-module entries (0013) - #13
Draft
utkarshdalal wants to merge 3 commits into
Draft
utkarshdalal wants to merge 3 commits into
utkarshdalal wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds patch 0013.
SERIES_VERSION8.Problem
On current builds a
FEX_EXTENDEDVOLATILEMETADATArange or whole-module entry does nothing. Since FEX-2608 (852e93a)GenerateIRrelaxes a block only when the block lies in a metadata range and a listed instruction lies inside the block; every other block keeps full TSO. That fits PE volatile metadata, where the listed instructions are the ones the compiler marked. Option entries such asUnityPlayer.dll;<begin>-<end>or a bareUnityPlayer.dlllist no instructions, so no block qualifies. On 2605 they only worked through a past-the-end read of the instruction set, and only for the module mapped at the highest address.Turning the condition off everywhere would also relax every module that ships PE volatile metadata, which is what 0005 (Counter-Strike 2) had to deal with.
Change
AddTSODisabledRanges). PE metadata still goes only into the existing list.FLAG_FORCE_TSO) keep TSO, and 0005'sdmb ishldstill goes in front of them when a plain load comes first. Vector accesses followVectorTSOEnabledas before.rep movs/stosand x87 read the context setting directly and are not affected.Identity guard
Matching by file name alone means a game update that ships a different DLL under the same name would get the old entry. Upstream 3c0410e (2607) already accepts a module's image ID as a key:
<lowercase file name>-<16 hex digits>, where the digits areXXH3_64(lowercase name) ^ (SizeOfImage << 32 | TimeDateStamp), the same ID the code cache uses and theLoad modulelog line prints. The patch uses that key rather than adding new syntax. It also adds:Example, Unity 2022.3.62f2 (
TimeDateStamp0x68d678af,SizeOfImage0x1e65000):Entries without an ID keep their current meaning. The name-only lookup stays case sensitive against the loaded path, as upstream has it. The config description documents both forms.
Environment size
On arm64ec and WoW64,
LoadConfigreads the option from the CRT_environinto afextl::stringand parses it with string views. No fixed-size buffer sits on this path. A few ranges come to about 150 characters, far below the 32,767-character Windows variable limit.Tested
unittests/APITests/ExtendedVolatileMetadata.cpp: ID-key parse, another build of the same module (IsOtherImageIdOfModule), RVA-to-address mapping, a straddling block not covered, a range past the module end dropped, a whole-module entry, and listed instructions still reaching the PE-metadata lists. The existing grammar cases are unchanged. All 14 cases pass when compiled locally with clang against this tree. CI here does not build tests (BUILD_TESTING=False).git amon fresh FEX-2611 and FEX-2611.1 checkouts. CI now picks FEX-2611.1, the newest tag; it changed the volatile-metadata block inImageTracker.cpp(0ec72ac gates it onVolatileMetadata). The new ImageTracker hunk sits where both tags agree and checks the same option.workflow_dispatchrun withupstream_ref=FEX-2611. The FEX-2611 artifact differs from the shipped2611-gn-7only by this patch.Not run on a device yet. The device check: confirm the
appliedline, then count ordered and plain accesses in one translated block inside a configured range, with and without the env var.Device result
AYN Odin 3 (Snapdragon 8 Elite), arm64ec Proton, manual CI build
FEXCore-2611-gn8-e18178c-0(FEX-2611 + this series, so it differs from 2611-gn-7 by this patch only), installed as a FEX package, one Unity 2022.3 game, 3 minutes of gameplay with a controller.ExtendedVolatileMetadata: applied unityplayer.dll-5695747efd732d16 to UnityPlayer.dll at 5FFA7F0000.