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

[Test] SPU LLVM: Add more clamping, reorder them to be on the result #12185

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

elad335
Copy link
Contributor

@elad335 elad335 commented Jun 6, 2022

Remove hacks, and reorder clamping where they should be hopefully with better performance. Please test issues that arise when using approx xfloat on master. They can be fixed with this pr in theory.

@elad335 elad335 marked this pull request as ready for review June 6, 2022 09:32
@elad335 elad335 force-pushed the llvm-clamp branch 4 times, most recently from cdd4014 to 46abce3 Compare June 6, 2022 09:44
@Megamouse Megamouse added CPU Optimization Optimizes existing code labels Jun 6, 2022
@Xcedf
Copy link

Xcedf commented Jun 6, 2022

This PR reintroduces an old issue in Uncharted #4478
and this is for FS instruction only, I did a lots of testing with Xfloat clamping on my custom build, clamping final result is worse than clamping it's operands.

@elad335 elad335 force-pushed the llvm-clamp branch 2 times, most recently from 495f402 to c3802c2 Compare June 6, 2022 10:46
@elad335
Copy link
Contributor Author

elad335 commented Jun 6, 2022

I implemented smart float source detection, please retest.

@elad335 elad335 force-pushed the llvm-clamp branch 11 times, most recently from 3b705bb to da0f108 Compare June 6, 2022 16:46
@Whatcookie
Copy link
Member

Needs testing with games that are picky with floating point behavior (RDR, LBP2, NCAA)

As for performance, I'm not sure it's going to be any better, I've tested this before and I found that clamping inputs was faster since llvm can eliminate the clamping in the case where the inputs are constant or the same value is used across multiple instructions.

@elad335 elad335 marked this pull request as draft June 6, 2022 17:44
@RainbowCookie32
Copy link
Contributor

GTA 4 no longer needs Accurate xfloat to stay on the ground with this PR
image

@xddxd
Copy link
Contributor

xddxd commented Jun 7, 2022

Causes vertex explosions on horses in RDR. Accurate xfloat on master does this as well, IIRC it's the FM instruction.
image

@Xcedf
Copy link

Xcedf commented Jun 7, 2022

FM can cause this issue if approximation method was removed and only clamping is used.

@Bertue
Copy link

Bertue commented Jun 11, 2022

I don't know if it also has to do with the Dragon's Crown and Odin Sphere games with 2D side scrolling because of the problem of texture clamping issues with better optimization in the CPU and GPU of the graphics I have no idea if it would eliminate that so that it doesn't get those square errors out.🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CPU Optimization Optimizes existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants