外媒外刊-Trainium3推理与微架构深度解析_第1页
外媒外刊-Trainium3推理与微架构深度解析_第2页
外媒外刊-Trainium3推理与微架构深度解析_第3页
外媒外刊-Trainium3推理与微架构深度解析_第4页
外媒外刊-Trainium3推理与微架构深度解析_第5页
已阅读5页,还剩37页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

【价值目录】网整理:1/42Trainium3InferenceandMicroarchitectureDeepD/p/trainium3-inferencexKimboChen,BryanShan,WenyaoGao,CamQuilici,AlecIbarra,DanielNishball,TonySung,DylanPatelNovember27,2026TheNvidiaGPUwasoriginallybuilttoshadepixels,andeveryNvidiagenerationsince

2017hasboltedonanotherpieceofAl-specifichardwaretofixthebottlenecktheprevious

oneexposed.VoltaaddedTensorCores,HopperaddedTMAfortiledatamovement

betweenHBMandSRAM,andBlackwelladdedTensorMemoryforaccumulating.Nvidia

removedmanyhardwareunitsthatarerequiredtorendergraphicsfortheirdatacenter

GPUsIncomparison,theTrainiummicroarchitectureisbuiltground-upspecificallyforML

workloads,withtilesasafirst-classprimitiveinsteadofhavingaseaofthreadsandthen

boltingontensor/tilecomputeanddatamovementengines.Trainium3behavestheway

thephysicssaysitshould.Inthispastthismeantsoftwarewasahumongouschallenge,

butnownolonger.【价值目录】网整理:

2/42Source:DwarkeshPodcast7monthslater,Trainium3andTPUsareliveonInferenceX,bothtradingblowsoreven

winningvsNvidiaGB300incosttogeneratetokensatTCO.Wewilldiveintothosedetails

below.ThisadvantageisnotpurelyduetoAmazon'sultralowcostsupplychain.It'salsodueto

microarchitecturaldecisions,whichwewilldiveintointhispost.Forexample,usingthe

TrainiumDescriptorGenerationEngines(DGE),theequivalentofNvidiaTMAandAMD

MI455XTDM,ourmicrobenchmarksshowthatTrainiumcanreachpeakHBMbandwidth

utilization(MBU)atsmallmessagesizes,whichisnotpossibleonNvidiaGPUs.Furthermore,ourtestingcoverscycle-levelSRAMscratchpadlatencyandbandwidth

testing(SBUFtoPSUM),rack-scalebandwidthandlatencymicrobenchmarks,attention

exponentialtesting,andtheprecisecycle-levellatencyofdifferentshapes,includinghow

differentattentionheaddim(K)wouldaffectthepercentageofroofline.EveryresultcomesfromUBenchX,ourmicrobenchmarksuite,andwemodeleachunit

fromfirstprinciplesbeforewemeasureit.WethankNafeaBshara(Co-FounderofAWS

AnnapurnaLabs),RonDiamant(TrainiumChiefArchitect),MichaelShteinbok,Armin

Ebrahimandtherestoftheirteamforhelpingteachustheirarchitectureandvalidateour

benchmarkexperiments.StartheInferenceX&UBenchXGitHubrepositoryifyoufindtheopen-sourcebenchmark

anddatauseful!InferenceXistheonlyinferencebenchmarkintheworldtohaveTPUv7,

OpenAIJalapeño,NvidiaRubinNVL72,AMD,andnow,Trainium3.【价值目录】网整理:

3/42Source:SemiAnalysisTrainium'sSuperiorInferencePerformanceperDollar-AgentXSource:SemiAnalysisAgentXmeasuresTrainium3onaproductionend-to-endagenticinferenceworkload.This

isachievedbyreplayingrealcoding-agentsessionsagainstaTrainium3server.Thegoal

istocompareaccelerators'realisticinferenceperformance,thatyoumayexpecttoseeon

actualagenticworkloads.ForthoseunfamiliarwithInferenceX,theParetofrontiers(curves)representthe

