Optimization barriers | Pintos Documentation
An optimization barrier is a special statement that prevents the compiler from making assumptions about the state of memory across the barrier. The compiler will not reorder reads or writes of variables across the barrier or assume that a variable’s value is unmodified across the barrier, except for local variables whose address is never taken. In Pintos, threads/synch.h defines the barrier() macro as an optimization barrier. One reason to use an optimization barrier is when data can change asynchronously, without the compiler’s knowledge, e.g. by another thread or an interrupt handler. The too_many_loops function in devices/timer.c is an example. This function starts out by busy-waiting in a loop until a timer tick occurs: Without an optimization barrier in the loop, the compiler could conclude that the loop would never terminate, because start and ticks start out equal and the loop itself never changes them. It could then “optimize” the function into an infinite loop, which would def
Optimization barriers | Pintos Documentation Skip to main content Menu Expand (external link) Document Search Copy Copied Pintos Documentation Optimization barriers An optimization barrier is a special statement that prevents the compiler from making assumptions about the state of memory across the barrier. The compiler will not reorder reads or writes of variables across the barrier or assume that a variable’s value is unmodified across the barrier, except for local variables whose address is never taken. In Pintos, threads/synch.h defines the barrier() macro as an optimization barrier. One r
Explore this link on the map →related reading
- Memory Barriers Are Like Source Control Operationspreshing.com
- Who ordered memory fences on an x86? | Bartosz Milewski's Programming Cafebartoszmilewski.com
- Compiler Optimizations Are Hard Because They Forget - Faultlorefaultlore.com
- How to Optimize a CUDA Matmul Kernel for cuBLAS-like Performance: a Worklogsiboehm.com
- research!rsc: Hardware Memory Models (Memory Models, Part 1)research.swtch.com
- LittleBookOfSemaphores.pdfgreenteapress.com
- Optimization of Computer Programs in Cicps.u-strasbg.fr
- abseil / Performance Hintsabseil.io
- Compilers - What Every Programmer Should Know About Compiler Optimizations | Microsoft Learnlearn.microsoft.com
- Barrier resilience - Wikipediaen.wikipedia.org
- Zenbleedlock.cmpxchg8b.com
- Paul Buchheit: Optimizing everything: some details matter a lot, most don'tpaulbuchheit.blogspot.com