Master the fundamental concepts of cache optimization through this focused micro-challenge.
Intel's PREFETCHT0/PREFETCHNTA instructions move data into cache hierarchy levels with different temporal hints. PREFETCHNTA targets streaming data with minimal cache pollution. Assembly kernels in BLAS and video codecs use these when compilers cannot infer access patterns.
PREFETCHT0 brings data close for reuse. PREFETCHNTA treats data as non-temporal, helpful for one-pass scans. Mis-tuned prefetch still costs retirement bandwidth.
nasmLoading…
perf stat -e L1-dcache-load-misses before and afterKeep the relevant documentation open while you implement. When your output disagrees with the reference, trace one failing case by hand before changing random lines.
You will write a small assembly or intrinsic loop that issues PREFETCHT0 ahead of loads and report timing impact. This exercise requires explaining when hardware prefetch already covers the access pattern.
Demonstrate hardware prefetch instruction.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github