Siracha guesses how AMD's Zen 4 branch predictor works because it's fun to guess

UPDATE AT BOTTOM

Hi everyone, ever since I moved onto my new laptop I've had access to a Zen 4 CPU, specifially a AMD Ryzen 7 7840HS. Now I write a lottt of particle simulation code, like for Boids, Ants, Slime mold, and SPH Fluid Simulations . Now whenevre I'd run those fluid simulations or particle simulations, I'd see an interesting behaviour; Starts slow, after ~100 runs, it starts to decrease till it halves in run time relative to first 3 runs. This implies that the Branch Predictor is adapting to an extent



I couldn't find the tools I'd normally use to analyse this, so I just made a simple graph (perf randomly broke, and Ive already spent 4 hours debugging, will try again with uProf when I get some more time)





Now based on my experience in machine learning... Im going to make a strategic guesses... it bases it's predictions off of previous instructions executed. Based off of this I can also make some guesses about how their branch predictor.

Updated guesses

Ok after a lot more guesses I've come to a diff idea. Can't be a neural network because infrence/training would be too slow.

I'll make a more comphrensive update once I get a bit more time.
I'm wondering if this is memory, or instruction or some other predictor. I do not yet know enough to make a good guess on this topic tho.