roadmap
play

Roadmap Memory & Data Integers/FP Machine code - PDF document

University of Washington Roadmap Memory & Data Integers/FP Machine code Assembly programming (x86) Procedures/Stacks Memory and caches


  1. University ¡of ¡Washington ¡ Roadmap ¡ ¢ Memory ¡& ¡Data ¡ ¢ Integers/FP ¡ ¢ Machine ¡code ¡ ¢ Assembly ¡programming ¡(x86) ¡ ¢ Procedures/Stacks ¡ ¢ Memory ¡and ¡caches ¡ ¡ ¡ ¡ ¡ ç ç ¡ ¡We ¡are ¡here! ¡ ¢ Processes ¡ ¢ Virtual ¡Memory ¡ ¢ Memory ¡AllocaJon ¡ ¢ Java ¡vs ¡C ¡ Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 1 ¡ University ¡of ¡Washington ¡ Making ¡memory ¡accesses ¡fast! ¡ ¢ Memory ¡hierarchy, ¡caches, ¡locality ¡ ¢ Cache ¡organizaJon ¡ ¢ Program ¡opJmizaJons ¡that ¡consider ¡caches ¡ Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 2 ¡

  2. University ¡of ¡Washington ¡ How ¡does ¡execuJon ¡Jme ¡grow ¡with ¡SIZE? ¡ int array[SIZE]; int A = 0; for (int i = 0 ; i < 200000 ; ++ i) { for (int j = 0 ; j < SIZE ; ++ j) { A += array[j]; } } TIME Plot SIZE Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 3 ¡ University ¡of ¡Washington ¡ Actual ¡Data ¡ Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 4 ¡

  3. University ¡of ¡Washington ¡ Problem: ¡Processor-­‑Memory ¡Bo]leneck ¡ Processor ¡performance ¡ doubled ¡about ¡ ¡ Bus ¡bandwidth ¡ every ¡18 ¡months ¡ evolved ¡much ¡slower ¡ Main ¡ CPU ¡ Reg ¡ Memory ¡ Core ¡2 ¡Duo: ¡ Core ¡2 ¡Duo: ¡ Can ¡process ¡at ¡least ¡ Bandwidth ¡ 256 ¡Bytes/cycle ¡ 2 ¡Bytes/cycle ¡ Latency ¡ 100 ¡cycles ¡ Problem: ¡lots ¡of ¡wai4ng ¡on ¡memory ¡ Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 5 ¡ University ¡of ¡Washington ¡ Problem: ¡Processor-­‑Memory ¡Bo]leneck ¡ Processor ¡performance ¡ doubled ¡about ¡ ¡ Bus ¡bandwidth ¡ every ¡18 ¡months ¡ evolved ¡much ¡slower ¡ Main ¡ CPU ¡ Reg ¡ Cache ¡ Memory ¡ Core ¡2 ¡Duo: ¡ Core ¡2 ¡Duo: ¡ Can ¡process ¡at ¡least ¡ Bandwidth ¡ 256 ¡Bytes/cycle ¡ 2 ¡Bytes/cycle ¡ Latency ¡ 100 ¡cycles ¡ Solu4on: ¡caches ¡ Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 6 ¡

  4. University ¡of ¡Washington ¡ Cache ¡ ¢ English ¡definiJon: ¡a ¡hidden ¡storage ¡space ¡for ¡provisions, ¡ weapons, ¡and/or ¡treasures ¡ ¡ ¢ CSE ¡DefiniJon: ¡computer ¡memory ¡with ¡short ¡access ¡Jme ¡ used ¡for ¡the ¡storage ¡of ¡frequently ¡or ¡recently ¡used ¡ instrucJons ¡or ¡data ¡(i-­‑cache ¡and ¡d-­‑cache) ¡ ¡ more ¡generally, ¡ ¡ used ¡to ¡opJmize ¡data ¡transfers ¡between ¡system ¡elements ¡ with ¡different ¡characterisJcs ¡(network ¡interface ¡cache, ¡I/O ¡ cache, ¡etc.) ¡ Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 7 ¡ University ¡of ¡Washington ¡ General ¡Cache ¡Mechanics ¡ Smaller, ¡faster, ¡more ¡expensive ¡ Cache ¡ 8 ¡ 9 ¡ 14 ¡ 3 ¡ memory ¡caches ¡a ¡ ¡subset ¡of ¡ the ¡blocks ¡ Data ¡is ¡copied ¡in ¡block-­‑sized ¡ transfer ¡units ¡ Larger, ¡slower, ¡cheaper ¡memory ¡ Memory ¡ viewed ¡as ¡parJJoned ¡into ¡“blocks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in ¡block ¡b ¡is ¡needed ¡ Request: ¡12 ¡ Cache ¡ 8 ¡ 9 ¡ 14 ¡ 3 ¡ Memory ¡ 0 ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 7 ¡ 8 ¡ 9 ¡ 10 ¡ 11 ¡ 12 ¡ 13 ¡ 14 ¡ 15 ¡ Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 12 ¡

  7. University ¡of ¡Washington ¡ General ¡Cache ¡Concepts: ¡Miss ¡ Data ¡in ¡block ¡b ¡is ¡needed ¡ Request: ¡12 ¡ Block ¡b ¡is ¡not ¡in ¡cache: ¡ Cache ¡ 8 ¡ 9 ¡ 14 ¡ 3 ¡ Miss! ¡ Memory ¡ 0 ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 7 ¡ 8 ¡ 9 ¡ 10 ¡ 11 ¡ 12 ¡ 13 ¡ 14 ¡ 15 ¡ Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 13 ¡ University ¡of ¡Washington ¡ General ¡Cache ¡Concepts: ¡Miss ¡ Data ¡in ¡block ¡b ¡is ¡needed ¡ Request: ¡12 ¡ Block ¡b ¡is ¡not ¡in ¡cache: ¡ Cache ¡ 8 ¡ 9 ¡ 14 ¡ 3 ¡ Miss! ¡ Block ¡b ¡is ¡fetched ¡from ¡ Request: ¡12 ¡ memory ¡ Memory ¡ 0 ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 7 ¡ 8 ¡ 9 ¡ 10 ¡ 11 ¡ 12 ¡ 13 ¡ 14 ¡ 15 ¡ Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 14 ¡

  8. University ¡of ¡Washington ¡ General ¡Cache ¡Concepts: ¡Miss ¡ Data ¡in ¡block ¡b ¡is ¡needed ¡ Request: ¡12 ¡ Block ¡b ¡is ¡not ¡in ¡cache: ¡ Cache ¡ 12 ¡ 8 ¡ 9 ¡ 14 ¡ 3 ¡ Miss! ¡ Block ¡b ¡is ¡fetched ¡from ¡ Request: ¡12 ¡ memory ¡ Block ¡b ¡is ¡stored ¡in ¡cache ¡ Memory ¡ 0 ¡ 1 ¡ 2 ¡ 3 ¡ • Placement ¡policy: ¡ determines ¡where ¡b ¡goes ¡ 4 ¡ 5 ¡ 6 ¡ 7 ¡ • Replacement ¡policy: ¡ 8 ¡ 9 ¡ 10 ¡ 11 ¡ determines ¡which ¡block ¡ 12 ¡ 13 ¡ 14 ¡ 15 ¡ gets ¡evicted ¡(vicAm) ¡ Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 15 ¡ University ¡of ¡Washington ¡ Lets ¡think ¡about ¡those ¡numbers ¡ ¢ Huge ¡difference ¡between ¡a ¡hit ¡and ¡a ¡miss ¡ § Could ¡be ¡100x, ¡if ¡just ¡L1 ¡and ¡main ¡memory ¡ ¢ Would ¡you ¡believe ¡99% ¡hits ¡is ¡twice ¡as ¡good ¡as ¡97%? ¡ § Consider: ¡ ¡ cache ¡hit ¡Ame ¡of ¡1 ¡cycle ¡ miss ¡penalty ¡of ¡100 ¡cycles ¡ Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 16 ¡

  9. University ¡of ¡Washington ¡ Lets ¡think ¡about ¡those ¡numbers ¡ ¢ Huge ¡difference ¡between ¡a ¡hit ¡and ¡a ¡miss ¡ § Could ¡be ¡100x, ¡if ¡just ¡L1 ¡and ¡main ¡memory ¡ ¢ Would ¡you ¡believe ¡99% ¡hits ¡is ¡twice ¡as ¡good ¡as ¡97%? ¡ § Consider: ¡ ¡ cache ¡hit ¡Ame ¡of ¡1 ¡cycle ¡ miss ¡penalty ¡of ¡100 ¡cycles ¡ § Average ¡access ¡Ame: ¡ § ¡ ¡97% ¡hits: ¡ ¡1 ¡cycle ¡+ ¡0.03 ¡* ¡100 ¡cycles ¡= ¡4 ¡cycles ¡ § ¡ ¡99% ¡hits: ¡ ¡1 ¡cycle ¡+ ¡0.01 ¡* ¡100 ¡cycles ¡= ¡2 ¡cycles ¡ ¢ This ¡is ¡why ¡“miss ¡rate” ¡is ¡used ¡instead ¡of ¡“hit ¡rate” ¡ Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 17 ¡ University ¡of ¡Washington ¡ Why ¡Caches ¡Work ¡ ¢ Locality: ¡Programs ¡tend ¡to ¡use ¡data ¡and ¡instrucJons ¡with ¡ addresses ¡near ¡or ¡equal ¡to ¡those ¡they ¡have ¡used ¡recently ¡ ¡ Autumn ¡2012 ¡ Memory ¡OrganizaJon ¡ 18 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend