Skip to content
0:00 / 0:00

#matrixmultiplication#cachelocality#looptiling

Adding Nested Loops Makes this Algorithm 120x FASTER?

DepthBuffer

17K subscribers • 1 video on Hallway

YouTube

Intermediate. Assumes working knowledge.

139K views3 years ago2 recommendations

Systems programmingComputer sciencePerformance and optimizationAlgorithmsCPUs and computer architecture

An explanation of how to optimize memory-bounded algorithms like matrix multiplication using cache blocking and loop tiling.

In the last video, I introduced the concepts of compute-bounded and memory-bounded tasks. This video takes a step further and uses the theory we discussed to optimize a famous memory-bounded algorithm. Many of these tricks are counterintuitive but highly effective. By the end of the video, you'll find we can make the algorithm around 120x faster than the naive implementation. Join the Discord server: discord.gg/ux9BKSu4eg My GitHub profile: github.com/fangjunzhou The source code used in this video: github.com/fangjunzhou/blas-playground Motion Canvas official repository: github.com/motion-canvas/motion-canvas My custom fork of Motion Canvas: github.com/fangjunzhou/motion-canvas

Why it's here

2 people recommend this

What people say. Recommended for understanding how cache locality and memory hierarchy affect software performance.

u/Exhausted-Engineerin r/compsci • Recommends

On “Feedback on my matrix multiplication algorithm”

…A12] * B11 B12 = A11*B11+A12*B21 A11*B12+A12*B22 = C A21 A22 * B21 B22 A21*B11+A22*B21 A21*B12+A22*B22 ``` If you choose a block size that fits in your cache, you will lower the number of cache misses / page fault and increase the overal efficiency. This is what BLAS/LAPACK/ATLAS does. I'd recommend you watch this video : link to this video…

u/tandonhitenin r/C_Programming • Recommends

On “Fastest possible way to calculate distance between 2 points?”

It seems that you don't understand the performance game. Performance of a software, CANNOT be measured before it's run. Watch the following videos about optimisations to get insight as to why 1. GEMM optimisations 2. Branchless programming 3.Sorting Olympics