
Faster arithmetic by flipping signs - ingve
https://nfrechette.github.io/2019/05/08/sign_flip_optimization/
======
benj111
I thought this was going to be about 2s complement bit flipping. But no it's
for floating point!

------
MayeulC
Shadow of the Tomb Raider is a quite recent game, and was not released on Xbox
360 (according to my memory and the helpfully linked wikipedia article).
Wouldn't this piece be about Rise of the Tomb Raider instead?

Of course, this nitpick only concerns the introduction, the rest is a good
piece.

~~~
tntn
> tasked with optimizing the cloth simulation code in Shadow of the Tomb
> Raider. It had been fine tuned extensively with PowerPC intrinsics for the
> Xbox 360 but its performance was lacking on XboxOne (x64).

Sounds to me like they were recycling some old cloth simulation code from
previous games and it needed to be optimized for Xbox one for the release of
the new game.

~~~
zeno490
Correct, their game engine has been around since the very first Tomb Raider
and even before that. The code evolved over the years of course and the cloth
simulation code as well. Shadow of the Tomb Raider used much more cloth in the
environment and on the characters than previous games and it needed a bit of
help. I don't remember off the top of my head how much I managed to speed it
up but tuning the assembly for x64 and SSE yielded a 1.5-2x speedup over the
old code due to various optimizations.

------
lawlessone
Does this work with GLSL?

~~~
Asooka
You'll need to examine the binary generated for a particular architecture by
the driver. It may work on one driver+GPU combination, but be slower on
another. Also, the semantics for floating-point math are somewhat looser in
GLSL so the driver is given more power to reorder expressions and might
exploit this trick on its own. As usual, you should profile and benchmark.

------
jamewatson
That's a nice little optimisation! Would you mind sharing the aarch64 assembly
from before and after applying the optimisation? It would be good to know the
compiler flags used too :)

~~~
filleokus
OT, but, this account seems to be reposting comments from the original article
as HN comments. I wonder if it's automatic or manual. Regardless, it doesn't
really seem to work (-6 karma as per the writing of this comment).

~~~
pfortuny
Possibly someone playing with that AI text generation software whose name I
forget. Looks similar.

