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

Update LLVM to 18.1.8 #16607

Merged
merged 1 commit into from
Jan 25, 2025
Merged

Update LLVM to 18.1.8 #16607

merged 1 commit into from
Jan 25, 2025

Conversation

Megamouse
Copy link
Contributor

closes #16032

@Megamouse Megamouse added OS: BSD OS: Windows Build and CI Anything related to the build process and continuous integration LLVM Related to LLVM instruction decoders labels Jan 24, 2025
@Megamouse Megamouse force-pushed the llvm18 branch 5 times, most recently from 0ee96d8 to 57fce12 Compare January 24, 2025 04:44
@Megamouse Megamouse requested a review from kd-11 January 24, 2025 08:53
@Megamouse Megamouse force-pushed the llvm18 branch 2 times, most recently from afdbb12 to a770819 Compare January 24, 2025 09:06
@digant73
Copy link
Contributor

digant73 commented Jan 24, 2025

As also reported in #16032, with MSVC compiling to DEBUG mode, after successfully compiling glslang and llvm I then got the following error compiling RPCS3:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error	LNK2038	mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in dualsense_pad_handler.obj	rpcs3	E:\console\git\rpcs3_megamouse\rpcs3\LLVMAnalysis.lib(ImportedFunctionsInliningStatistics.cpp.obj)	1		

while with the current llvm 16.0.1 it is possible to compile RPCS3 in DEBUG mode (glslang lib, llvn lib and RPCS3 bin)

@Darkhost1999
Copy link
Contributor

Thanks to the changes in vcxproj that I wasn't aware of. I managed to compile RPCS3 with LLVM 19.1.7. Only had to work around unresolved linker error with llvmsupport.lib by adding ntdll.lib to the list of additional dependencies.
I believe llvmsupport.lib is supposed to look for ntdll itself and not sure if that may need to be reported to llvm prior to the next version bump we perform. Additionally, I don't know if it's desired to support the most recent release tag of LLVM now vs later.

@Megamouse
Copy link
Contributor Author

Idk what issues you're talking about.
I'm just bumping the version to the one that's already used in Linux to get parity

@digant73
Copy link
Contributor

Idk what issues you're talking about.

Is that a reply to @Darkhost1999 or to me?

@Megamouse
Copy link
Contributor Author

@digant73 debug is fixed

@digant73
Copy link
Contributor

digant73 commented Jan 24, 2025

@digant73 debug is fixed

thanks for the fix.

A runtime error present also on current and old RPCS3 releases compiled in DEBUG mode is triggered when starting a game with PPU Decoder setting on CPU tab set to Recompiler (LLVM).
Precisely, when Applying PPU code... is displayed on the game window then RPCS3 is aborted (a dialog box reporting the abort is displayed).
That abort message is due to JIT module not initialized. In particular the abort dialog is triggered by the execution of line code:

jit->fin();

at line 5511 in PPUThread.cpp.
Below the block of code with the above line of code:

const bool is_first = !jit_mod.init;

if (is_first)
{
	for (auto& jit : jits)
	{
		jit->fin();                      // <--- line 5511 in PPUThread.cpp triggering the abort message
	}
} 

It should be great if that issue (abort due to JIT module not initialized) happening only in DEBUG mode could also be fixed, maybe on a separate PR.
Probably it is due to a missing/wrong compile option on LLVM 3rdparty than a bug in RPCS3.
Maybe the expert on that topic is @elad.
If it could be fixed, I could finally run games in DEBUG mode from VS for some troubleshooting.

@Darkhost1999
Copy link
Contributor

I get the same in every call stack on every executable I boot. Just tried not 1 hour ago as well.

@Megamouse
Copy link
Contributor Author

Works fine for me on Vulkan. Never had that issue

@digant73
Copy link
Contributor

@Megamouse because you used RPCS3 compiled in RELEASE mode

@elad335
Copy link
Contributor

elad335 commented Jan 25, 2025

@digant73 debug is fixed

thanks for the fix.

A runtime error present also on current and old RPCS3 releases compiled in DEBUG mode is triggered when starting a game with PPU Decoder setting on CPU tab set to Recompiler (LLVM). Precisely, when Applying PPU code... is displayed on the game window then RPCS3 is aborted (a dialog box reporting the abort is displayed). That abort message is due to JIT module not initialized. In particular the abort dialog is triggered by the execution of line code:

jit->fin();

at line 5511 in PPUThread.cpp. Below the block of code with the above line of code:

const bool is_first = !jit_mod.init;

if (is_first)
{
	for (auto& jit : jits)
	{
		jit->fin();                      // <--- line 5511 in PPUThread.cpp triggering the abort message
	}
} 

It should be great if that issue (abort due to JIT module not initialized) happening only in DEBUG mode could also be fixed, maybe on a separate PR. Probably it is due to a missing/wrong compile option on LLVM 3rdparty than a bug in RPCS3. Maybe the expert on that topic is @elad. If it could be fixed, I could finally run games in DEBUG mode from VS for some troubleshooting.

Don't merge it if it is incompatible with #16537

@digant73
Copy link
Contributor

digant73 commented Jan 25, 2025

@elad335 the bug I mentioned (in DEBUG mode) is present also in current LLVM 16.0.1. For some reasons the JIT module seems not initialized if using the LLVM libs compiled in DEBUG mode. You can verify it also in #16537 compiling (with VS or even cmake) glslang, llvm and RPCS3 in DEBUG mode. Everything is ok in RELEASE mode (also with llvm 18.1.8)

@Megamouse
Copy link
Contributor Author

Of course I'm using debug config. That's what we've been talking about.

@digant73
Copy link
Contributor

digant73 commented Jan 25, 2025

Of course I'm using debug config. That's what we've been talking about.

I have a Ryzen 7800x3d. I thought that maybe llvm was providing full functionality in RELEASE mode only. But if you say it is working also in DEBUG mode there is possibly something to investigate.
@Darkhost1999 could you please confirm the issue running rpcs3d.exe (if you are on Windows as me)?

Below a screenshot of the issue on R3, but it is the same on all games with PPU Decoder set to Recompiler (LLVM):

image

@Darkhost1999
Copy link
Contributor

I have a Ryzen 7 7700x but this issue wasn't caused by this PR or that.
This has been around since debug builds were fixed compiling in the first place after years of not being able to compile at all if it was around before debug mode wasn't compiling to be able to test.
I am discussing running the executable rpcs3d.exe through visual studio clicking the green play button after setting RPCS3 as the start up solution.
I also admit I'm not very familiar with using a debugger and only try to see if I can learn something.
But every time I'm about 50% of the way through generating or loading llvm cache I get the JIT message among other messages in my callstack while abort was called.
Idk know Vulkan = PPU thread that was just an interesting thing to read. But I also don't think filling up this thread with offtopic posts is the answer.
We discovered Megamouse can't replicate the issue so it's up to someone experiencing the problem to try and solve the problem. Maybe even create an issue ticket.

@digant73
Copy link
Contributor

But I also don't think filling up this thread with offtopic posts is the answer. We discovered Megamouse can't replicate the issue so it's up to someone experiencing the problem to try and solve the problem. Maybe even create an issue ticket.

Yes, I agree

@Megamouse Megamouse merged commit 67703b4 into RPCS3:master Jan 25, 2025
6 of 8 checks passed
@Megamouse Megamouse deleted the llvm18 branch January 25, 2025 17:15
@Darkhost1999 Darkhost1999 mentioned this pull request Jan 25, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build and CI Anything related to the build process and continuous integration LLVM Related to LLVM instruction decoders OS: BSD OS: Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants