Skip to content
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

Windows ARM64 and CORECLR_PROFILER_PATH_xxx #39699

Open
ww898 opened this issue Jul 21, 2020 · 8 comments
Open

Windows ARM64 and CORECLR_PROFILER_PATH_xxx #39699

ww898 opened this issue Jul 21, 2020 · 8 comments
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-Diagnostics-coreclr feature-request
Milestone

Comments

@ww898
Copy link
Contributor

ww898 commented Jul 21, 2020

Hi Everybody,

Windows ARM64 has 3 architecture in installation: ARM64, ARM and x86. My question is about CORECLR_PROFILER_PATH_32. How can I select separate profiler DLLs for x86 and ARM architectures?

Can CoreCLR team implement something like CORECLR_PROFILER_PATH_ARM, CORECLR_PROFILER_PATH_X86 and CORECLR_PROFILER_PATH_ARM64 or you already have better solution?

@ww898 ww898 added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label Jul 21, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-Diagnostics-coreclr untriaged New issue has not been triaged by the area owner labels Jul 21, 2020
@ghost
Copy link

ghost commented Jul 21, 2020

Tagging subscribers to this area: @tommcdon
Notify danmosemsft if you want to be subscribed.

@tommcdon
Copy link
Member

@davmason

@tommcdon tommcdon removed the untriaged New issue has not been triaged by the area owner label Jul 21, 2020
@tommcdon tommcdon added this to the 5.0.0 milestone Jul 21, 2020
@davmason
Copy link
Member

Hi @ww898,

Our team is not currently working on anything like this, and the soonest it would be scheduled is the .net 6 timeframe (although it could be later). As always we are happy to accept community patches. FYI the .net 5 release is quickly wrapping up, we are already past feature release and this sort of change would only reliably get in for the next month or so.

I would have to think about the design of this a little more. The issue is that as far as I know the runtime is unaware when it's operation in x86 emulation on arm vs running natively on x86 hardware. My suspicion is that adding one variable would be enough, since CORECLR_PROFILER_PATH_64 and CORECLR_PROFILER_PATH_32 should work as expected when running arm native apps. It's only the x86 emulation part that would need a special variable.

@jkotas
Copy link
Member

jkotas commented Jul 24, 2020

x64 emulation on ARM64 means that 64-bit can be either emulated x64 or native ARM64.

@tommcdon tommcdon modified the milestones: 5.0.0, 6.0.0 Jul 30, 2020
@ww898
Copy link
Contributor Author

ww898 commented Jan 11, 2021

Hi @noahfalk,

I would like to make the situation a little bit clear for Apple Silicon M1 computers. As I know .NET 5.0 is waiting some fixes from macOS Big Sur to run under Rosetta 2. My question is about activation. Probably, It will be required in nearest future to run .NET5 x64 + Rosetta 2 and .NET6 arm64 on the same macOS computer. Am I right if expect the CORECLR_PROFILER_PATH_<arch> support will be included in nearest .NET5?

Thanks in advance!

P.S. I will be happy to create the pull request if you give me more information about technical details.

@davmason davmason modified the milestones: 6.0.0, Future Jan 11, 2021
@davmason
Copy link
Member

There hasn't been any work on this issue yet. If you are willing to put together a PR for inclusion in 6.0, it should be fairly simple.

You would add two more variables CORECLR_PROFILER_PATH_ARM32 and CORECLR_PROFILER_PATH_ARM64 here:

RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_CORECLR_PROFILER_PATH, W("CORECLR_PROFILER_PATH"), "CoreCLR only: Specifies the path to the DLL of profiler to load into currently running process", CLRConfig::DontPrependCOMPlus_)
RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_CORECLR_PROFILER_PATH_32, W("CORECLR_PROFILER_PATH_32"), "CoreCLR only: Specifies the path to the DLL of profiler to load into currently running 32 process", CLRConfig::DontPrependCOMPlus_)
RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_CORECLR_PROFILER_PATH_64, W("CORECLR_PROFILER_PATH_64"), "CoreCLR only: Specifies the path to the DLL of profiler to load into currently running 64 process", CLRConfig::DontPrependCOMPlus_)

And then update here to use the new variables if the runtime is natively targeting ARM32/ARM64:

#ifdef TARGET_64BIT
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_64, &wszProfilerDLL));
#else
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH_32, &wszProfilerDLL));
#endif
if(wszProfilerDLL == NULL)
{
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH, &wszProfilerDLL));
}

The logic should be if targeting ARM natively use the ARM32/ARM64 variables first, then use the CORECLR_PROFILER_PATH_32/64 variable only if the previous ones aren't set, then use CORECLR_PROFILER_PATH only if all of the previous ones aren't set.

I would really like to avoid adding environtment variables for every architecture we target, this way when running on ARM32/64 you can set CORECLR_PROFILER_PATH_32/64 to target the profiler in emulation and CORECLR_PROFILER_PATH_ARM32/ARM64 to target the profiler running natively.

@ww898
Copy link
Contributor Author

ww898 commented Jan 12, 2021

Hi @davmason,

As I understand, we should always use and declare in future both environment variables CORECLR_PROFILER_PATH_64 and CORECLR_PROFILER_PATH_ARM64 under Windows ARM64 and macOS ARM64 because the profiler doesn't know if the user's .NET applications will be started under an emulation or run as a native application. Is it correct?

@davmason
Copy link
Member

Right, that is the expectation if you need to profile both native ARM32/ARM64 and emulated x86/x64.

davmason pushed a commit that referenced this issue Feb 18, 2021
… and x86+arm) on Windows ARM64 and macOS Apple Silicon. #39699 (#46868)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-Diagnostics-coreclr feature-request
Projects
None yet
Development

No branches or pull requests

6 participants