
Compiler optimizations merge adjacent operations to reduce memory traffic
Image: Emperor Genius (talk), CC BY-SA 3.0, via Wikimedia Commons
Compiler optimizations merge adjacent operations to reduce memory traffic
Compiler optimizations involve transforming code to improve resource usage. One common optimization technique is operator fusion, which merges adjacent operations to reduce memory traffic. This helps in minimizing the amount of data that needs to be stored and transferred, leading to more efficient execution.
Example
Consider an expression like a + b + c. Without optimization, each operation (a + b, then result + c) would require separate memory allocations. With operator fusion, the compiler combines these into a single operation, reducing the need for intermediate memory storage.
Remember this
Reducing memory traffic through operator fusion leads to more efficient use of resources, which is crucial for optimizing program performance in terms of execution time and memory usage.
Text adapted from Wikipedia, licensed under CC BY-SA 4.0.
fused kernels do
Why wait for a computer to finish one task before starting another?
kernel fusion reduces memory bandwidth bottleneck
Can you imagine faster video games without waiting for loading screens?
gradient checkpointing trades: recomputes activations to save memory
Gradient checkpointing trades off computation time for memory savings by recomputing activations
Triton differs from CUDA
Why does a super-fast computer sometimes run slower than a regular one?
Overlapping subproblems
Ever calculated a huge Fibonacci sequence by hand?
General-purpose computing on graphics processing units
Did you know your computer can do more than just compute numbers?
Swipe through 100 ML concepts daily
Open Pocket Polymath