eecs 570 designing cache coherence protocol using … · •looks like pascal…sorta...

27
Murphi Slide 1 EECS 570 EECS 570 Designing Cache Coherence Protocol using Murphi Winter 2018 http://www.eecs.umich.edu/courses/eecs570/ Slides developed in part by Profs. Adve , Falsafi , Hill, Lebeck , Martin, Narayanasamy, Nowatzyk , Reinhardt, Roth, Smith, Singh, and Wenisch.

Upload: trantruc

Post on 09-Sep-2018

234 views

Category:

Documents


0 download

TRANSCRIPT

MurphiSlide 1EECS 570

EECS570DesigningCacheCoherenceProtocolusingMurphi

Winter2018

http://www.eecs.umich.edu/courses/eecs570/

Slides developed in part by Profs. Adve, Falsafi, Hill, Lebeck, Martin, Narayanasamy, Nowatzyk, Reinhardt, Roth, Smith, Singh, and Wenisch.

MurphiSlide 2EECS 570

Cache Coherence•Why?

❒ Inthepresenceofcaches,orchestrateaccesstosharedmemoryinamulti-coresystem

•What?❒ Aloadreturnsthemostrecentvaluewritten❒ Forasinglememorylocation only

• How?❒ Well,manymanyflavors!

MurphiSlide 3EECS 570

Cache Coherence – How?• Interconnectionnetwork

❒ Bus:Snoop-basedprotocols❒ Point-to-point:Directory-basedprotocols

• Stablestates?❒ VI,MSI,MESI,MOSI,MOESI

• Optimizationsemployed– countlesspapers!!❒ 3-hopvs4-hop❒ Self-downgrade(M->S)❒ Cruisemissileinvalidations,etc.

MurphiSlide 4EECS 570

Basic Directory Operation: Read

LoadA (miss)Node #1 Directory Node #2

A: Shared,#1

42

MurphiSlide 5EECS 570

Basic Directory Operation: Write

LoadA (miss)Node #1 Directory Node #2

A: Shared,#1

A:Mod.,#2

42

4296

LoadA (hit)

..oops

StoreA (hit)

MurphiSlide 6EECS 570

Basic Directory Operation: Write

LoadA (miss)Node #1 Directory Node #2

A: Shared,#1

A:Mod.,#2

42

4296

StoreA (hit)

MurphiSlide 7EECS 570

Deadlock!

• Protocoldeadlock❒ Waitforamessagethatisneversent❒ Solution: Designyourstatemachinecorrectly

• Networkdeadlock❒ Coherencemessagesholdresourcesincircularmanner❒ Solution:Dedicatedvirtualnetworksfordifferentmessages

MurphiSlide 8EECS 570

Virtual Networks• Solvenetwork-dependentdeadlocks

❒ HaveseparateVNforeverymessageclass

MurphiSlide 9EECS 570

Assignment II: Objectives• LearntodesignaCCprotocol

❒ Comeupwithastatetransitiondiagram

• Learnaformalverificationlanguage(Murphi)• DescribeyourCCprotocolinMurphi andverifyit• Requirements

❒ Verifywithatleast3processors,1memorylocation❒ Connectedviaanarbitraryinterconnect

❍ Networkcanreordermessagesarbitrarily❍ Infinitebuffersforthisassignment❍ Multiplelanes(asmanyasyoudecideyouneed)

❑ Virtualchannelscosthardwarearea,sooptimizeonthenumberofchannelsyoucreate

• Directory-basedmemoryunit(thedirectoryisco-locatedwiththememory)

MurphiSlide 10EECS 570

Assignment II: Grading

❒ Waypoint– 10%❒ Correctness– 60%❒ “Quality”ofinvariants&baseprotocol– 10%

❍ Willevaluatethisbychangingsomecasesandcheckifinvariantsfail

❒ Optimizationcorrectness– 10%❒ Optimizationdifficulty– 10%

MurphiSlide 11EECS 570

Murphi• "ProtocolVerificationasaHardwareDesignAid,"DavidL.Dill,AndreasJ.Drexler,AlanJ.Hu andC.HanYang,1992

• Formalverificationoffinitestatemachines❒ Statespaceexploration– exploresallreachablestates❒ Tracksqueueof“to-be-explored”states❒ Keepsgianttableofallpreviouslyvisitedstates❒ Canonicalrepresentations&hashingmakeitefficient❒ Exploitssymmetrytocanonicalize redundantstates

MurphiSlide 12EECS 570

Murphi Language• LookslikePascal… sorta• User-defineddatatypes&structures• Rules indicatenon-deterministicstepsbetweenstates• Invariants andasserts confirmprotocolcorrectness• Scalarsets andmultisets datatypescapturesymmetry

MurphiSlide 13EECS 570

State Space Exploration

• Identifystates.❒ Bothstableand

transient

• Actions:❒ Identifyactions❒ Prerequisiteforan

actiontohappen?❒ Whatisthe

outcome?

• Invariants:❒ Toensureprotocolcorrectness❒ Example?

MurphiSlide 14EECS 570

Murphi Examples• Pingpong.m

❒ Atwo-playerping-ponggame

• Twostate.m❒ A4-hop,2-statevalid-invalid(VI)coherenceprotocol❒ Agoodstartingpointforyourproject

MurphiSlide 15EECS 570

How to Begin?• Downloadmurphi_eecs570.tar.gz fromthecoursewebsite

• CanuseCAENoranyotherLinuxsystemforthisassignment❒ TocompiletheMurphi codebase

tar -xvf murphi_eecs570.tar.gzcd Murphi3.1/srcmake mu

❒ TocompileyourMurphi codecd Murphi3.1/eecs570_sample./mu twostate.mmake twostate./twostate

❒ Output❍ Noerrorfound.❍ StateSpaceExplored:259states,894rulesfiredin0.10s.

MurphiSlide 16EECS 570

Important!• ReadtheMurphi UserManual

Murphi3.1/doc/User.Manual

• Debuggingcangetnasty!❒ Themanualcontainsinformationonflagsthatwillhelpwith

debugging

MurphiSlide 17EECS 570

Murphi-Misc.• Startearly

❒ Anorderofmagnitudemoredifficultthanthe1st assignment

• Onechangeatatime❒ Startsimple,addincrementally❒ Compileateachstep❒ Useversioncontrolifyouplease(don’tsharecode!)

•Memory❒ YouwillsoonrunoutofdefaultmemoryallocatedforMurphi❒ Use:m<n>,nkilobyteswhilerunningexecutable

• ThisisIndividualassignment;youaresubjecttoHonorcoderegulations

MurphiSlide 18EECS 570

Designing a CC Protocol•MSIBaseProtocol• Figureoutdifferentmessagetypesneeded.• Nack-freeàMoredifficult• Allowsilentdropofcleandataormaintainprecisesharing?

❒ Whataretheimplications?

• Howmanyprotocollanesneeded?• Figureoutallthetransientstatesrequiredforprocessorsanddirectory

• Atleastoneoptimizationoveryourbaseprotocol

MurphiSlide 19EECS 570

3-Hop MSI Protocol

Howyouthinkitshouldlooklike

MurphiSlide 20EECS 570

3-Hop MSI Protocol

Howitreallylookslike

*Mysolution

MurphiSlide 21EECS 570

MESI w/ Self Downgrade on 4 ProcsWhatyouendupimplementing

MurphiSlide 22EECS 570

My Solutions• 3-hopMSI(NACK-free),3procs

❒ 47744states,207008rulesfiredin4.42s.

•MSI+Self-Downgrade+CruiseMissileInvalidation,4procs❒ 4690993states,27254378rulesfiredin1594.70s.

Numberofstatesexploredwillbedifferentforyourimplementation

MurphiSlide 23EECS 570

Optimizations (Easy to Hard)❒ Self-downgrade(spontaneousM->S)❒ MESI,directorymayprovideEinresponsetoreads❒ Migratorysharingoptimization❒ Addanownedstate❒ Cruisemissileinvalidations❒ 2-hopspeculativerequests❒ Occupancy-freedirectory❒ 2directorieswithdirectorymigration/delegation❒ SCI-styledistributedsharerlists

TalktoProf.Narayanasamyormeifyouwanttodosomethingelse!

MurphiSlide 24EECS 570

Deliverables•Waypointreport:<uniqname>.pdf (dueon3/12)• Finalsubmission(dueon3/26)

•WhenIsay.zip,Imean.zipandNOT.taror.7zor.rar❒ Sticktofilenames(lowercase)anddirectorystructure

• Filedescriptions❒ msi.m :BaselineMSI,turnoffoptimization❒ msi_opt.m :MSIprotocolwithoptimization❒ msi.out :Murphi outputforbaselineMSI❒ msi_opt.out :Murphi outputforMSIwithoptimization❒ report.pdf :Aspertheassignmentspecification;asalways,should

notexceed2pagesexcludingtheprotocoldiagrams

<uniqname>.zip

msi.m msi_opt.m msi.out msi_opt.out report.pdf

MurphiSlide 25EECS 570

Tip!• Thoroughlygoovertheprotocolsdescribedin

Sorin etal- APrimeronMemoryConsistencyandCacheCoherence,Ch.8

MurphiSlide 26EECS 570

Next Week…•Wednesday(2/14)

❒ ProjectMilestoneIReport❒ CourseEvaluationonCTools

❍ WillhelpmegoingforwardJ

• Thursday(2/15)andFriday(2/16)❒ ProjectMilestoneIMeetings

❍ Sign-upviaGoogleSheet(willbeannouncedonCanvas)

MurphiSlide 27EECS 570

All the best!