fundamentalinferencetradeoffbetweenthroughputandlatency.Eachpointisadifferent

inferenceconfigurationtargetingadifferentlatency-throughputtarget.Ateachsliceofthe

x-axis,higherperfperTCOisbetteranddirectlyleadstohigherinferencegrossmargins.Today,weareexcitedtosharethatTrainium3PDS+vLLMachievesamazingperf/$TCO

acrosstheentirefrontier.Infact,itisbetterthaneveryotheracceleratorbesidesVera

RubinacrosstheentireTCOversusp90interactivitycurve.Thisisanamazing

achievement.【价值目录】网整理:

4/42Source:SemiAnalysisTrainiumisalsoverycompetitivefromanend-to-endlatencyperspective,acrosstheentire

curve.Withthatbeingsaid,thereisstillroomforimprovement,particularlywithrespectto

TTFT.Source:SemiAnalysisSource:SemiAnalysisSource:SemiAnalysis【价值目录】网整理:

5/42Source:SemiAnalysisItisnotsurprisingthatTrainiumlagsbehindinsomep90TTFTcasesagainstGB300as

thismetricislargelydictatedbyprefill,acomputeboundoperation.Trainium3hasonly

17%thetheoreticalFP4flopsasBlackwellUltra(2,517TFLOPSversus15,000TFLOPS).

IthasmorecompetitiveinteractivitysincedecodeismemoryboundandTrainium3has4.9

TB/sperchipagainst8.0TB/sforGB300,61%ofthebandwidthatabout30%theTCO.

Also,pipelinedprefill(whichTrainiumrelieson,asdiscussedinthesubsequentsection)

generallyfavorsthroughputoverlatency.Source:SemiAnalysisInfact,atap90interactivityof135tok/s/user(atypicalspeedyou'dobserveon

OpenRouter),Trainium3withvLLMyieldsthehighestprofitmarginat73.5%,comparedto

runnerupGB300+SGLangat53%(at3yearrentalprices).ThisassumesZ.ailistprice

fortokenpricinganda60%hardwarefleetutilizationfactor.Trainium3achievesthesemarginswith144GBofHBMperchip,halfGB300'scapacityper

GPU.ThisreflectsourShortKingthesis:additionalHBMcapacitymustdeliverenough

extrathroughputatthetargetlatencytojustifyitscost.Thisisalsowhy4-Hiisattractive

industrywideoptionandnextgenerationacceleratorsareprimarilyusing8-Hi.【价值目录】网整理:

6/42Source:SemiAnalysisWhatmakestheseresultsinterestingforthisarticleishowdirectlythesoftwarefollowsthe

hardwarewemeasureinSection2.Prefillanddecoderunonseparatenodes,andeach

arrangesthesame16chipstosuitthetopology.Source:SemiAnalysisPrefillAquickprimerforthissection:aTrainium3chiphas8NeuronCores,eachpairsharingone

HBMstack,andanodeis16chips.Section2coversthehardwareindetail.Foramorein

depthanalysis,seeourTrainium3deepdivearticle.【价值目录】网整理:

7/42Prefill:onechipperpipelinestageBetweenchips;activationsonlytray1210131411tokensonestage=onechip=8coresdiediesharedenginesharedengineHBMcoreHBMcorecorecoresharedenginesharedengineHBMHBMcorecorecorecoreTensor+expertparallelism;insidethechipSource:SemiAnalysisAprefillnodeisapipeline.Themodel'slayersarecutinto16stages,onechipperstage,

andachunkofprompttokensflowsfromchiptochip.Insideastage,thechip's8

NeuronCoressplitthechunkbetweenthem,soallofthestage'stensorandexpert

parallelismstaysononechip.Prefill:onechipperpipelinestageBetweenchips;activationsonlytray1210131411tokensonestage=onechip=8coresdiediesharedenginesharedengineHBMcoreHBMcorecorecoresharedenginesharedengineHBMHBMcorecorecorecoreTensor+expertparallelism;insidethechipSource:SemiAnalysisThisisthelayoutourcollectivebenchmarksarguefor.Chip-levelcollectiveswerewell

aheadofeverywidergroupwetested,andall-to-all,thepatternMoElayersneed,isslower

onceitleavesthechip.Withtheheavyexchangeskeptononechip,whatlimitsastageis

TensorE,whichiswheretheMXFP4matmulmodescoveredbelowdotheirwork.DecodeDecode:whichexchangescrosstheswitchswitch8coresnoswitchonechip:aconversation'sKVcache+sharedexpertswitch16coresnoswitchonetraynshere:denselayers+sharedexpertinthelargerconfigsswitch128coresswitchwholenoderunshere:routedexperts+outputheadSource:SemiAnalysisswitch8coresnoswitchonechip:aconversation'sKVcache+sharedexpertswitch16coresnoswitchonetraynshere:denselayers+sharedexpertinthelargerconfigsswitch128coresswitchwholenoderunshere:routedexperts+outputheadSource:SemiAnalysisFordecode,onecopyofthemodelisspreadacrossindividualranksonall128

NeuronCores(across16chips),andeverycoretakespartinthecomputationforeach

token.ForthosefamiliarwithNvidiaarchitecture,eachGPUistypicallyaseparaterank【价值目录】网整理:

8/42whereasTrainiumtreatsall128coresaslogicaldevicesandseparateEPranks.Inthe

caseofmulti-userGLM-5.3,thisassignstworoutedexpertsperNeuronCore.Decoderuns

atLNC=1,soeachphysicalNeuronCoreisitsownrank,whereastherestofthisarticle

usesthedefaultLNC=2.Again,eachNeuronCoreisitsowndevicewithlocalHBM,sonothingsynchronizesacross

thechipunlessthesoftwareinvokesacollective.NvidiaaddedlocalitydomainsinCUDA

13.4topinRubinkernelstoonedie'smemoryinthesameway.Source:SemiAnalysisSource:SemiAnalysisNoteveryexchangespansthenodethough.Decodedeclaresnestedgroupsofcores:half

achip,onechip,thetwochipsofatray,twotrays,halfthenode,andthewholenode,plus

asecondfamilythattakesthesamecorepositiononeverychip.Thesmallerexchanges,

suchasthedenselayersandthesharedexpert,canrunonthesmallgroups.Agroupof8

isonechipandagroupof16isonetray,whosetwochipsshareadirectlink,sothose

exchangesnevertouchaswitch.Butactivationsaregatheredacrossall128coresandthe

expertoutputsarereducedacrossall128,sothattrafficcrossestheswitchoneverylayer.TrainiumProfilerFine-grainAccuracy-BetterThanNvidiaandAMDTrainium'sprofilerisbyfartheindustryleaderandisstateoftheart(SOTA).Trainium's

profilerislovedbyalltheperformanceengineersatAnthropic.Anthropic'sheadof

performancehaspubliclysaidthatperformanceanalysisonTrainiumiswaybetterthan

performanceanalysisonNvidiaGPUs(andobviouslybetterthanonAMDGPUs).Inorder

todemonstratehowfine-grainedtheirprofileris,werecreatedtheOlympicperformanceof

theBayArea'sownAlysaLiuontheactualTrainium3hardwareprofile.Weweremainly【价值目录】网整理:

9/42inspiredbytheBadApplepostfromDanielLiu(AnthropicPerformanceEngineer).This

combinesfineart,performanceart,andchiparchitectureallintoonevideo.Source:SemiAnalysisSource:SemiAnalysisFullvideo:SemiAnalysis@SemiAnalysis_ALERT:Trainium3Neuronprofiling&tracestackissofine-grainedandprecisethatit

cangeneratepixelartofentirevideos!Thevideobelowisanactualprofilerunningon

Trainium3DMAengines.Wewillopen-sourcetheentireSKILLS.mdlaterthismonth.【价值目录】网整理:

10/425:21AM·Nov17,2026·52.3KViews

19Replies·14Reposts·279LikesSection2:MicrobenchmarksHardwareandProgrammingModelTrainium3consistsof8NeuronCore-v4s,andevery2NeuronCoresshareanHBMstack.

Bydefault,2NeuronCoresthatshareanHBMstackformaLogicalNeuronCore(LNC).

UserswritekernelsthatmaptoLNCs,andinLNC=2,itfollowstheSingle-Program

Multiple-Data(SPMD)paradigm:NeuronCoresinanLNCexecutethesamekernel

programwithseparatehardwareresourcesexcepttheHBM.InaNeuronKernelInterface

(NKI)kernel,programmerscanassignworktoNeuronCoresinanLNCwiththeAPI

gram_idandsynchronizeNeuronCoreswiththebarriermechanismnisa.core_barrier.Oneofthemostimportantconceptsindatamovementisthepartitiondimension(pdim)

andthefreedimension(fdim).Everytensorhasadesignatedpartitiondimension,and

otherdimensionsarecalledfreedimensions.Inprinciple,thepartitiondimensionaligns

withthedimensionsofhardwarecomponents,anddatacanbeprocessedinparallel.We

explainthedimensionsofeachcomponentthroughoutthearticle.【价值目录】网整理:

11/42MemoryHBMBandwidthHereweinvestigatetheachievableHBMbandwidthofTrainium3.InTrainium3'smemory

hierarchy,wemovedatafromHBMtoSBUFusingtheAPInki.isa.dma_copy.Each

NeuronCorecomeswith16mainDirectMemoryAccess(DMA)engines,inchargeof

movingdatabetweenHBMandSBUF.Foreverydatatransfer,amainDMAengineingests

aDMAdescriptor,whichcontainsthesourceanddestinationaddressinformation.In

Trainium3,therearethreemodesofgeneratingDMAdescriptors:static(None),software-

basedDGE(swdge),andhardware-basedDGE(hwdge).Eachmodegeneratesand

storesdescriptorsdifferently.StaticDMASoftwareDGEHardwareDGEGenerationHardwareHostGpsimdEDGEGenerationTimingCompilationtimeNEFFexecutionNEFFexecutionStorageLocationHBMSBUF,GpsimdEDGESource:SemiAnalysisStartingfromNeuronCore-v3(Trainium2),GpsimdEcomeswithoneintegratedDMA

engineperprocessor,totalingeightintegratedDMAengines.WiththeseintegratedDMA

engines,programmerscanperformdatamovementsinparallelwiththemainDMA

engines,whilealsoenablingindirectaccesspatterns,suchasgatherandscatter

operations.NeuronCore-v3alsocomeswithtwoDescriptorGenerationEngines(DGE).

DGEacceleratesdescriptorgenerationwithhardware:itfreesupGpsimdEtoperform

othercomputation,freesupmemoryspace,andacceleratesaddressgeneration.DGE

resemblesTensorMemoryAccelerator(TMA)inNvidiaarchitectureandTensorData

Mover(TDM)inAMDarchitecture.TMAfocusesonacceleratinglargedatacopiesatthe

costofhigherlatency,whilehardware-basedDGEhasnoperformancetrade-offs

comparedtosoftwareDGE.However,whileTMAisabletoperformgatherandscatter

operations,noteventhelatestNeuronCoreDGEcandoso.Asaresult,NKIconstrains

DMAcopymodetoswdgewhenperformingindirectmemoryaccesses.【价值目录】网整理:

12/42Trainium3DMAbandwidthbydescriptormode,oneNeuronCoreSource:SemiAnalysisHerewecomparetheachievedmemorybandwidthofasingleTrainium3NeuronCorefor

thethreedescriptormodes.Staticmode,sincedescriptorsarecompiledaheadoftime,

hasthelowestdescriptorgenerationoverheadandachievesthehighestmemory

utilization.Atthesmallesttestedmessagesize64KiB,staticmodeachieves492GB/s

(80%utilization)forloadand544GB/s(88.8%utilization)forstore.Staticmodealso

achievesnearpeakmemorybandwidthataround256KiB.HardwareDGE,thedefault

modeofDMAcopy,followscloselybehindstaticmode:itachieves398GB/s(65%

utilization)forloadand476GB/s(77.7%utilization)forstoreat64KiBmessagesize,likely

duetotheaddressgenerationoverhead.Thegapnarrowsasmessagesizeincreases,

andhardwareDGEmodematchesstaticmodeafter256KiB.Ontheotherhand,software

DGEperformssignificantlyworsethantheothertwo.Thislikelyindicatesindirectmemory

accesspatternsmaysuffergreatperformanceloss,astheyarerestrictedtosoftwareDGE

mode.Trainium3DMAbandwidthbydescriptormode,oneNeuronCoreSource:SemiAnalysisTrainium3consistsof8physicalNeuronCores,andwhiletheyhaveindividualDMA

engines,eachpairofNeuronCoressharesoneHBMstack.Thus,wemeasurethememory

bandwidthachievedby8concurrentNeuronCoreprogramstounderstandtheutilization

underfullload.Overall,theHBMisabletosustainthehighutilization,droppingbyonly

about3%forlargermessagesizes.【价值目录】网整理:

13/42Trainium3DMAbandwidthbydescriptormode,fullchipSource:SemiAnalysisPSUMtoSBUFBandwidthTrainium3DMAbandwidthbydescriptormode,fullchipSource:SemiAnalysisInTrainium3,PSUMandSBUFarearrangedina2Dgridof128lanesof16KiB/256KiB

capacity.The128-lanesetupisthepartitiondimension,andthedataisaccessedinparallel

alongthepartitiondimension.TherearetwomaintypesofdatamovementbetweenPSUMandSBUF:SBUFtoPSUM:Uponannki.isa.nc_matmulcall,TensorEmovesbothinputmatrices

fromSBUFtoPSUMPSUMtoSBUF:Epilogueoperationssuchasdatatypecasting,activation,and

quantization.Theseoperationsaremostlybasedonthenki.isa.tensor_copyAPIThissectionfocusesonPSUMtoSBUF.TwoengineshavePSUMreadaccess:ScalarE

andVectorE.Wemeasuretheachievedmemorybandwidthforthetwoenginesacross

differenttileshapes,usingthefull128partitionswithvariedper-partitionsizes.【价值目录】网整理:

14/42Trainium3PSUM→SBUFtensor_copy,fp32,eachenginealoneSource:SemiAnalysisOurresultsshowthatPSUMreadbandwidthstartsfrom453.9bytespercycleforScalarE

and413.9bytespercycleforVectorEat32KiBmessagesize,andbothreachnearthe

theoreticalbandwidthof512bytespercycle(4bytespercycleperlane,128lanes)at

around256KiBmessagesize.Thistranslatestoa614.4GB/sbandwidthforeachengine.

StartingfromNeuronCore-v3(Trainium2),thetwoenginescanperformPSUMreadsin

parallel.Ourbenchmarksshowthatparallelaccesscausesnear-zerobandwidthloss,

indicatingthatthePSUMiswelldesignedtosustainparallelaccess.Whenbothengines

Trainium3PSUM→SBUFtensor_copy,fp32,eachenginealoneSource:SemiAnalysis【价值目录】网整理:

15/42Trainium3PSUM→SBUFtensor_copy,fp32,VectorEandScalarEconcurrentlySource:SemiAnalysisSource:SemiAnalysisThebandwidthgapbetweenthetwoenginesinthesmallermessagesizesindicates

differentinstructionissueoverhead:ScalarEhasabout8cyclesofoverhead,whereas

VectorEhasabout16cycles.Trainium3PSUM→SBUFtensor_copy,fp32,VectorEandScalarEconcurrentlySource:SemiAnalysisSource:SemiAnalysis【价值目录】网整理:

16/42TensorEngineTensorEngine(TensorE)isthehardwareunitthatexecutesmatrixmultiplications.Interms

ofarchitecture,TensorEisasystolicarray,whichconsistsofa128-by-128processing

element(PE)grid.The128dimensionmatchesthenumberofpartitionsinSBUFand

PSUM,andsinceTensorEreadsbothmatrixinputsfromSBUFandwritestheresultsto

PSUM,thissimplifiesprogramming.TensorEappliesnear-memoryaccumulation:the

outputaccumulatesinPSUM,avoidingaroundtriptoHBM,anditisespeciallyusefulfor

epilogueoperationsandconsecutivematrixmultiplications.Thisdesignisalsopresentin

NvidiaBlackwell,wheretheTensorCoreoutputaccumulatesinTMEM.WeinvokeTensorEwiththeAPInisa.nc_matmul.Foramatrixmultiplicationofx@y=z,

theinputdimensionsareasfollows:Stationaryx.T:[K,M].MaximumofM(stationaryfdim)is128;TensorEreachesfull

performanceatK=128Movingy:[K,N].MaximumofN(movingfdim)is4096.ThisisbecausePSUMhas16

KiBperpartition,whichcanholdamaximumof16384B/4B=4096FP32elementsOutputz:[M,N]NotethatTensorErequiresthestationarymatrixxtobetransposed,meaningthehardware

takesx.Tasinputbutcomputesx@y.ThisisduetoTensorE'ssystolicarraydesign:the

systolicarraycomputesdotproductsbetweenrowsofxandcolumnsofy.SimpleSystolicArrayPerformanceModelInthesystolicarray,eachycolumnisstaggeredbyoneelement.EveryTensorEmatrix

multiplicationinvolvestwosteps:LoadStationary(LS)loadsthestationarymatrixintothe

array,andMovingMultiply(MM)performsthecalculation.DuringeachcycleofMM,every

PEcomputesapartialsum,passestheyelementtothePEonitsright,andpassesthe

partialsumtothePEbelow.Trainium3systolicarrayperformancemodelanimation.Source:SemiAnalysisWiththeunderstandingofthesystolicarray,wecanmodeltheinstructionlatencyas

N+254cycles.Inamatrixmultiplication,thelower-rightelementisthelasttocomplete

computation,anditdependsonhowmanycyclesittakestomovethelowerleftelementof

yintothelower-rightPE.Focusingonthedynamicsofthelower-leftelementofy,wesee

therearethreestages:fill,stream,anddrain.Thefillstagereferstotheperiodwhenthe

inputedgeisn'tfullduetostaggering,whichisR-1cycles,whereRrepresentsthenumber

ofrowsinthePEgrid.ThestreamstagereferstothelastrowenteringthePEgrid,andit

takesNcyclesforthelower-leftelementtoreachtheinputedge.Finally,thedrainstageis

whenthePEsconsumethemovingmatrixinputs,andittakesC-1cyclesforthelower-left【价值目录】网整理:

17/42elementofytogettothelower-rightPE,whereCrepresentsthenumberofcolumnsinthe

PEgrid.Overall,thelatencyis(R-1)+N+(C-1)=127+N+127=N+254cycles.WecanalsomodeltheinitiationintervalasapproximatelyNcyclesforsufficientlylargeN.

Initiationintervalisthetimegapbetweeninstructionlauncheswhenweconsecutively

launchmanyofthesameinstructions.Inthiscase,wemodelthenumberofcycles

betweenaseriesofMMinstructionlaunches.Fromtheperspectiveofthesystolicarray,

wecancontinuouslystreammultipleinputmatricesy1,y2,…inthesamestaggered

fashion,andthecomputationofthenextMMinstructionstartsassoonasthenextinput

matrix'selementstreamsintoaPE.Inasteadystatewhereweignorethefillanddrain

stages,eachPEstreamsthroughonerowofinputmatrixyforeveryMMinstruction,

meaningtheinitiationintervalisNcycles.However,thisonlyholdsforlargeNduetoour

steady-stateassumption.nisa.nc_matmulPerformanceWecollectexperimentalresultstoverifyourmodeling.Weareabletomapthelatency

resultstotheformulaN+393withlittleerror,indicatingthatthere'saroughly140-cycle

overheadforMMinstructions,whichmayincludethingslikewritingresultstoPSUM.FixedStationaryLatencyacrossN(M=128)Source:SemiAnalysisFixedStationaryLatencyacrossN(M=128)Source:SemiAnalysisAsfortheinitiationinterval,experimentsshowthatbyaddingaconstant6-cycleoverhead,

weareabletoreliablypredicttheinitiationintervalformatrixmultiplicationshapesN>=64【价值目录】网整理:

18/42andM=128.Aswesuspected,themodelbreaksdownforsmallN,andweobservethe

initiationintervaltobe30cyclesatN=8,likelydominatedbyotheroverheads.FixedStationaryInitiationIntervalacrossN(M=128)Source:SemiAnalysisFixedStationaryInitiationIntervalacrossN(M=128)Source:SemiAnalysisOurmodelalsopredictsthatMisirrelevanttobothperformancemetrics,andour

experimentscorroboratethis.AtN=512,bothlatencyandinitiationintervalstayconstant

acrossallMsizes.Thishasgreatimplicationsforperformance.LLMinferencedecode

workloadstendtohavesmallMformatrixmultiplications,andMnotbeingthemainfactor

inperformancealleviatesmanydifficultieswhenoptimizingdecodeworkloads.MMPerformanceDoesn'tChangewithMSource:SemiAnalysisMMPerformanceDoesn'tChangewithMSource:SemiAnalysis【价值目录】网整理:

19/42Wealsomeasureamorerealisticscenario,wherewechangebothstationaryandmoving

matrices,sothekernelalternatesbetweenexecutingLSandMMinstructions,andthetwo

instructionsofdifferentmatrixmultiplicationscanoverlap.Resultsshowthatwereach

morethan90%utilizationatN=64,andwereachneartheoreticalthroughputforshapes

largerthanN=128.AlternatingStationaryThroughputacrossN(M=128)Source:SemiAnalysisAlternatingStationaryThroughputacrossN(M=128)Source:SemiAnalysisDoubleFP8MatmulPerformanceStartingfromNeuronCore-v3(Trainium2),TensorEsupportsFP8matrixmultiplication.In

termsofprogramming,userssettheargumentperf_modetonisa.matmul_perf_mode.double_row,anddoublerowmodesupportscontraction

dimensionK=256,2xthestandardK=128.However,thesystolicarrayisstilla128-by-128

PEgrid,sounderthehood,doublerowmodeshardstheinputintotwotilesalongtheK

dimensionandcomputestheminparallel.Duringcomputation,eachPEtakesintwoFP8

elementsfromthemovingmatrixandcomputestwomultiplyandaccumulationoperations

everycycle.【价值目录】网整理:

20/42MMk=256⇒k/2=128TNNk/2=128k=256Source:SemiAnalysisAsaresult,thelatencyofFP8doublerowmodeisnear-identicaltoitsBF16counterpart,

andweshowthisintheexperimentsbelow.TensorEcantheoreticallydoublethe

throughputofFP8matrixmultiplication,sincethelatencyisstillboundedbythesame

systolicarraygrid.Inreality,weseeFP8demonstratingnear-identicalinstructionlatency

andinitiationintervalasitsBF16counterpart.MMk=256⇒k/2=128TNNk/2=128k=256Source:SemiAnalysis【价值目录】网整理:

21/42FixedStationaryInitiationInterval,bf16vsfp8(M=128)Source:SemiAnalysisFixedStationaryLatency,bf16vsfp8(M=128)Source:SemiAnalysisHowever,forrealisticscenariosofalternatingLSandMMinstructions,double_rowmode

FP8performanceismixed.Whencomparingthesameshapes,FP8underperformsBF16

untilaroundN=96andonlyreaches2xthecomputethroughputafteraroundN=256,whichFixedStationaryInitiationInterval,bf16vsfp8(M=128)Source:SemiAnalysisFixedStationaryLatency,bf16vsfp8(M=128)Source:SemiAnalysis【价值目录】网整理:

22/42makessenseasFP8isexecutingathalftheNsize.IfweconsidertheeffectiveNsize,

doublerowmodeFP8onlystartsshowingthroughputbenefitsatN=64.FP8powerthrottlesmorefrequentlythanitsBF16counterpart,indicatingthattypical

performancemaybelessidealthanourfull-ratemeasurements.AlternatingStationaryThroughput,bf16vsfp8(M=128)Source:SemiAnalysisAlternatingStationaryThroughput,bf16vsfp8(M=128)Source:SemiAnalysisMicroscalingMatmulPerformanceNeuronCore-v4(Trainium3)introducesmicroscalingformat(MXFP4,MXFP8)matrix

multiplicationsupportwiththenewAPInisa.nc_matmul_mxQuad-MXMatmulFurtherscalingtheFP8matrixshape,nc_matmul_mxsupportstheKdimensionof512(4x

thestandard)throughthequad-MXFP8datatype.UserspassthematricesintotheAPI

nisa.quantize_mxtocompactthematricesalongtheKdimension,packingevery4MXFP8

elementsintoonequad-MXFP8element,resultingintheKtobe128.Trainium3offloads

thequantizationsteptotheuser,insteadofTensorEdoingit,andthisisdifferentfrom

majorMX-supportinghardwaresuchasNvidiaandAMDGPUs.Thisreducesthe

quantizationoverheadduringthematrixmultiplicationinstructionbutexposesthe

quantizationsteptouserstooptimize.Withthequad-MXFP8datatype,howLSloadsthestationarymatrixandhowMMstreams

themovingmatrixbehaveclosertothestandardnc_matmul,excepteachelementis4-【价值目录】网整理:

23/42byteswide.nc_matmul_mxacceptsquad-MXFP8inputsandtheoreticallyhasthesame

performancecharacteristicsastheBF16nc_matmul,hence4xthethroughput.Realistically,quad-MXFP8doeshavesimilarlatencyandinitiationintervalasBF16

nc_matmul,butstillsuffersfromminoroverhead,whichisunderstandablegiventhe

dequantizationstep.Asforcomputationthroughput,quad-MXFP8outperformsitsBF16

counterpartformostshapes,butitonlyreaches4xthroughputforNgreaterthan128.FixedStationaryInitiationInterval,bf16vsMXFP8(M=128)Source:SemiAnalysisFixedStationaryInitiationInterval,bf16vsMXFP8(M=128)Source:SemiAnalysis【价值目录】网整理:

24/42【价值目录】网整理:

25/42FixedStationaryLatency,bf16vsMXFP8(M=128)Source:SemiAnalysisAlternatingStationaryThroughput,bf16vsMXFP8(M=128)Source:SemiAnalysisRowTilingModeFixedStationaryLatency,bf16vsMXFP8(M=128)Source:SemiAnalysisAlternatingStationaryThroughput,bf16vsMXFP8(M=128)Source:SemiAnalysisRowtilingmodeisanothernewfeatureinNeuronCore-v4(Trainium3)uniqueto

nc_matmul_mx.Rowtilingmodeallowsuserstoconcurrentlyexecutemultiplematrix

multiplicationswithsmallerKdimensions,improvingtheutilizationofTensorE.TensorE

achievesthisbysplittingupthesystolicarrayalongtherowsandoutputtingtheresults

withoutpassingdownthepartialsumsthro

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论