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

Hardware Acceleration is not enabled on AMD system. #1000

Closed
pilcherd opened this issue Oct 14, 2022 · 12 comments · Fixed by #1003
Closed

Hardware Acceleration is not enabled on AMD system. #1000

pilcherd opened this issue Oct 14, 2022 · 12 comments · Fixed by #1003
Assignees
Labels
dotnet-maui/tech dotnet-mobile/prod Pri1 High priority, do before Pri2 and Pri3 support-request Support-style question;customer needs help solving a problem [org]

Comments

@pilcherd
Copy link

pilcherd commented Oct 14, 2022

This page indicates that "After Hyper-V is enabled, you'll be able to run your accelerated Android emulator."

This is when using "Microsoft's Hyper-V and the Windows Hypervisor Platform (WHPX)."

The top table shows AMD processors X.

It even says "For the best experience on Windows, it's recommended you use WHPX to accelerate the Android emulator." I.e. it's better than HAXM... and the WHPX shows it supports AMD processors.

And yet when I have this setup, the emulator is not accelerated. Using troubleshooting, indicates:

"C:\Users\DavidP>"C:\Program Files (x86)\Android\android-sdk\emulator\emulator-check.exe" accel
accel:
3
Android Emulator requires an Intel processor with VT-x and NX support. Your CPU: 'AuthenticAMD'
accel"

So, the current emulator appears to require an Intel processor, but this document indicates it doesn't.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

@dotnet-bot dotnet-bot added the ⌚ Not Triaged Not triaged label Oct 14, 2022
@issues-automation issues-automation bot added dotnet-maui/tech dotnet-mobile/prod Pri1 High priority, do before Pri2 and Pri3 labels Oct 14, 2022
@adegeo adegeo added the support-request Support-style question;customer needs help solving a problem [org] label Oct 14, 2022
@dotnet-bot dotnet-bot removed the ⌚ Not Triaged Not triaged label Oct 14, 2022
@adegeo
Copy link
Contributor

adegeo commented Oct 14, 2022

Reading through the article and also looking at Androids emulation setup articles it seems that those tools check for HAXM or for Android's AMD hypervisor, but not for Window's hypervisor. If you follow the instructions for enabling hyper-v and enabling the virtualization modes in the BIOS, your emulator should be accelerated.

