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

VulkanContext: Disable subgroup reduction on Macs with AMD GPUs #10107

Merged
merged 1 commit into from Sep 17, 2021

Conversation

OatmealDome
Copy link
Member

Based on #9783.

For whatever reason, attempting to access gl_SubgroupInvocationID causes MTLCompilerService to crash in LLVM code. This breaks bounding box. A crash log has been attached here.

The relevant excerpt is as follows:

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x00007fffb1d44a50
Exception Note:        EXC_CORPSE_NOTIFY

[...]

Thread 1 Crashed:
0   ???                           	0x00007fffb1d44a50 0 + 140736176867920
1   libLLVM.dylib                 	0x00007fff68d6ddf9 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 1573
2   libLLVM.dylib                 	0x00007fff68d6cfd1 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 1633
3   libLLVM.dylib                 	0x00007fff68797d65 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 119
4   libLLVM.dylib                 	0x00007fff68919ff5 llvm::FPPassManager::runOnFunction(llvm::Function&) + 395
5   libLLVM.dylib                 	0x00007fff68919d56 llvm::FPPassManager::runOnModule(llvm::Module&) + 52
6   libLLVM.dylib                 	0x00007fff6891fa2e llvm::legacy::PassManagerImpl::run(llvm::Module&) + 652
7   com.apple.AMDRadeonX6000Shared	0x00007fff60bf79f5 AMDMTLCompilerPluginIL::compileShader(llvm::Module&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 639

More investigation is required and a bug report with a minimized test case should be submitted to Apple.

In the meantime, however, I have opened this PR which disables subgroup reduction completely on AMD GPUs so that games that rely on bounding box can become playable again.

Tested on a MacBook Pro 16" running macOS 11.5.2 with an AMD Radeon 5500M.

@Techjar
Copy link
Contributor

Techjar commented Sep 17, 2021

Neat. Glad you found the issue.

Copy link
Contributor

@Techjar Techjar left a comment

Choose a reason for hiding this comment

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

Code LGTM (I'm basically the one who wrote it :P), probably should try to find out if this is a problem on newer iMac Pros with AMD Vega graphics.

@JosJuice JosJuice merged commit a6baca6 into dolphin-emu:master Sep 17, 2021
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants