DSP_INIT can be called from multiple threads#46
Merged
Conversation
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.
I believe I ran into a case where multi-threaded programs get into
VP8LDspInitconcurrently and put the critical function pointers in a bad state which affects subsequent usage until program restart.On this x86_64 system we have
SSEandAVX2available and ended up in a state where bothVP8LPredictorsAdd[11]andVP8LPredictorsAdd_SSE[11]point to the samePredictorAdd11_AVX2function leading to strange recursion and CPU saturationA good case with a function pointers in a reasonable state looks like
Meanwhile a bad case looks like this
According to
perfit seems to be stuck inPredictorAdd11_AVX2. So it seems to now callVP8LPredictorsAdd_SSE[11]for the remainder of the pixels which is just a pointer back to itself. I see that there exists the flagWEBP_USE_THREADhere supposed to enable threading support by enabling thepthread_mutexpath during initialization.