The fact that you got that error message (saying you're using an AMD machine) would indicate you don't have hyper-v installed. When I run it (I'm using AMD) I get this, meaning, hyper-v is blocking android's check tool:

C:\Windows\system32>"C:\Program Files (x86)\Android\android-sdk\emulator\emulator-check.exe" accel
accel:
0
Please disable Hyper-V before using the Android Emulator.  Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.WHPX (10.0.22000) is installed and usable.
accel

EDIT
I just noticed at the end of that message I do see WHPX (10.0.22000) is installed and usable. but it seems to be missing a new line so it looks like it's part of the message indicating you MUST disable Hyper-V. Yes you must disable Hyper-V if you want to use HAXM/Android AMD... but if WHPX is installed and usable then it should be fine, you don't need to go the HAXM/Android AMD route...

It also looks like you can use emulator-check.exe hyper-v to detect if hyper-v is working with the emulator.

I do think that troubleshooting article needs an update though, showing the output you should expect.

@adegeo adegeo self-assigned this Oct 14, 2022
@pilcherd
Copy link
Author

Reading through the article and also looking at Androids emulation setup articles it seems that those tools check for HAXM or for Android's AMD hypervisor, but not for Window's hypervisor. If you follow the instructions for enabling hyper-v and enabling the virtualization modes in the BIOS, your emulator should be accelerated.

The fact that you got that error message (saying you're using an AMD machine) would indicate you don't have hyper-v installed. When I run it (I'm using AMD) I get this, meaning, hyper-v is blocking android's check tool:

C:\Windows\system32>"C:\Program Files (x86)\Android\android-sdk\emulator\emulator-check.exe" accel
accel:
0
Please disable Hyper-V before using the Android Emulator.  Start a command prompt as Administrator, run 'bcdedit /set hypervisorlaunchtype off', reboot.WHPX (10.0.22000) is installed and usable.
accel

EDIT
I just noticed at the end of that message I do see WHPX (10.0.22000) is installed and usable. but it seems to be missing a new line so it looks like it's part of the message indicating you MUST disable Hyper-V. Yes you must disable Hyper-V if you want to use HAXM/Android AMD... but if WHPX is installed and usable then it should be fine, you don't need to go the HAXM/Android AMD route...
It also looks like you can use emulator-check.exe hyper-v to detect if hyper-v is working with the emulator.

I do think that troubleshooting article needs an update though, showing the output you should expect.

Hyper-V is very alive and in use on this development PC:

image

That command returns:

C:\Users\DavidP>"C:\Program Files (x86)\Android\android-sdk\emulator\emulator-check.exe" hyper-v
hyper-v:
2
Hyper-V is enabled
hyper-v

@pilcherd
Copy link
Author

Deployment shows this:

image

But when I run, I see this warning and the output showing not accelerated:

image

See running non-accelerated:

image

@adegeo
Copy link
Contributor

adegeo commented Oct 14, 2022

Hrmmm.. Do you have the Windows Hypervisor Platform enabled too? I don't see that in your screenshot.

@adegeo
Copy link
Contributor

adegeo commented Oct 14, 2022

Also, what's the exact CPU model are you using?

@pilcherd
Copy link
Author

Also, what's the exact CPU model are you using?

5950x

@pilcherd
Copy link
Author

Hrmmm.. Do you have the Windows Hypervisor Platform enabled too? I don't see that in your screenshot.

I have tried it with and without that. It made no difference.

@adegeo
Copy link
Contributor

adegeo commented Oct 14, 2022

You must have Windows Hypervisor Platform enabled, that is what WHPX stands for 😁 The fact that Android tries to run HAXM makes me think something is wrong with WHPX. I'm assuming you've also enabled the BIOS settings too for virtualization.

Can you try running the emulator command directly with acceleration on to see if it works? Maybe it will give you some different output:

C:\Program Files (x86)\Android\android-sdk\emulator\emulator.EXE -netfast -accel on -avd Android_accelerated_x86_Oreo -prop monodroid.avdname=Android_accelerated_x86_Oreo

What edition of Windows 11 are you using?

@pilcherd
Copy link
Author

You must have Windows Hypervisor Platform enabled, that is what WHPX stands for 😁 The fact that Android tries to run HAXM makes me think something is wrong with WHPX. I'm assuming you've also enabled the BIOS settings too for virtualization.

Can you try running the emulator command directly with acceleration on to see if it works? Maybe it will give you some different output:

C:\Program Files (x86)\Android\android-sdk\emulator\emulator.EXE -netfast -accel on -avd Android_accelerated_x86_Oreo -prop monodroid.avdname=Android_accelerated_x86_Oreo

What edition of Windows 11 are you using?

Windows 11 Enterprise 22H2 (22621.675)

I have re-enabled Windows Hypervisor Platform again and rebooted.

image

I then ran the command you requested:

C:\Users\DavidP>"C:\Program Files (x86)\Android\android-sdk\emulator\emulator.EXE" -netfast -accel on -avd Android_accelerated_x86_Oreo -prop monodroid.avdname=Android_accelerated_x86_Oreo
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Windows Hypervisor Platform (WHPX) is properly installed and usable.
CPU acceleration status: Android Emulator requires an Intel processor with VT-x and NX support. Your CPU: 'AuthenticAMD'

@pilcherd
Copy link
Author

From within Visual Studio in the Tools/Android SDK Manager, is an updater.

The Emulator had an upgrade available:

image

After upgrading it, it now appear to run instantly without error, so I guess a version newer than 27 is required.

Note that my Visual Studio is 2022 Enterprise, version 17.3.6 - the latest. These tools were only added yesterday so will be the latest Android components installed by Visual Studio.

It appears the documentation needs to say check for updates as part of troubleshooting.

Also the VS2022 installer should really install newer components.

@adegeo , Thank you for your suggestions.

@adegeo
Copy link
Contributor

adegeo commented Oct 14, 2022

Glad this is working! Honestly, you should just use the preview releases of Visual Studio 2022, all the latest MAUI code gets shipped in there, For .NET MAUI I don't use the non-preview releases anymore unless I have a specific reason to do so.

Anyway. Question on your situation. Did you happen to have the Android Emulator stuff already installed before? I bet VS installs the latest but perhaps you already had it installed from previous work and so it decided not to update?

@pilcherd
Copy link
Author

No android tooling was installed before yesterday. It was installed from the latest release Visual Studio installer.

@pilcherd pilcherd changed the title Hardware Acceleration is NOT enabled on AMD system. Hardware Acceleration is not enabled on AMD system. Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet-maui/tech dotnet-mobile/prod Pri1 High priority, do before Pri2 and Pri3 support-request Support-style question;customer needs help solving a problem [org]
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants