A selective logging mechanism for hardware transactional memory systems
Abstract
Log-based Hardware Transactional Memory (HTM) systems offer an elegant solution to handle speculative data that overflow transactional L1 caches. By keeping the pre-transactional values on a software-resident log, speculative values can be safely moved across the memory hierarchy, without requiring expensive searches on L1 misses or commits.
Full text
ASelectiveLoggingMechanismforHardware TransactionalMemorySystems MarcLupon∗GrigoriosMagklis†AntonioGonz´ alez∗† [email protected] [email protected]@intel.com ∗ComputerArchitectureDepartment,UniversitatPolit` ecnica deCatalunya †IntelBarcelona ResearchCenter,IntelLabsBarcelona -UPC Abstract—Log-basedHardware TransactionalMemory (HTM)systemsoffer anelegantsolutiontohandle speculativedatathatoverflowtransactionalL1caches.Bykeeping thepre-transactionalvaluesonasoftware-residentlog, speculativevaluescan besafely movedacross thememory hierarchy,withoutrequiringexpensivesearchesonL1 missesor commits.Unfortunately,software loggingincurs significantoverheadsthatmay affect theperformance of applicationswithlargetransactions. Inthis paper,wepresentselectivelogging,anovel mechanismthataddstothesoftware-residentlog only the speculatively modifiedlinesthatoverflowthetransactional L1cache.In particular,wepresenthowtwodistinct HTMsystemscancombineselectiveloggingwith builtin transactionalcachestoimproveontheir performance. Our evaluationshowsthatselectiveloggingreducesthe latency of transactionalstores,speedsup theabortrecovery oflongtransactionsand increasestheutilizationof transactionalcaches.Whatis more,ourstudies showthat selectiveloggingprovidesmore flexibility,asit supports differentconflictmanagementstrategies. Keywords-Selectivelogging,log-basedHTMsystems, FASTM-SL,SPECTM I.INTRODUCTION Dataversion management(VM)isoneofthekey aspectsofHardwareTransactionalMemory(HTM) systemsthatemploy speculation toexecutetransactions[12].Thismechanismdefineshowand wherethe valuesgeneratedwithinatransaction arekept,aswell as whatactionsmustbesatisfiedatcommit and abort time. Thus,theVMstrategy followedwhenimplementing anHTMsystemdirectlyimpactstheperformance of transactionalapplicationsand the complexity ofthe hardwaredesign [4]. Ahigh-performance HTMsystem mustaccelerate transactionsofany size orduration.Tothisend,unboundedHTMsystemsincorporatehardwaresupport to maintain overflowing dataon theside.Log-basedHTM systems—thosethatstoretransactionalmodifications in-place inmemorywhilethey keep pre-transactional valueson asoftware-resident log [20]—arewidely acceptedasoneofthebestVMalternativesto handle thetransactionalstatebecausetheystrike a delicate balance betweencomplexity,hardware costand performance [2],[3],[13],[27]. Conventional logging mechanismsface three main challengesthatmayslowdowntransactionalexecution.First,writing pre-transactionalvaluestothelog alwaysbefore a transactionalstore enlargesthelatency oftransactionalstores—speculativevaluescannotbe writteninmemory until theold dataislogged.Second, thesoftwarelog ismaintainedincacheablememory, whichreducesthebuffering capacity ofthetransactionalcaches—in otherwords,thelogging mechanism increasesthepossibilitiesofevicting transactionaldata. Third,inlog-basedHTMsystemsall transactionally writtenlinesareplacedinthelog,evenifthespeculative datafitsintheL1cache.Thus,ifan overflowing transaction aborts,it hastorestorethewholelog using aslowsoftwareroutine,ignoring thebuilt-in hardware supportofthetransactionalcaches[1],[3],[16],[22]. What ismoreimportant,log-based dataversioning enforceseagerconflictmanagement(i.e.,conflictshave to beresolvedat themoment that theyareproduced), to guarantee thatonlyasingle copy ofatransactionally modifiedlineisaliveinthesystem.Nonetheless,previous studies showedthatmore aggressivepolicieslike lazyconflictmanagement(i.e.,memoryinconsistencies areresolvedwhentransactionsreachtheirend)obtain betterperformance results[24],[17].Unfortunately, thesepoliciesareincompatiblewithconventional logging mechanisms. In ordertoaddress the aboveissues,thispaper proposesselective logging,anovelVMtechniquethat onlylogsthepre-transactionalvaluesofthosemem- ory blocksthat thehardware cannotrecover—e.g.,a non-committedspeculativewritethatoverflowstransac- tionalbuffers.Similarto otherlog-basedHTMsystems, evictedspeculativedatais storedin-place intheshared levelsofthememory hierarchy; thereforeourproposal doesnotproduce delayson cachemissesorcommits. Theidea behind selectivelogging israthersimplebut effective.Byadding afewadditionalhardwarestepson resource overflows(uncommon event),we are ableto(i) acceleratemostofthememory updateswithinatransaction,(ii) reduce thesize ofthesoftwarelog,which acceleratesthe abortrecovery process (fewerlinesmust berestored by software)and (iii)provideflexible con-
For review.Pleasedo notdistribute flictmanagementfornon-overflowing memory blocks. Ourevaluation showsthatselectivelogging obtainsan averagespeed-up of36%comparedtomodernlogbasedHTMsystemswhenexecuting workloadsthat commonly overflowtransactionalbuffers. Themaincontributionsofthisworkaretwofold. First,wequantifythelimitationsofconventional logging inwell-knownHTMsystems.Second,weintegrate selectivelogging intotwo distinctHTMsystems.In particular,ourapproachisthefirst to offerdeferred resolution ofconflictsinalog-basedHTMframework. Theremainderofthepaperisorganizedasfollows.In Section II,wesummarize relatedwork on unbounded HTM,withspecialfocuson theVMmechanismfor overflowing data.InSection III,wedescribehowthe selectivelogging mechanismworksand discuss the hardwareimplementation.InSection IV,wepresent FASTM-SL,a caseforaneagerHTMwithselective logging,whileinSection V wedetail SPECTM,a case foralazyHTMthatsupportsearlymemory updates whenspeculativedata exceedstransactionalbuffers.In Section VIwe evaluateourproposalsand inSection VII we concludethe article. II.BACKGROUND INVMMECHANISMS EarlyHTMassumedfinitehardwaresupport(private transactionalcaches[11]orlocalstorebuffers[21]) to holdtransactionalmodifications,which disallowed the execution oftransactionsthatexceededthebuffering support.Asimplewayto permit suchtransactionsisfalling backtoaSoftwareTransactionalMemory(STM[23]) systemwhen buffersareoverflowed, whichiscommonly knownasHybridTM(HyTM) system[10],[14],[15].Unfortunately,STMs still incur significantoverheads[6]thatconsiderably downgrade theperformance ofapplicationswithmany largetransactions. Tospeed up the execution ofany kind oftransaction, severalHTMsystemsextend finitetransactionalbuffers withadditionalhardwaresupport—werefertothese approachesasunboundedHTMsystems.TheseHTM proposalsfall into oneoftwo distinctdesign strategies whileimplementing VMforoverflowing data: theyare eitherdeferred update(also knownaslazyVM)orlogbased(also knownasearlyupdateoreagerVM)HTM systems. Deferred updateHTMsystems[22]keep overflowed datahiddenfromin-flight transactionsusing specialized structures,suchasfirmware-accessedmemorystruc- tures(LTM[1]orVTM[22]),shadowmemory pages (PTM[7]orXTM[8]) oradditionalhardwaretables (FlexTM[25]orEazyHTM[26]).Whenthetransactionalbuffersareoverflowed,thesysteminsertsnew datainthesespecializedstructures,whereit iskept until thetransaction commits(newdataistransferred to globalmemory)oraborts(newdataisinvalidated). Also,ifthetransaction doesnotfind thedatainthe transactionalbuffers,deferred updateHTMsystems must traversethespecializedstructurestocheckifthe accessed datahasbeenmodified during thein-flight transaction.Hence,theseHTMsystemsaresubjected tolong delayswhentheyexecutetransactionsthat commonlyexceed on-chip dataversioning support. Ontheotherhand,log-basedHTMsystems[20] keep newstatein-place inmemory,holding thepretransactionaldatainasoftware-accessedlog thatcontainstheold valuesoftransactionallymodifiedlinesand theirassociatedaddresses[2],[3],[27].Inthe caseof abort,thesystem must triggeranexception and recover pre-transactionalvaluesusing auser-level(slow)softwareroutine.Nonetheless,commitsareimmediate— dataisalready placedinmemory.Thus,log-based HTMsystemsdo notsuffer fromresource overflowlike deferred updateHTMsystems,as speculativedata can besafelymovedacross thememory hierarchy. III.THESELECTIVELOGGING MECHANISM Forourselectivelogging implementation,we assume aChipMultiprocessor (CMP)withsingle-threaded coresand twolevelsofcaches:aprivate,transactional L1cachethat trackstransactionallymodified datausing newcoherence states[1],[3],[16],[22]and adistributed,sharedL2cachethatkeepspre-transactional valuesofnon-replaced data.Coherencyisimplemented using adirectory placedclosetotheL2cache. InHTMsystemswithselectivelogging,transactional storesdo notcarryadditionalactions—i.e.,it isnot necessarytowriteinthelog theoldstatebefore updating thememory.However,whenatransactional lineisevictedfromtheL1cache,theprocessorstops conventionalexecution (thememoryinstruction that generatesthe cachemiss remainsincomplete)and starts executing amicrocoderoutinethat loadstheold value ofthelinefromtheL2cacheintoaspecialregister, and storestheold data and the corresponding memory address inthefirstfree entry ofthesoftwarelog.After that,theprocessor re-schedulesthememoryinstruction thatproducedthe cachereplacementand continues executing thetransaction. Likeotherlog-basedHTMsystems,commitsdo not require additionalactions,giventhat thetransactional state can harmlesslyflowthough thememory hierarchy. Nonetheless,whenan overflowing transaction aborts it hasto performatwo-phaseprocedure.First,the hardwareinvalidatesall thetransactional linesinthe L1cache,clearing thetransactionalstatefromcaches. Then,theprocessorthrowsanexception and trapsto theuser (orsystem)softwarelayer,which undoesthe modificationsintroduced by thetransaction. 2
For review.Pleasedo notdistribute A.Pushing MemoryAddressesintheLog By deferring log updatestoL1eviction time,selective logging requiresasubtlemodification tothewaythe log is storedinmemory.Morespecifically,traditional log-basedHTMsystemsuselogicaladdressestotrack thelocation ofpre-transactionaldata.Logicaladdresses arereadilyavailable at thetransactionalstoreissuetime (i.e.,thetimethelog infoiscollected).Thebenefitof using logicaladdressesinthelog isthat thesoftware recoveryroutine can bedonein user-space. Inselectivelogging,on theotherhand,thesystem collectsthelog infoat thetime a L1cachelineis evicted.At thispoint,logicaladdressesarenotavailable (mostmemorysystemsusephysicaladdresses),but using physicaladdressesinthelog posesasecurityrisk though. In ordertoaddress the aboveissues,weproposeto movethetransaction abortrecovery handlerintheOperating System(OS).Inthiscase,whenan overflowing transaction aborts,thehardwareraisesanexception that callstheOSabortrecoveryroutine.TheOSrecoversthe log,using physicaladdresses,and returnscontrol tothe application.Notethat logical-to-physical translation is notneededwhentheOSisundoing thelog—theTLB isautomatically bypassed. Moreover,the actual log memorymustbeonly visible totheOS,otherwiseuserapplicationscanreverseengineerthelogical-to-physicalmemorymapping.This requiresthat transactionalapplicationsexecute a log creation systemcall at init time.Thememory ofthe log isthuskept inOSmemory,and ishiddenfromthe application. Inthenextsections,weshowhowselectivelogging can be efficientlyimplementedintwo differentHTM environments.Forthose casestudies,we assumethat thelog containsphysicaladdresses,and thusit hasto berecoveredin privilegedmode. IV.ACASEFORSPECULATIVELOGGING INEAGER HTMSYSTEMS Inthis section,firstwedescribeFASTM,thatweuse asourstarting pointforaneagerHTMsystem[16], and thenwe coupleFASTMwithselectivelogging to furtherimproveitsperformance. A.TheBaseFASTMSystem FASTMisalog-basedHTMsystemthatcombines earlymemory updatesforoverflowing datawith deferredmemory updatesfortransactionsthatfit inthe L1cache.InFASTM,transactionalupdatesarestored intheL1cacheinaspecialstate(calledT),until thetransaction commits,aborts,oruntil the cache lineisevicted.Thesystem mustguarantee thatbefore transitioning alinetotheTstate,thepre-transactional valueofthelineiswritten backtotheL2cache(by Figure1.L1CachereplacementactionsinFASTM-SL forcing awrite-back).Thisguaranteesthat thememory hierarchy alwaysholdsthe correctpre-transactionaldata fortransactionallymodifiedlinesthatarenotevicted fromtheL1cache. Whenatransaction aborts,it checksifany Tlines havebeenevicted.If not,all transactionallywrittenlines intheL1cache areinstantlyinvalidated,enabling a veryfastabortrecovery.Foroverflowing transactions, FASTMwalksthelog using asoftwareroutine,similar toLogTM[20].SimilartoLogTM-SE[27],FASTMintroducesRead and Write Signaturestomaintaina supersetofthememorylocationsaccessedwithina transaction. Inthis section,wedescribehow we extend the FASTMinfrastructurewithselectivelogging—we call this systemFASTM-SL.FASTM-SLdiffersfrom FASTMinthewayit updatesthesoftwarelog and how it recoversthepre-transactionalstatewhenaborting an overflowing transaction.WhileFASTMlogsthevalues ofall transactionalstores(at least thefirst timethey write a lineinside a transaction),FASTM-SLonlylogs thevaluesoftransactionalevicted data.Thus,ifan overflowing transaction aborts,FASTMhastorestore the entirepre-transactionalstateby software.Instead, FASTM-SLcantake advantagefromtheinnatein-cache supportforclearing non-evictedcachelines. B.L1CacheEvictions Whenatransactionallywrittenlineisevictedfrom theL1cache,FASTM-SLhastoconstructanewlog entry.Weusethe exampleofFigure1to describehow theselectivelogging machinery handlesthe eviction of aT-stateline(step 1).First,the eviction process isput on hold,and the coresendsarequest totheL2cache forthepreviousversion oftheline(step 2). 3
For review.Pleasedo notdistribute Therequested data,togetherwiththephysicaladdress oftheline aretemporarilystoredinaspecialregister. At thispoint,thedatainthespecialregisteriswritten tothefirstfree entry ofthelog using regular (i.e., non-transactional)memory operations(step 3),and the physicaladdress ofthelineisaddedtotheWrite Signature(step 4).Finally,thetransactional lineis evictedtotheL2cache. C.Hardware/SoftwareAbortRecovery Whenan overflowedtransaction aborts,FASTM- SLhastorestorethevaluesmodified during itsexecution.Fornon-evicted datait isenough toinvalidate T-statelines(by flash-clearing thestatebits),aspretransactionalvaluesarestill validintheL2cache. However,transactionalreplaced datahasto berestored by softwarebecausetheL2cachedoesnotholdtheold state anymore.Hence,thesystemtriggersanexception, whichjumpstoanOperating Systemroutinethatwalks thelog inreverseorderto undo the changesintroduced by the abortedtransaction. Notethat,incontrast toFASTM,FASTM-SLonlyhas torestorethoselinesthathavebeenevictedfromtheL1 cacheduring thein-flight transaction—thoselinesthat fit intheL1cache areinvalidated by theunderlying hardware and,eventually,the corewill obtainthevalid datafromtheL2cacheusing conventionalcoherence requestswhenthetransaction restarts.Asaresult,the size ofthelog (and thusthetimespent insoftware abort recovery)isreducedconsiderably. V.ACASEFORSPECULATIVELOGGING INLAZY HTMSYSTEMS Tothebestofourknowledge,all HTMsystemsthat postponetheresolution ofconflicts(e.g.,lazyconflict management)implementdeferred updateVMtostore theoverflowing speculativestate[11],[8],[26].Instead, ourapproach(we call it SPECTM)takesan opposite direction when dealing withspeculativedatathatexceedthesize oftheL1cache:oursystemimplements earlyupdateVMon overflowing data,moving pretransactionaldatatothesoftwarelog and placing new dataon thesharedlevelsofthememory hierarchy. A.TheBaseSPECTMSystem SPECTMassumesasimplification oftheUTCPcoherence protocol implementedin[17],whichallows multipleversionsofthesamememorylinein distinct L1caches.LikeFASTM,non-conflicting transactional updatesareheldintheTstate.However,conflicting linesarekept intwoseparatestates:Rfor readsand W forwrites.Pre-transactionalvaluesofnon-evictedcache linesare alwayskept intheL2cache. SimilartoFlexTM[25]orEazyHTM[26],cores use a conflict list(CL)totrackthosetransactionswith Figure2.Partialconsistencytransitionson theUTCPprotocol whomthey have a conflictwith.Before committing, transactionsmustrequest the abortofthosetransactions thatarepresent intheCL.If theCL isempty,the commit process startsimmediately.Afterthat,thetransactional statebecomesglobally visible—Tand Wlinestransit to Modified,and Rlinestransit toInvalid. Using earlyupdateson overflowing datapresents non-trivialchallengesforSPECTM.First,HTMsystems withlazyconflictmanagementallowmultipleversions ofalinein distinctL1caches.However,beforereplacing a cacheline,thesystem mustguarantee that the evicting coreistheuniqueownerofthat line,because thatcoreisresponsibleof restoring itsoldstateifthe transaction aborts.Thus,an overflowing linemustonly have a single copy inthesystem. Second,ourapproachmovesoverflowing datatothe sharedmemoryspace,overwriting theoldstatekept in theL2cache.Astheold valueoftheline can no longer beobtained,thesystem mustpreventremotetransactionstoaccess transactionallyevictedlines,preserving thoselinesisolatedfromtheworld until thetransaction commitsoraborts. Toachievethe abovegoals,SPECTMaddstwo novel mechanisms:PartialConsistency and OverflowIsolation.Thenextsectionsdescribehowthesemechanisms operate aswell ashowtheyareimplemented. B.PartialConsistency Beforewriting backthevalueofthetransactionally modifiedcacheline,thesystem mustensurethat there areno live copiesofthelinein otherprivateL1caches. ThisisastraightforwardstepforconsistentT-state lines,astheyare exclusively owned by asingle core. However,conflicting writtenlines—thoselinesthathave beenmovedtotheWstate and thuspotentially havemultiplereaders/writersin non-committedtransactions— require additionalactionstoeliminatenon-compatible values. In ordertoinvalidate all thetransactionalsharers ofthe cacheline,the evicting coresendsanAbort notification toall the coresthatarepresent initsCL, 4
For review.Pleasedo notdistribute following exactlythesameprocedure asatcommit time. Whentheremote coresreceivethatmessage,theyabort, evenifthey havenot touchedthe evictedcacheline withintheirtransactions.If anaborting transaction has already overflowedtheL1cache—i.e.,thesoftwarelog isnotempty—thenthe coremustrecovertheoldstate using theproceduredescribedinSection IV-C. Afterthe abortprocess ends successfully,the evicting coreis safetowritebackthespeculativevalueinthe L2cache.However,beforethat,the core(i)transitsall theW-statelinestoT,(ii)clearstheCL listand (iii) insertsthememoryaddress ofthe evictedcachelinein theWrite Signature. PartialConsistency guaranteesthat thereplacedcache linehasauniqueownerinthesystem,aspotential conflictershave aborted.What ismore,it also guaranteesthat,at thatpoint,everylinebeing written insidethetransaction only belongstotheoverflowing transaction.Nonetheless,that transaction isnotentirely isolatedfromtherest,asconflicting readlines—those kept intheRstate—maystill befound inthewrite setofotherin-flight transactions.Figure2showshow PartialConsistencymodifiesthetransitionsoftheUTCP Coherence Protocol. C.OverflowIsolation InSPECTM,overflowing datamustbepreservedin isolation—noin-flight transaction canaccess thatdata until thetransaction commitsoraborts.To guarantee that invariant,whena corereceivesa coherence requestfromaremotetransaction,it checksitsWrite Signature.If the address ispresent inthefilter,then the corereplieswithanAbortmessage,and theremote transaction abortsimmediately. Notethatoverflowing transactionsmay produce cascadesofaborts(eitherwhenthere are continuousevictionsoftransactionaldataorwhen overflowing transactionsaccess speculativedatathathasbeenmoved outoftheL1cache).Asthesetransactionshaveto berecovered by software,wedecidedto performa randomizedexponentialbackoff beforerestarting the transaction.This strategy reducescontention toensure forward progress inthe application. Forexemplifying howoverflowing dataiskept in isolation,we assume a transaction Ti thathaswritten linesAand B,and atransaction Tj thathasaccessed lineB.Eventually,Ti replaceslineAfromtheL1cache, causing the abortoftransaction Tj.At thatmoment, all transactionallywrittenlinesby transaction Ti are consistent,including blocksAand B.Afterthat,we assumethatanothertransaction Tk attemptstowritethe evictedlineA.However,thesystemdeniesthe access to preservetheisolation oftheoverflowedcacheblock, aborting transaction Tk. Core1.2GHzin-order,singleissue,single-threaded L1cache32 KB4-way,64-byteline, write-back,2-cyclelatency L2cache16 MB8-way,bankedNUCA, write-back,15-cyclelatency Memory 4 GB,4 banks,150-cyclelatency DirectoryBit vectorofsharers/owners,6-cyclelatency Interconnect16-nodeMesh,64-bytelinks,2-cyclewire latency,1-cyclerouterlatency CoherencyUnifiedTransactionalCoherence Protocol Signatures2KbParallelCuckoo Bloomfilters TableI BASESYSTEMPARAMETERS VI.EVALUATION Forourevaluation ofselectivelogging,we assume aChipMultiprocessor (CMP)with 16 coresand two levelsofcaches,wherethefirst level(L1)isprivate and thesecond level(L2)is sharedamong all the cores.Coherencyisimplemented using ablocking, distributed directory placedintheL2cache.Thesystem hasa16-nodemeshinterconnect thatuses64-bytelinks withadaptiverouting.Each nodehasa core,apiece ofasharedL2cache and partofthedirectory.The systemhasfourmemorycontrollerstoaccess 4GBof mainmemory.Eachcoretrackstransactionalmemory accessesintwo 2 Kbit Read and Write Signatures. DetailedsystemparametersareshowninTableI. AcompleteHTMsystemhasbeensimulated using theSimics[18]infrastructurefromVirtutechand the GEMS[19]toolsetfromWisconsin’sMultifacetgroup. Forourperformance analysis,wehave chosenaset ofapplicationsfromtheSTAMPbenchmarksuite[5] and three in-housebenchmarksthatperformatomic operationsin hugedatastructures.Wehaveselected those applicationsbecausetheytypicallyexecutelarge transactionsthatoverflowtheL1cache,and thusthey aremoresensitivetotheVMstrategy implementedin thebaseHTMsystem. TableII providesdetailedinformation about the applicationsweutilize.Thefirst three columns showthe benchmarksuite,thenameofthe application,and its inputparameters.Thefourthcolumn(Commit)shows thenumberofcommittedtransactionson the application,and thenext twocolumns showthe averagesize ofthereadset(RdSet)and thewriteset(Wr Set). Thesenumberswere collectedrunning FASTMwith 16 threads. A.BaseHTMSystems Forourperformance analysiswehave chosentocomparetheHTMsystemswithselectivelogging (FASTM- SLasaneagerHTMsystem,SPECTMasalazy HTMsystem)withtwo othersystemsthatuse conventional logging (FASTM[16]asaneagerHTMsystem, DYNTM[17]asalazyHTMsystem). 5
For review.Pleasedo notdistribute FASTMFASTM-SL SuiteBenchInputparametersCommitRdSetWr SetOV AbortsSWAbOV AbortsSWAb µbench Btree 50/50 ins/look,32 op/tx 2048 155.9 88.1 627 0.18 6.5%34 0.18 2.2% Lists16 lists,2Kupdates8192 30.4 30.2 802 0.53 7.7%9 0.42 0% Hash 25/50/25 ins/look/del4096 114.5 104.7 1814 0.67 12.6%830 0.63 4.6% STAMP Bayes32 vars,1024 records520 82.6 41.4 71 3.4 16%37 2.3 10% Labyrinth 32*32*3 maze,2Kroutes4128 111.8 101.6 2318 0.22 57.9%379 0.8 1% Vacation 64Kc,80%q,16 items 16384 143.1 22.4 2361 0.10 11%2080 0.16 9% Yada20 angle,633.2mesh 2966 32.2 14.3 511 2.01 2%24 2.0 0.6% TableII INPUTPARAMETERSAND CHARACTERIZATION OFTRANSACTIONALAPPLICATIONS ForFASTMand FASTM-SLweimplementedthe Stall conflictresolution policy[27],whichstopsthe conflicting requesteruntil theviolation disappears.To eliminatedeadlocksamong stalledtransactions,thesystemusesatimestamptoabort theyoungertransaction thatparticipatesina cycle.After recovery,arandomized exponentialbackoff isperformedtoavoidlivelocks. ForDYNTM,weremovethepredictor fromthe core to provide a faircomparison withSPECTM,afixed lazyHTMsystemthatcannotdynamicallyadapt its execution.Hence,thisDYNTMimplementation executes all thetransactionsthatfit intheL1inlazymode.If a transactionallywrittenlineleavestheL1,thesystem abortsthetransaction and restartsit ineagermode, whichis similartoFASTM. We alsocompareourproposalwithtwo(eagerand lazy)idealizedVMimplementationsthatserve asupperbounds.Theseimplementationsneverlog valuesin software; insteadthey keeptransactionallyevictedlines inaninfinitevictimcache.Thiscachehasthesame latencyastheL1for readsand writes.Thetransactionalvictimcachemovescommitted valuestotheL1 instantaneously,and it hasa zero-costabortrecovery— transactionalentriesarejustdiscarded. B.FASTM-SLPerformance Analysis Figure3 presentsthetimedistribution ofFASTM(labeledF),FASTM-SL(labeledS)and IdealEager (labeledE)HTMsystemsintheir16-threadedexecutions. The execution timehasbeen normalizedtothe16- threadedFASTMexecution and isbroken downto:nontransactionaland barriercycles(labeledNon-Txand Barrier),thetimespent incommitted(labeledGood Tx)and aborted(labeledAbortedTx)transactions,the time consumedinabortrecovery(labeledAborting), thetimethat transactionsremainstalledwaiting fora conflict to beresolved(labeledStalled),and thetime thatprocessorsexecutethe exponentialbackoff after aborting (labeledBackoff).Thenumberon top ofeach Figure3.Normalizedexecution time ofeagerHTMsystems barshowsthespeed-up achieved overasingle-threaded FASTMexecution. Asit can beseeninFigure3,FASTM-SLobtainsa 36%speed-up overFASTM(27%reduction ofexecution time),obtaining similarperformance totheIdeal Eagerapproach.Thebenefit isespecially noticeablein LabyrinthorVacation,whichachieve almost2Xspeed- up.Thereasonsforthisbehaviorarethefollowing. Small log size.Selectivelogging drasticallyreduces thenumberofcachelinesthathaveto bemaintained insoftware.Figure4showsthe averagesize (inKB) ofthesoftwarelog pertransaction inFASTMand in FASTM-SL.Selectivelogging drasticallylowersthesize ofthelog by afactorof15X(inHashalmosta100X). Thisfacthastwoimplications.First,there areless transactionsthatoverflowtheL1(TableII,labeledOV). Second,asthereismorespace intheL1forcaching transactionaldata,thehit rateoftheL1increaseshigher. Efficient transactionalstores.InFASTM-SL,transactionalstoresdo notneedtoaccess thesoftwarelog eachtimetheyareretired—onlywhentheyleavethe L1,whichisan uncommon event.Asaresult,thetime spent intransactionsthatcommit (Good TxinFigure3) isreduced by 14%on average. 6
For review.Pleasedo notdistribute Figure4.Softwarelog size inFASTMand FASTM-SL Fastabortrecovery.Incaseofabort,thesoftware hastorestorejustafewlines.Moreover,thenumberof software abortsisalsoreducedinFASTM-SLbecause less transactionsoverflowtheL1(TableII,labeled SWAb).Accordingly,Figure3showsthatFASTM- SLvirtuallyeliminatesthe abortrecovery overhead. Aspointed out in previous studies[16],speeding up abortscutsdownthetimethat transactionsare exposed toconflicts,whichturnsout tolowerthe abortrate (TableII,labeledAborts)and thetimespent inStall and Backoff cycles. Notice that thisevaluation onlyshowstheresults ofapplicationswithcoarse-grainedtransactions.Applicationswithsmall (non-overflowing)transactionsfrom STAMP(e.g.,KmeansorSsca2)or fromtheSPLASH2 benchmarksuiteonlyreportspeed-upsbetween 1%to 3%,butneverperformworseinFASTM-SL. C.SPECTMPerformance Analysis Figure5 presentsthetimedistribution ofDYNTM(labeledD),SPECTM(labeledS)and IdealLazy(labeled L)HTMsystemsintheir16-threadedexecutions.The execution timehasbeen normalizedtothe16-threaded FASTM-SLexecution and isbroken down using the same criterion fromFigure3,plusthetimespent in committing transactions(labeledCommit). Asit is showninFigure5,SPECTMoutperforms FASTM-SLin5ofthe7applications,all exceptLists and Yada.(FASTM-SListhebaselineinFigure5, whereitsexecution timeisnormalizedto 1).Thisis becauselazyHTMsystemspermit more concurrency thaneagerHTMsystemswhentransactionscollide, eliminatesomeread-writeviolationsand do notrequire backoff.Forinstance,Bayes,Btree and Labyrinthreduce FASTM-SLexecution timeup toa30%.Notethat Labyrinthachieves17Xspeed-up oversingle-threaded FASTMexecution whenit uses16 threadsbecause(i) the application scalesprettywell inlazymode and (ii)SPECTMdoesnot log valueson everytransactional store,whereasFASTMhasto do it. SPECTMobtainscloseperformance totheIdealLazy HTMsystem.Nonetheless,DYNTMcannotachieve such benefitsgiventhat it hastofallbacktoeagermode Figure5.Normalizedexecution time oflazyHTMsystems on overflows,thesamewaythatsomeHyTMs[9],[14] switchtoSTMexecution to handlelargetransactions. Thisresultstoasignificantamountofdiscardedwork and preventstheuseoflazyconflictmanagementon largetransactions.Instead,SPECTMcontinuesexecution through overflowsand guaranteesdeferredconflictresolution forthemajority oflines—thosethatfit intheL1. InapplicationslikeBayesorHash,SPECTMachieves up to 60%speed-up overDYNTM.Ontheotherhand, DYNTMcantake advantageofusing eagerconflict managementon largetransactionsinYada toimprove on FASTM-SL.Onaverage,SPECTMproducesa7% speed-up overDYNTM. VII.CONCLUSIONS Log-basedHTMsystemsofferanelegantsolution to handleunboundedtransactions.Unfortunately,conventional logging mechanismsintroduce significantoverheads suchasdelayson transactionalstores,higherL1 miss rates,orslowabortson overflowing transactions. Selectivelogging proposesanovelapproachforHTM systemsthat implementearly updates.Ourapproach movestothesoftware-resident log onlythoseold values thatarenotmaintainedin hardware,permitting amore effectiveutilization oftransactionalresources. Wepresent twoimplementationsthatuseselective logging:FASTM-SLasaneagerHTMsystemand SPECTMasalazyHTMsystem.Wehave evaluated both approacheswith overflow-sensitivetransactionalappli- cations.FASTM-SLand SPECTMobtain,on average, aspeed-up of36%and 7%overtwomodernHTM systems,achieving similarperformance thanidealized HTMsystems.Wehaveseenthat implementing selectivelogging acceleratestransactionalexecution,reduces thenumberofslowabortsand decrementsthesize of thesoftwarelog.What ismore,selectivelogging opens newavenueson systemsthatenforce deferredconflict managementby permitting early updateson overflowing data. 7
For review.Pleasedo notdistribute REFERENCES [1]C.S.Ananian,K.Asanovic,B.C.Kuszmaul, C.E.Leiserson,and S.Lie,“UnboundedTransactionalMemory,” in Procs.ofthe11th Intl Symp on High-Performance ComputerArchitecture,February 2005. [2]C.Blundell, J.Devietti, E.C.Lewis,and M.M.K. Martin,“MakingTheFastCaseCommon And The Uncommon CaseSimple InUnboundedTransactional Memory,”in Procs.ofthe34th Intl Symp on Computer Architecture,June2007. [3]J.Bobba,N.Goyal, M.D.Hill, M.M.Swift, and D.A.Wood,“TokenTM:EfficientExecution ofLarge Transactionswith HardwareTransactionalMemory,”in Procs.ofthe35th Intl Symp on ComputerArchitecture, June2008. [4]J.Bobba,K.E.Moore,L.Yen,H.Volos,M.D.Hill, M.M.Swift, and D.A.Wood,“Performance Pathologies in HardwareTransactionalMemory,”in Procs.ofthe 34th Intl Symp on ComputerArchitecture,June2007. [5]C.CaoMinh,J.Chung,C.Kozyrakis,and K.Olukotun,“STAMP:StanfordTransactionalApplicationsfor Multi-Processing,”in Procs.ofTheIEEE Intl Symp on Workload Characterization,September2008. [6]C.Cascaval, C.Blundell, M.Micheal, H.Cain,P.Wu, S.Chiras,and S.Chatterjee,“SoftwareTransactional Memory:Why is it only aresearchtoy?” CommunicationsoftheACM,vol. 51(11),pp.40–46,November 2008. [7]W.Chuang,S.Narayanasamy,G.Venkatesh,J.Sampson,M.V.Biesbrouck,G.Pokam,B.Calder,and O.Colavin,“UnboundedPage-BasedTransactional Memory,”in ASPLOS-XII: Proceedingsofthe12th internationalconference on Architecturalsupportfor programminglanguagesand operatingsystems,2006. [8]J.Chung,C.CaoMinh,A.McDonald,T.Skare, H.Chafi,B.D.Carlstrom,C.Kozyrakis,and K.Olukotun,“Tradeoffsin TransactionalMemoryVirtualization,” in Procs.ofthe12th Intl Confon ArchitecturalSupport forProgrammingLanguagesand Operating Systems, October2006. [9]P.Damron,A.Fedorova,Y.Lev,V.Luchangco,M.Moir, and D.Nussbaum,“Hybrid TransactionalMemory,”in Procs.ofthe12th Intl Confon ArchitecturalSupport forProgrammingLanguagesand Operating Systems, October2006. [10]D.Dice,Y.Lev,M.Moir,and D.Nussbaum,“Early Experience with aCommercialHardwareTransactional MemoryImplementation,”in Procs.ofthe14th Intl Conf on ArchitecturalSupportforProgrammingLanguages and Operating Systems,Mar.2009. [11]L.Hammond,V.Wong,M.Chen,B.D.Carlstrom, J.D.Davis,B.Hertzberg,M.K.Prabhu,H.Wijaya, C.Kozyrakis,and K.Olukotun,“TransactionalMemory Coherence and Consistency,”in Procs.ofthe31stIntl Symp on ComputerArchitecture,June2004. [12]M.Herlihyand J.E.B.Moss,“TransactionalMemory: ArchitecturalSupportforLock-Free Data Structures,”in Procs.ofthe20th Intl Symp on ComputerArchitecture, May 1993. [13]S.Jafri, M.Thottethodi, and T.Vijaykumar,“LiteTM: ReducingTransactionalState Overhead,”in HighPerformance ComputerArchitecture(HPCA),2010 IEEE 16th InternationalSymposiumon,Jan.2010. [14]S.Kumar,M.Chu,C.J.Hughes,P.Kundu,and A.Nguyen,“Hybrid TransactionalMemory,”in Procs. ofthe11th ACMSIGPLANSymp on Principlesand PracticeofParallelProgramming,Mar.2006. [15]Y.Lev,M.Moir,and D.Nussbaum,“PhTM:Phased TransactionalMemory,”in Procs.ofthe2nd Workshop on TransactionalComputing,August2007. [16]M.Lupon,G.Magklis,and A.Gonz´ alez,“FASTM:A log-based hardwaretransactionalmemorywith fastabort recovery,”in Procs.ofthe18th Intl Confon Parallel Architecturesand CompilationTechniques,September 2009. [17]M.Lupon,G.Magklis,and A.Gonzalez,“A Dynamically Adaptable HardwareTransactionalMemory,”in Procsofthe43rdIntl Symp on Microarchitecture,December2010. [18]P.S.Magnusson,M.Christensson,J.Eskilson,D.Forsgren,G.Hallberg,J.Hogberg,F.Larsson,A.Moestedt, and B.Werner,“Simics:AFull SystemSimulation Platform,”IEEE Computer,vol. 35,2002. [19]M.M.K.Martin,D.J.Sorin,B.M.Beckmann, M.R.Marty,M.Xu,A.R.Alameldeen,K.E.Moore, M.D.Hill, and D.A.Wood,“Multifacet’sGeneral Execution-DrivenMultiprocessorSimulator (GEMS) Toolset,”ACMSIGARCHComputerArchitectureNews, vol. 33,2005. [20]K.E.Moore,J.Bobba,M.J.Moravan,M.D.Hill, and D.A.Wood,“LogTM:Log-basedTransactional Memory,”in Procs.ofthe12th Intl Symp on High- Performance ComputerArchitecture,February 2006. [21]R.Rajwarand J.R.Goodman,“SpeculativeLockElision:EnablingHighly ConcurrentMultithreadedExecution,”in Procs.ofthe34th Intl Symp on Microarchitecture,December2001. [22]R.Rajwar,M.Herlihy,and K.Lai, “VirtualizingTransactionalMemory,”in Procs.ofthe32nd Intl Symp on ComputerArchitecture,June2005. [23]N.Shavit and D.Touitou,“SoftwareTransactionalMemory,”in Procs.ofthe14th Symp on PrinciplesofDistributedComputing,August1995. [24]A.Shriramanand S.Dwarkadas,“RefereeingConflicts in HardwareTransactionalMemory,”in Procs.ofthe 23rdIntl Conference on Supercomputing,June2009. [25]A.Shriraman,S.Dwarkadas,and M.L.Scott, “Flexible DecoupledTransactionalMemorySupport,”in Procs.of the35th Intl Symp on ComputerArchitecture,June2008. [26]S.Tomic,C.Perfumo,C.Kulkarni, A.Armejach, A.Cristal, O.Unsal, T.Harris,and M.Valero,“Eazy- HTM,Eager-LazyHardwareTransactionalMemory,” in Procs.ofthe42nd Intl Symp on Microarchitecture, December2009. [27]L.Yen,J.Bobba,M.M.Marty,K.E.Moore,H.Volos, M.D.Hill, M.M.Swift, and D.A.Wood,“LogTM- SE:DecouplingHardwareTransactionalMemoryfrom Caches,”in Procs.ofthe13th Intl Symp on High- Performance ComputerArchitecture,February 2007. 8