Abstract Evaluating the Impact of Memory System Performance on Software Prefetching and Loc
- 格式:pdf
- 大小:419.33 KB
- 文档页数:15
EvaluatingtheImpactofMemorySystemPerformanceon
SoftwarePrefetchingandLocalityOptimizations
AneeshAggarwal
Abdel-HameedA.BadawyChau-WenTseng
DonaldYeung
ElectricalandComputerEngineeringDept.Dept.ofComputerScience
UniversityofMaryland,CollegeParkUniversityofMaryland,CollegePark
Abstract
Softwareprefetchingandlocalityoptimizationsaretech-niquesforovercomingthegapbetweenprocessorand
memoryspeeds.UsingtheSimpleScalarsimulator,we
evaluatetheimpactofmemorybandwidthandlatency
ontheeffectivenessofsoftwareprefetchingandlocality
optimizationsonthreetypesofapplications:regularsci-entificcodes,irregularscientificcodes,andpointer-based
codes.Wefindsoftwareprefetchinghidesmemorycosts
butincreasesinstructioncountandrequiresgreatermem-
orybandwidth.Localityoptimizationschangethecom-
putationorderanddatalayoutatcompileorruntimetoeliminatecachemisses,reducingmemorycostswithout
requiringmorememorybandwidth.Combiningprefetch-
ingandlocalityoptimizationscanimproveperformance,
butinteractionscanalsonullifythebenefitsofprefetching.Weproposeseveralalgorithmstobetterintegratesoftware
prefetchingandlocalityoptimizations.
1Introduction
Evenwithlargeon-chipcaches,currentmicroprocessors
spendalargepercentageofexecutiontimeonmemoryac-
cessstalls.Sinceprocessorspeedsaregrowingatagreater
ratethaneithermemoryandnetworkspeeds,weexpectmemoryaccesscoststobecomeevenmoreimportant.In
thenottoodistantfuture,itwillnotbefarfromthetruth
tosayinstructionsarefreeandperformanceisdetermined
TechnicalReportCS-TR-4169(alsoUMIACS-TR-2000-57),Dept.ofComputerScience,UniversityofMaryland,July2000onlybymemoryaccesscosts.Computerarchitectshavebeenbattlingthismemorywallbydesigningeverlarger
andsophisticatedcaches.However,asapplicationsstart
usingpointer-basedlinkeddatastructuresandperforming
irregularmemoryaccesses,cachesnolongerperformwell
withoutadditionalhelp.Twoapproachestoimprovingcacheperformanceare
softwareprefetchingandlocalityoptimizations.Software
prefetchingexecutesexplicitprefetchinstructionstobe-
ginloadingdatafrommemorytocache.Iftheprefetch
beginsearlyenough,andthedataisnotevictedpriortouse,memoryaccesslatencycanbecompletelyhidden.
Memorybandwidthuseisincreased,however,sincethe
processorwillnowconsumedataatafasterrate.Incom-
parison,localityoptimizationsusecompilerorrun-time
transformationstothecomputationorderand/ordatalay-outofaprogramtoincreasetheprobabilityitaccessesdata
alreadyincache.Ifsuccessful,averagememorylatency
andbandwidtharebothreduced,sincetherewillbefewer
memoryaccesses.
Bothapproachesforavoidingthememorywallhavebeenstudiedinisolation.Inthispaper,weexaminehow
welleachapproachworksforthreetypesofdata-intensive
applications.Wealsoevaluatebothapproachesinauni-
fiedenvironment,sowecancomparetheirperformance
andinvestigatetheirinteractionswhenappliedinconcert.Finally,wealsostudytheimpactofmemorybandwidth
andlatencyontheperformanceofeachtechnique.The
contributionsofthispaperareasfollows:
Wecomparetheefficacyofsoftwareprefetching
andlocalityoptimizationsforthreetypesofdata-
intensivecodes.
1Weevaluatetheimpactofmemorybandwidthand
memorylatencyonapplicationperformancewithand
withoutprefetchingandlocalityoptimizations.
Weproposeseveralenhancementstointegratedsoft-
wareprefetchingandlocalityoptimizations.
Webegintherestofthispaperwithalookatthree
memoryaccesspatterns,thenexaminesoftwareprefetch-
ingandlocalityoptimizationsforeachtypeofapplication.Wepresentexperimentalevaluationsforeachapplication
anddevelopimprovedalgorithms.Finally,wediscuss
relatedworkandconclude.
2MemoryAccessPatterns
Thetypesofsoftwareprefetchingandlocalityoptimiza-
tionswhichmaybeappliedareseriouslydependenton
thetypeofmemoryaccesspatternmadebyaprogram.
Webeginbypresentingthreeimportanttypesofmemory
accesspatterns.
2.1AffineArrayAccesses
Themostbasicmemoryaccesspatternisaffine(linear)
accessestomultidimensionalarrays.Forinstance,con-
sidertheJacobicodeinFigure1,typicallyusedinmulti-gridsolversforpartialdifferentialequations(PDEs).The
valueofapointiniscalculatedastheaverageofvalues
ofneighboringpointsinallthreedimensionsof.This
stencilpatternisrepeatedlyappliedtoeachpointof,re-
sultinginasmoothersolution.Allarrayaccessesareaffinebecausearraysubscriptsarecombinationsofloopindex
variableswithconstantcoefficientsandadditiveconstants.
Inpractice,thearenocoefficientsandsmalladditivecon-
stantsareused.Theseprogramsarealsocalledregular
codesbecausememoryaccesspatternsaresoregularandwelldefined.
Affinearrayaccessesarecommonindense-matrixlin-
earalgebraandfinite-differencePDEsolvers,aswellas
databasescansandimageprocessing.Amajorfeatureof
affinearrayaccessesisthattheyallowmemoryaccesspat-ternstobeentirelycomputedatcompiletime,assumear-
raydimensionsizesareknown.Thisallowsbothsoftware
prefetchingandcompilertransformationstobecalculated