blender: fix segfault when using both HIP and OSL#504149
Closed
frozolotl wants to merge 1 commit into
Closed
Conversation
Contributor
|
Great ! Would it be a good idea to upstream this patch ? |
Contributor
Author
|
It appears as though this bug swatted itself? The latest master appears to work correctly now. I think I'm more confused now than I was when submitting this PR, but hey, it's a good kind of confusion. https://projects.blender.org/blender/blender/pulls/156456#issuecomment-1888351 EDIT: even #502842 works now?! I'm certain I had that issue happen on those exact commits. @amarshall too. It's weird. @amarshall can you check whether your results are the same as mine? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where enabling both ROCm and OpenShadingLanguage in Blender causes Blender to crash when performing a Cycles render.
Blender
dlopens HIP, which is dynamically linked torocm-comgr, which in turn links ROCm's libLLVM.But then, Blender dynamically links OpenShadingLanguage, which links libLLVM 19.
And so, when HIP is invoked, it transitively calls ROCm's libLLVM, which then—due to symbol conflicts—calls functions in libLLVM 19.
One of those functions then dereferences a null pointer, causing a segfault in the process.
Switching out
dlopenwithdlmopenseparates the namespaces of the two libLLVMs, fixing the issue.If anyone wants to find a better solution, I'll mention that simply using the same version of LLVM for both ROCm and OpenShadingLanguage causes different issues because then libLLVM is initialized twice.
The bug was also mentioned in #502842.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.