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 Arm build fixes #11546

Merged
merged 4 commits into from
Jul 23, 2024
Merged

Windows Arm build fixes #11546

merged 4 commits into from
Jul 23, 2024

Conversation

TheLastRar
Copy link
Contributor

Description of Changes

Fixes incorrect paths for arm files cpuinfo vcxproj
Update Windows ARM dependencies to be inline with Windows x64
Remove hard-coded version in both x64 and Arm64 dependency build script
Add bin-arm64 to gitignore

Rationale behind Changes

Spotted the error in the cpuinfo project file
Other issues where corrected when I attempted to cross compile

Suggested Testing Steps

Test windows Arm64 build

Note

I don't have any Arm64, so while I can build for Arm, I can't test the resulting build.
Don't expect much Arm64 work from me.

@github-actions github-actions bot added Build | Project System Dependencies Pull requests that update a dependency file labels Jul 13, 2024
Copy link
Member

@F0bes F0bes left a comment

Choose a reason for hiding this comment

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

I don't think we have anyone available to test arm and I've let this sit for a little bit now.
I'll merge it to get it out of the way.

@F0bes F0bes merged commit 225f057 into PCSX2:master Jul 23, 2024
12 checks passed
@TheLastRar TheLastRar deleted the arm-fixes branch July 23, 2024 22:57
@talynone
Copy link

talynone commented Aug 1, 2024

Took me a while to get this compiled.

Compiles on a Lenovo Yoga Slim 7x running a Snapdragon Elite CPU on Windows 11 ARM.

I first had to:

  1. Install Python 3 for ARM
  2. Run "\.github\workflows\scripts\windows\build-dependencies-arm64.bat"
  3. Set target to ARM64 in Visual Studio 2022
  4. Build every project before building "pcsx2-qt"
  5. Manually create "resources" subfolder in ".\bin-arm64" folder

After everything compiled got the following error on run:

---------------------------
Hardware Check Failed
---------------------------
Page size mismatch. This build cannot run on your Mac.

PCSX2 builds can be downloaded from https://pcsx2.net/downloads/

@TheLastRar
Copy link
Contributor Author

Are you building using MSBuild or CMake?

@talynone
Copy link

talynone commented Aug 1, 2024

Are you building using MSBuild or CMake?

MSBuild

@TheLastRar
Copy link
Contributor Author

@talynone Can you test this PR #11655

@talynone
Copy link

talynone commented Aug 1, 2024

@TheLastRar Got past that error but still had more

  1. Still had to create resources folder manually
  2. Going to Settings->Graphics gave me this error:
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Error!

Program: C:\Data\BioCentury\git\PCSX2TheLastRar\bin-arm64\Qt6Cored.dll
Module: 6.7.2
File: C:\Data\BioCentury\git\PCSX2TheLastRar\deps-build\qtbase-everywhere-src-6.7.2\src\corelib\tools\qarraydata.cpp
Line: 229

ASSERT: "!data || !data->isShared()" in file C:\Data\BioCentury\git\PCSX2TheLastRar\deps-build\qtbase-everywhere-src-6.7.2\src\corelib\tools\qarraydata.cpp, line 229

(Press Retry to debug the application)

---------------------------
Abort   Retry   Ignore   
---------------------------

  1. Trying to run a game gave me this error:

Exception thrown at 0x00007FF66CB75D9C in pcsx2-qt-clang-dbg.exe: 0xC0000005: Access violation reading location 0x0000000000000038.

on this line (last line):

