Make Gauss-Seidel great again! The art of unrolling

Two posts in one week! You guys are in for a treat!

This time, we’ll explore how we can use the open-source code analyzer osaca to dissect our Jacobi and textbook Gauss-Seidel kernels and understand why the latter is so slow despite the math saying its should converge in half as many iterations as Jacobi: critical path, loop carried dependencies, port pressure, and the likes. Then, we’ll see how we can use algebraic manipulations and loop unrolling to recover Gauss-Seidel’s convergence advantage without sacrificing the hardware efficiency of Jacobi. Here is the link to the blog post.

Big thank you to @ivanpribec for putting osaca under my radar as well as showing the unrolled Gauss-Seidel kernel.

@rsci : As you had correctly pinpointed last week, most of the Jacobi kernel’s performance comes from ILP. Vectorization gives you an extra speed-up but it really is just the cherry on top.

12 Likes

“Like” deserved, even if it were only for the humorous title and the artwork of your blog post. :grinning_face_with_smiling_eyes:

“Making Gauss-Seidel great again” is no small feat, as it gives much better smoothing (and hence ultimately much faster convergence) rates than Jacobi in multigrid methods.