SPU LLVM: Support PUTLLC16 in CellSpurs JobChain management #17733
+136
−23
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.




In Hot Shots Golf, one SPU atomic operation stands out more than the rest:

This operation, manages acquireship of cellSpurs Jobchain tasks.
After some observation, I've noticed that this atomic operation may be compatible with the PUTLLC16 optimization, which you can learn about here: #15429
But why it wasn't yet compatible for it? for few reasons it turns out.
BRSL, in the middle of the operation. But after inspecting what it does, it does not seem to make sense for the function. But after second inspection, I noticed that register 4 (R4) was used right after the function call. So I figured, that this must be a [[noreturn]] type of function which does not actually return to function. Implementing detection of this eliminates optimization failure number 1 for SPU Mega block size.After inspection, the second address cannot be interleaved with the cache line data of the operation. But, because of the usage of relative loads and stores, a runtime check was added in LLVM code to verify it. (otherwise resorting to the full and heavy PUTLLC)
Fixes #14724
Note: This pull requests affect both SPU Safe and SPU Mega block sizes.
Before
After