void GSDevice12::UnbindTexture(GSTexture12* tex)
{
	for (u32 i = 0; i < NUM_TOTAL_TFX_TEXTURES; i++)
	{
		if (m_tfx_textures[i] == tex->GetSRVDescriptor())
		{
			m_tfx_textures[i] = m_null_texture->GetSRVDescriptor();

To make sure my configuration wasn't messed up I verified I was able to run the x64 version just fine.

@TheLastRar
Copy link
Contributor Author

TheLastRar commented Aug 1, 2024

Can you copy the contents of .\bin\resources into your created .\bin-arm64\resources folder and try again

Edit: and if that fails, can you provide a stacktrace

@talynone
Copy link

talynone commented Aug 1, 2024

Copying over from .\bin\resources had no effect.

Here's the stack trace when trying to run a game:

pcsx2-qt-clang-dbg.exe!GSDevice12::UnbindTexture(GSTexture12 * tex) Line 3307
	at C:\Data\Programming\git\PCSX2TheLastRar\pcsx2\GS\Renderers\DX12\GSDevice12.cpp(3307)
pcsx2-qt-clang-dbg.exe!GSTexture12::Destroy(bool defer) Line 47
	at C:\Data\Programming\git\PCSX2TheLastRar\pcsx2\GS\Renderers\DX12\GSTexture12.cpp(47)
pcsx2-qt-clang-dbg.exe!GSDevice12::DestroySwapChainRTVs() Line 962
	at C:\Data\Programming\git\PCSX2TheLastRar\pcsx2\GS\Renderers\DX12\GSDevice12.cpp(962)
pcsx2-qt-clang-dbg.exe!GSDevice12::DestroySwapChain() Line 973
	at C:\Data\Programming\git\PCSX2TheLastRar\pcsx2\GS\Renderers\DX12\GSDevice12.cpp(973)
pcsx2-qt-clang-dbg.exe!GSDevice12::Destroy() Line 754
	at C:\Data\Programming\git\PCSX2TheLastRar\pcsx2\GS\Renderers\DX12\GSDevice12.cpp(754)
pcsx2-qt-clang-dbg.exe!OpenGSDevice(GSRendererType renderer, bool clear_state_on_fail, bool recreate_window, GSVSyncMode vsync_mode, bool allow_present_throttle) Line 152
	at C:\Data\Programming\git\PCSX2TheLastRar\pcsx2\GS\GS.cpp(152)
pcsx2-qt-clang-dbg.exe!GSopen(const Pcsx2Config::GSOptions & config, GSRendererType renderer, unsigned char * basemem, GSVSyncMode vsync_mode, bool allow_present_throttle) Line 342
	at C:\Data\Programming\git\PCSX2TheLastRar\pcsx2\GS\GS.cpp(342)
pcsx2-qt-clang-dbg.exe!MTGS::ThreadEntryPoint() Line 168
	at C:\Data\Programming\git\PCSX2TheLastRar\pcsx2\MTGS.cpp(168)
[External Code]
pcsx2-qt-clang-dbg.exe!Threading::Thread::ThreadProc(void * param) Line 164
	at C:\Data\Programming\git\PCSX2TheLastRar\common\Windows\WinThreads.cpp(164)
[External Code]

@TheLastRar
Copy link
Contributor Author

Can you provide a pcss2 log file of both the working x64 version and the non-working arm build

@talynone
Copy link

talynone commented Aug 1, 2024

The x64 working copy is actually the installed released app in a different folder.

There is nothing in the logs folder. But if I run the ARM emulator outside of the debugger and try to run a game I do get a crash dump, which I've attached.

crash-2024-08-01-14-34-03-905.zip

@TheLastRar
Copy link
Contributor Author

Regarding The minidump, I will need the exact binaries that generated the dump, as you had built these, I will need you to also upload these before I can inspect the minidump

Regarding the logs files I asked for, I had forgetting this is off by default.
you will need to be enable these under tools -> Enable File Logging

@talynone
Copy link

talynone commented Aug 2, 2024

I've attached the binaries and log.
bin-arm64.zip

@TheLastRar
Copy link
Contributor Author

TheLastRar commented Aug 2, 2024

A quick scan though the log shows it fails to find the resources/shaders/dx11/tfx.fx (and that the error message has a typo)

Upon failing to load this file, PCSX2 aborts starting, but ends up crashing as a result.

Can you verify that bin-arm64/resources/shaders/dx11/tfx.fx (along with the other fx files) was copied correctly from the equivalent folder in bin

@talynone
Copy link

talynone commented Aug 2, 2024

Hmm, must have not copied it right last time, this time it worked when copying resources folder from bin folder, it's very slow fps wise (2-3 fps), but I'm guessing that's because it's a debug build?

It still crashes when going to settings->graphics option menu. With the following error:

Log also attached.

image

emulog.txt

@talynone
Copy link

talynone commented Aug 2, 2024

One fix I applied was changing the project configuration for Debug and Release on ARM64 so it matches the x64 build configuration, everything checked to build except the vixl and pcx2-gsrunner projects.

Having issues building in release mode, have a list of about 17 errors.

One interesting one is:

no such file or directory: 'C:\Data\Programming\git\PCSX2TheLastRar\build\obj-pcsx2-qt-ARM64-Release Clang\qrc_resources.cpp' pcsx2-qt C:\Data\Programming\git\PCSX2TheLastRar\pcsx2-qt\clang-cl

Edit: Copied the file from the x64 build ("obj-pcsx2-qt-x64-Debug") and that seemed to let me build.

Edit 2: Release mode runs, but still much slower than emulated x64 build and very unstable and graphically glitchy, froze soon after splash screen.

Edit 3: Also got a message on startup about missing "patches.zip". I copied that over from resources folder on an installed release stable version resources folder to resolve.

@TheLastRar
Copy link
Contributor Author

TheLastRar commented Aug 2, 2024

One fix I applied was changing the project configuration for Debug and Release on ARM64 so it matches the x64 build configuration, everything checked to build except the vixl and pcx2-gsrunner projects.

I thought vixl was required for Arm
Additionally, we skip zydis as that isn't required on Arm64

Having issues building in release mode, have a list of about 17 errors.

One interesting one is:

no such file or directory: 'C:\Data\Programming\git\PCSX2TheLastRar\build\obj-pcsx2-qt-ARM64-Release Clang\qrc_resources.cpp' pcsx2-qt C:\Data\Programming\git\PCSX2TheLastRar\pcsx2-qt\clang-cl

Edit: Copied the file from the x64 build ("obj-pcsx2-qt-x64-Debug") and that seemed to let me build.

I'm not able to repo. When I cross compile for arm, that file is generated correctly when building
It's possible that while cross compiling works, compiling Arm on Arm doesn't
Can you post the build log.

Edit 2: Release mode runs, but still much slower than emulated x64 build and very unstable and graphically glitchy, froze soon after splash screen.

Currently we don't have Arm recompilers for EE/VU or IOP, so these fall back to the (very) slow interpreters.
Unfortunately, the team member who was working on this (for Apple Silicon) left the project about a month ago.

As for the graphical glitches, the Arm build will default to DirectX12, while the x64 might default to Vulkan or OpenGL
Our DirectX12 renderer is not as competent as the Vulkan/OpenGL renderers

Edit 3: Also got a message on startup about missing "patches.zip". I copied that over from resources folder on an installed release stable version resources folder to resolve.

patches.zip has to be provided manually from the patches repo when building locally,

@talynone
Copy link

talynone commented Aug 4, 2024

I thought vixl was required for Arm
Additionally, we skip zydis as that isn't required on Arm64

Thanks, I changed the build configuration for ARM64 debug and release with that updated information. You should probably do the same on your end.

Can you post the build log.

Attached, hope it helps.

Build_log_08_03_2024_1125PM.txt

patches.zip has to be provided manually from the patches repo when building locally,

Thanks, good to know.

@TheLastRar
Copy link
Contributor Author

Build_log_08_03_2024_1125PM.txt

For some reason, your build isn't running the QtResource target, while other Qt targets run just fine,
This target takes our resources\resources.qrc file and output a qrc_resources.cpp file.

In the build log you should see rcc resources between ------ Build started: Project: pcsx2-qt and uic AboutDialog
However, you have this (note the lack of rcc resources);

24>------ Build started: Project: pcsx2-qt, Configuration: Debug Clang ARM64 ------
24>Updating "C:\Data\BioCentury\git\PCSX2TheLastRar\pcsx2-qt\svnrev.h"...
24>uic AboutDialog

I'm unsure as to why you end up skipping that...

The QtResource target has the following condition Condition="'@(QtResource)'!=''" so will only run if QtResource files are included

We include resources.qrc for QtResource in pcsx2-qt.vcxproj here;

<ItemGroup>
<QtResource Include="resources\resources.qrc">
<FileType>Document</FileType>
</QtResource>
</ItemGroup>

So this target should run when building pcsx2-qt

@talynone
Copy link

talynone commented Aug 4, 2024

resources\resources.qrc seems to be missing, got removed somehow.

I resynced/reverted my git to restore it.

The x64 .exe installed version (not built from local source) uses DirectX 12 and runs 60fps, the new Prism x86/x64 emulator in Windows 11 ARM is pretty capable.

The source seems to be based off 1.7, while the installed binary is 2.0.2, I wonder if that is making a difference too.

@TheLastRar
Copy link
Contributor Author

Nice to know that the Prism emulator is up to the task.

The source on the repo should match (or rather it's a few commits ahead) the binary, useful to know that PCSX2 x64 also picks DirectX 12

I think it's probably just the fact that our Arm code is incomplete is what's giving you issues.
I don't have WoA hardware to test on myself, and I also lack the necessary skills needed to tackle the missing Arm recompilers,

@TheLastRar
Copy link
Contributor Author

That being said, are you still getting this issue #11546 (comment) with a debug arm build?

If so can you get me a stacktrace for it

@talynone
Copy link

talynone commented Aug 7, 2024

That being said, are you still getting this issue #11546 (comment) with a debug arm build?

If so can you get me a stacktrace for it

Still seeing the issue, I've attached the crash dump
crash-2024-08-07-03-09-59-604.zip

@TheLastRar
Copy link
Contributor Author

That being said, are you still getting this issue #11546 (comment) with a debug arm build?
If so can you get me a stacktrace for it

Still seeing the issue, I've attached the crash dump crash-2024-08-07-03-09-59-604.zip

Thank you

Turns out this crash is a compiler bug in clang-cl
See https://bugreports.qt.io/browse/QTBUG-123617 and llvm/llvm-project#86384
This bug is fixed in Clang 18.1.6, however, the version that Visual studio installs is 17.0.3

@talynone
Copy link

talynone commented Aug 7, 2024

Clang

Thanks, using that information I was able to resolve it by:

Downloading/installing LLVM 18.1.8 ARM edition (LLVM-18.1.8-woa64.exe) from:
https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.8

Then created a "Directory.build.props" in the same folder as the solution file and pointed it to the install location of LLVM as described here:
https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-170#custom_llvm_location

@TheLastRar
Copy link
Contributor Author

Edit 2: very unstable and graphically glitchy, froze soon after splash screen.

Doubling back to this, which game froze for you after the splash screen? can you provide a log file for it

@talynone
Copy link

Edit 2: very unstable and graphically glitchy, froze soon after splash screen.

Doubling back to this, which game froze for you after the splash screen? can you provide a log file for it

The behavior seems different now, now it just gets stuck after the Sony splash screen on God of War at 2 fps. I've waited several minutes and nothing changes.

I've attached the log and a link to a video recording of what I described, at the end of the video I also show the x64 release installed version running at 60fps.

emulog.txt

https://streamable.com/rkwryy

@JordanTheToaster
Copy link
Member

Edit 2: very unstable and graphically glitchy, froze soon after splash screen.

Doubling back to this, which game froze for you after the splash screen? can you provide a log file for it

The behavior seems different now, now it just gets stuck after the Sony splash screen on God of War at 2 fps. I've waited several minutes and nothing changes.

I've attached the log and a link to a video recording of what I described, at the end of the video I also show the x64 release installed version running at 60fps.

emulog.txt

https://streamable.com/rkwryy

Does vulkan work at all?

@talynone
Copy link

Does vulkan work at all?

Both Vulkan and OpenGL are not available options in the renderer drop down in the ARM64 version, however both are available in the x64 installed release version (v2.02).

@JordanTheToaster
Copy link
Member

Does vulkan work at all?

Both Vulkan and OpenGL are not available options in the renderer drop down in the ARM64 version, however both are available in the x64 installed release version (v2.02).

At least in x64 I'd suggest using them.

@talynone
Copy link

talynone commented Aug 10, 2024

Does vulkan work at all?

Both Vulkan and OpenGL are not available options in the renderer drop down in the ARM64 version, however both are available in the x64 installed release version (v2.02).

At least in x64 I'd suggest using them.

Just tried Vulkan on the x64 version, it crashes after Sony logo, OpenGL seems to work.

Edit: OpenGL works but Directx12 is for sure more performant, get better fps with increased texture resolution.

@TheLastRar
Copy link
Contributor Author

TheLastRar commented Aug 10, 2024

The behavior seems different now, now it just gets stuck after the Sony splash screen on God of War at 2 fps. I've waited several minutes and nothing changes.

I've attached the log and a link to a video recording of what I described, at the end of the video I also show the x64 release installed version running at 60fps.

emulog.txt

https://streamable.com/rkwryy

Given the fact that the arm builds are stuck using the interpreters it would be running very slow
At 3% speed, the slow interpreters would take 2-3mins to clear that screen

Edit: A Devel or Release build will be a little bit faster, still not near the x64 build, but faster for testing.
As an aside, the configurations are pre setup for Debug Clang, Devel Clang & Release Clang
The configurations without Clang in the name don't yet have proper configurations for Arm (Which I think had to added before)

@JordanTheToaster
Copy link
Member

Does vulkan work at all?

Both Vulkan and OpenGL are not available options in the renderer drop down in the ARM64 version, however both are available in the x64 installed release version (v2.02).

At least in x64 I'd suggest using them.

Just tried Vulkan on the x64 version, it crashes after Sony logo, OpenGL seems to work.

Edit: OpenGL works but Directx12 is for sure more performant, get better fps with increased texture resolution.

If you can post an emulog when using OpenGL I'd like to see that.

@talynone
Copy link

Does vulkan work at all?

Both Vulkan and OpenGL are not available options in the renderer drop down in the ARM64 version, however both are available in the x64 installed release version (v2.02).

At least in x64 I'd suggest using them.

Just tried Vulkan on the x64 version, it crashes after Sony logo, OpenGL seems to work.
Edit: OpenGL works but Directx12 is for sure more performant, get better fps with increased texture resolution.

If you can post an emulog when using OpenGL I'd like to see that.

emulog.txt

Here's the log from the x64 v2.02 release version configured with OpenGL.

@JordanTheToaster
Copy link
Member

Does vulkan work at all?

Both Vulkan and OpenGL are not available options in the renderer drop down in the ARM64 version, however both are available in the x64 installed release version (v2.02).

At least in x64 I'd suggest using them.

Just tried Vulkan on the x64 version, it crashes after Sony logo, OpenGL seems to work.
Edit: OpenGL works but Directx12 is for sure more performant, get better fps with increased texture resolution.

If you can post an emulog when using OpenGL I'd like to see that.

emulog.txt

Here's the log from the x64 v2.02 release version configured with OpenGL.

If you could you can join our discord server it'll make this easier to do

@talynone
Copy link

If you could you can join our discord server it'll make this easier to do

I joined, what would you like me to do?

@JordanTheToaster
Copy link
Member

If you could you can join our discord server it'll make this easier to do

I joined, what would you like me to do?

Send a message in dev and we can continue this there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build | Project System Dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants