a coherent and managed run0me for ml on the scc
play

A Coherent and Managed Run0me for ML on the SCC KC - PowerPoint PPT Presentation

A Coherent and Managed Run0me for ML on the SCC KC Sivaramakrishnan Lukasz Ziarek Suresh Jagannathan Purdue University


  1. A ¡Coherent ¡and ¡Managed ¡Run0me ¡ for ¡ML ¡on ¡the ¡SCC ¡ KC ¡Sivaramakrishnan ¡ ¡ Lukasz ¡Ziarek ¡ ¡ ¡Suresh ¡Jagannathan ¡ Purdue ¡University ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡SUNY ¡Buffalo ¡ ¡ ¡ ¡Purdue ¡University ¡

  2. Big ¡Picture ¡ Cache ¡Coherent ¡ Intel ¡SCC ¡ Cluster ¡of ¡Machines ¡ ?? • No ¡cache ¡coherence ¡ • Distributed ¡programming ¡ ü No ¡change ¡to ¡ • Message ¡passing ¡buffers ¡ • RCCE, ¡MPI, ¡TCP/IP ¡ programming ¡model ¡ • Shared ¡memory ¡ ü AutomaHc ¡memory ¡ • So8ware ¡Managed ¡ management ¡ Cache-­‑Coherence ¡(SMC) ¡ Can ¡we ¡program ¡SCC ¡as ¡a ¡cache ¡ coherent ¡machine? ¡ 2 ¡

  3. Intel ¡SCC ¡Architecture ¡ No ¡Cache-­‑Coherence ¡ SoVware ¡Managed ¡Cache ¡ (Caching ¡disabled) ¡ (Release ¡Consistency) ¡ Shared ¡Memory ¡ ¡ (off ¡chip) ¡ ... ¡ Private ¡ Private ¡ Private ¡ Private ¡ Memory ¡ Memory ¡ Memory ¡ Memory ¡ Core ¡0 ¡ Core ¡1 ¡ Core ¡2 ¡ Core ¡47 ¡ Message ¡Passing ¡Buffers ¡ (On ¡die, ¡8KB ¡per ¡core) ¡ How ¡to ¡provide ¡an ¡ efficient ¡cache ¡ coherence ¡layer? ¡ 3 ¡

  4. SMP ¡Programming ¡Model ¡for ¡SCC ¡ • Desirable ¡properHes ¡ ¡ – Single ¡address ¡space ¡ – Cache ¡coherence ¡ ¡ – SequenHal ¡consistency ¡ Program ¡ – AutomaHc ¡memory ¡management ¡ AbstracHon ¡Layer ¡ – UHlize ¡MPB ¡for ¡inter-­‑core ¡ communicaHon ¡ • AbstracHon ¡Layer ¡– ¡MulHMLton ¡ VM ¡ 1. A ¡new ¡GC ¡to ¡provide ¡coherent ¡and ¡ managed ¡global ¡address ¡space ¡ SCC ¡ 2. Mapping ¡first-­‑class ¡channel ¡ communicaHon ¡on ¡to ¡the ¡MPB ¡ 4 ¡

  5. Programming ¡Model ¡ • MulHMLton ¡ – Safety, ¡scalability, ¡ready ¡for ¡future ¡manycore ¡processors ¡ – Parallel ¡extension ¡of ¡MLton ¡– ¡a ¡whole-­‑program, ¡opHmizing ¡ Standard ¡ML ¡compiler ¡ – Immutability ¡is ¡default, ¡mutaHons ¡are ¡explicit ¡ • ACML ¡– ¡first-­‑class ¡message ¡passing ¡language ¡ ¡ send ¡(c, ¡v) ¡ C ¡ v ¡ ß ¡recv ¡(c) ¡ • AutomaHc ¡memory ¡management ¡ ¡ 5 ¡

  6. Coherent ¡and ¡Managed ¡Address ¡Space ¡

  7. Coherent ¡and ¡Managed ¡Address ¡Space ¡ • Requirements ¡ 1. Single ¡global ¡address ¡space ¡ 2. Memory ¡consistency ¡ 3. Independent ¡core-­‑local ¡GC ¡ ¡ Thread-­‑local ¡GC! ¡ Private-­‑nursery ¡GC ¡ Local ¡heap ¡GC ¡ ¡ On-­‑the-­‑fly ¡GC ¡ Thread-­‑specific ¡heap ¡GC ¡ ¡ ¡ 7 ¡

  8. Thread-­‑local ¡GC ¡for ¡SCC ¡ Caching ¡ SMC ¡-­‑ ¡Caching ¡ disabled ¡ enabled ¡ Shared ¡Memory ¡ Uncached ¡Shared ¡Heap ¡ Cached ¡Shared ¡Heap ¡ (Mutable ¡Objects) ¡ (Immutable ¡Objects) ¡ Local ¡ Local ¡ Local ¡ … ¡ Heap ¡ Heap ¡ Heap ¡ Private ¡ ¡ Private ¡ ¡ Private ¡ ¡ Memory ¡ Memory ¡ Memory ¡ Core ¡0 ¡ Core ¡0 ¡ Core ¡0 ¡ • Consistency ¡preservaHon ¡ – No ¡inter-­‑coherence-­‑domain ¡pointers! ¡ • Independent ¡collecHon ¡of ¡local ¡heaps ¡ 8 ¡

  9. Heap ¡Invariant ¡PreservaHon ¡ Uncached ¡Shared ¡ Cached ¡Shared ¡ Uncached ¡Shared ¡ Cached ¡Shared ¡ Heap ¡ Heap ¡ Heap ¡ Heap ¡ r m ¡ r m ¡ x m ¡ y im ¡ r ¡:= ¡x ¡ x m ¡ y im ¡ FWD ¡ FWD ¡ Local ¡Heap ¡ Local ¡Heap ¡ Mutator ¡needs ¡ Read ¡Barriers! ¡ 9 ¡

  10. Maintaining ¡Consistency ¡ • Local ¡heap ¡objects ¡are ¡not ¡shared ¡by ¡definiHon ¡ • Uncached ¡shared ¡heap ¡is ¡consistent ¡by ¡construcHon ¡ • Cached ¡shared ¡heap ¡(CSH) ¡uses ¡SMC ¡ – InvalidaGon ¡and ¡ flush ¡has ¡to ¡be ¡managed ¡by ¡the ¡runHme ¡ – Unwise ¡to ¡ invalidate ¡before ¡every ¡CSH ¡read ¡and ¡ flush ¡a8er ¡ every ¡CSH ¡write ¡ • SoluHon ¡ – Key ¡observaHon: ¡CSH ¡only ¡stores ¡immutable ¡objects! ¡ 10 ¡

  11. Ensuring ¡Consistency ¡(Reads) ¡ • Maintain ¡ MAX_CSH_ADDR ¡at ¡each ¡core ¡ • Assume ¡values ¡at ¡ ADDR < MAX_CSH_ADDR ¡are ¡up-­‑to-­‑date ¡ Up-­‑to-­‑date ¡ Up-­‑to-­‑date ¡ Stale ¡ Stale ¡ Uncached ¡Shared ¡ Cached ¡Shared ¡ 0: read(x) Uncached ¡Shared ¡ Cached ¡Shared ¡ Heap ¡ Heap ¡ Heap ¡ Heap ¡ Invalidate ¡ MAX_CSH_ADDR ¡== ¡X ¡ MAX_CSH_ADDR ¡ X ¡ before ¡read ¡– ¡ smcAcquire() 11 ¡

  12. Ensuring ¡Consistency ¡(Reads) ¡ • No ¡need ¡to ¡invalidate ¡before ¡ read (y) ¡where ¡ ¡ ¡ y < MAX_CSH_ADDR ¡ ¡ ¡ ¡ • Why? ¡ 1. Bump ¡pointer ¡allocaHon ¡ 2. All ¡objects ¡in ¡CSH ¡are ¡immutable ¡ ¡ y < MAX_CSH_ADDR à Cache ¡invalidated ¡a8er ¡y ¡was ¡created ¡ 12 ¡

  13. Ensuring ¡Consistency ¡(Writes) ¡ • Writes ¡to ¡shared ¡heap ¡occurs ¡only ¡during ¡ globalizaHon ¡ • Flush ¡cache ¡aVer ¡globalizaHon ¡ – smcRelease() ¡ ¡ 13 ¡

  14. Garbage ¡CollecHon ¡ • Local ¡heaps ¡are ¡collected ¡independently! ¡ • Shared ¡heaps ¡are ¡collected ¡aVer ¡stopping ¡all ¡ of ¡the ¡cores ¡ – Proceeds ¡in ¡SPMD ¡fashion ¡ – Each ¡core ¡prepares ¡the ¡shared ¡heap ¡reachable ¡set ¡ independently ¡ – One ¡core ¡collects ¡the ¡shared ¡heap ¡ • Sansom’s ¡dual ¡mode ¡GC ¡ – A ¡good ¡fit ¡for ¡SCC! ¡ 14 ¡

  15. GC ¡EvaluaHon ¡ • 8 ¡MulHMLton ¡benchmarks ¡ 4.5 35 1.60 128 Partitioned Partitioned Partitioned Partitioned Normalized GC Time (log) 30 4.0 64 Normalized Mutator Time 1.50 Single Single Single Single 48% ¡faster ¡ Normalized Time 25 3.5 32 1.40 Speedup 20 3.0 16 1.30 15 2.5 8 1.20 10 2.0 4 1.10 5 1.5 2 0 1.0 1.00 1 0 10 20 30 40 50 0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6 # Cores Heap size relative to min heap size Heap size relative to min heap size Heap size relative to min heap size • Memory ¡Access ¡profile ¡ – ¡ 89% ¡local ¡heap, ¡10% ¡cached ¡shared ¡heap, ¡1% ¡uncached ¡shared ¡ heap ¡ – Almost ¡all ¡accesses ¡are ¡cacheable! ¡ 15 ¡ 35 MPB- 30 MPB+ 25 Speedup 20 15 10 5 0 0 10 20 30 40 50 # Cores

  16. ACML ¡Channels ¡on ¡MPB ¡

  17. ACML ¡Channels ¡on ¡MPB ¡ • Challenges ¡ – First-­‑class ¡objects ¡ – MulHple ¡senders/receivers ¡can ¡share ¡the ¡same ¡ channel ¡ – Unbounded ¡ – Synchronous ¡and ¡asynchronous ¡ • Channel ¡ImplementaHon ¡ datatype ‘a chan = {sendQ : (‘a * unit thread) Q.t, recvQ : (‘a thread) Q.t} 17 ¡

  18. Specializing ¡Channel ¡CommunicaHon ¡ • Mutable ¡messages ¡must ¡be ¡globalized ¡ – Must ¡maintain ¡consistency ¡ • Immutable ¡messages ¡can ¡uHlize ¡MPB ¡

  19. Sender ¡Blocks ¡ • Channel ¡in ¡shared ¡heap, ¡message ¡is ¡ immutable ¡and ¡in ¡local ¡heap ¡ Shared ¡Heap ¡ Shared ¡Heap ¡ C ¡ C ¡ t1:send(c,v) t1 ¡ V im ¡ t1 ¡ V im ¡ t2 ¡ t2 ¡ Local ¡Heap ¡ Local ¡Heap ¡ Local ¡Heap ¡ Local ¡Heap ¡ Core ¡0 ¡ Core ¡1 ¡ Core ¡0 ¡ Core ¡1 ¡ 19 ¡

  20. Receiver ¡Interrupts ¡ Shared ¡Heap ¡ Shared ¡Heap ¡ C ¡ C ¡ t2: recv(c) t1 ¡ V im ¡ t1 ¡ V im ¡ V im ¡ t2 ¡ t2 ¡ Local ¡Heap ¡ Local ¡Heap ¡ Local ¡Heap ¡ Local ¡Heap ¡ Core ¡0 ¡ Core ¡1 ¡ Core ¡0 ¡ Core ¡1 ¡ Core ¡1 ¡interrupts ¡ core ¡0 ¡to ¡iniHate ¡ transfer ¡over ¡ MPB ¡ 20 ¡

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