1 / 22

Heap Data Management for Limited Local Memory (LLM) Multicore Processors

Heap Data Management for Limited Local Memory (LLM) Multicore Processors. Ke Bai , Aviral Shrivastava C ompiler M icro-architecture L ab. From multi- to many-core processors. Simpler design and verification Reuse the cores Can improve performance without much increase in power

Download Presentation

Heap Data Management for Limited Local Memory (LLM) Multicore Processors

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Heap Data Management for Limited Local Memory (LLM) Multicore Processors KeBai,AviralShrivastava Compiler Micro-architecture Lab

  2. From multi- to many-core processors • Simpler design and verification • Reuse the cores • Can improve performance without much increase in power • Each core can run at a lower frequency • Tackle thermal and reliability problems at core granularity GeForce9800GT Tilera TILE64 IBM XCell 8i http://www.public.asu.edu/~ashriva6/cml

  3. Memory Scaling Challenge Strong ARM 1100 • In Chip Multi Processors (CMPs) , caches provide the illusion of a large unified memory • Bring required data from wherever into the cache • Make sure that the application gets the latest copy of the data • Caches consume too much power • 44% power, and greater than 34 % area • Cache coherency protocols do not scale well • Intel 48-core Single Cloud-on-a-Chip, and Intel 80-core processors have non-coherent caches Intel 80 core chip http://www.public.asu.edu/~ashriva6/cml

  4. Limited Local Memory Architecture • Cores have small local memories (scratch pad) • Core can only access local memory • Accesses to global memory through explicit DMAs in the program • E.g. IBM Cell architecture, which is in Sony PS3. SPU PPE LS SPE 7 SPE 1 SPE 3 SPE 5 Element Interconnect Bus (EIB) SPE 6 Off-chipGlobal Memory SPE 0 SPE 2 SPE 4 PPE: Power Processor Element SPE: Synergistic Processor Element LS: Local Store http://www.public.asu.edu/~ashriva6/cml

  5. LLM Programming <spu_mfcio.h> int main(speid, argp) { printf("Hello world!\n"); } <spu_mfcio.h> int main(speid, argp) { printf("Hello world!\n"); } <spu_mfcio.h> int main(speid, argp) { printf("Hello world!\n"); } <spu_mfcio.h> int main(speid, argp) { printf("Hello world!\n"); } <spu_mfcio.h> int main(speid, argp) { printf("Hello world!\n"); } <spu_mfcio.h> int main(speid, argp) { printf("Hello world!\n"); } #include<libspe2.h> extern spe_program_handle_t hello_spu; int main(void) { int speid, status; speid (&hello_spu); } • Thread based programming, MPI like communication Local Core Local Core Local Core Local Core Local Core Local Core = spe_create_thread Main Core • Extremely power-efficient computation • If all code and data fit into the local memory of the cores http://www.public.asu.edu/~ashriva6/cml

  6. What if thread data is too large? Two Options • Repartition and re-parallelize the application • Can be counter-intuitive and hard 24 KB 32 KB 24 KB 32 KB 24 KB Two threads with 32 KB memory each Three cores with 24 KB memory each • Manage data to execute in limited memory of core • Easier and portable http://www.public.asu.edu/~ashriva6/cml

  7. Managing data int global; f1(){ int a,b; global = a + b; f2(); } int global; f1(){ int a,b; DMA.fetch(global) global = a + b; DMA.writeback(global) DMA.fetch(f2) f2(); } Original Code Local Memory Aware Code http://www.public.asu.edu/~ashriva6/cml

  8. Heap Data Management stack stack heap • All code and data need to be managed • Stack, heap, code and global • This paper focuses on heap data management • Heap data management is difficult • Heap size is dynamic, while the size of code and global data are statically known • Heap data size can be unbounded • Cell programming manual suggests “Use heap data at your own risk”. • Restricting heap usage is restrictive for programmers heap heap global code main() { for (i=0; i<N; i++) { item[i] = malloc(sizeof(Item)); } F1(); } http://www.public.asu.edu/~ashriva6/cml

  9. Outline of the talk • Motivation • Related works on heap data management • Our Approach of Heap Data Management • Experiments http://www.public.asu.edu/~ashriva6/cml

  10. RelatedWorks • Local memories in each core are similar to SPMs • Extensive works are proposed for SPM • Stack: Udayakumaran2006,Dominguez2005, Kannan2009 • Global: Avissar2002, Gao2005, Kandemir2002, Steinke2002 • Code: Janapsatya2006, Egger2006, Angiolini2004, Pabalkar2008 • Heap: Dominguez2005, Mcllroy2008 direct access ARM SPM SPE LLM DMA DMA Global Memory Global Memory ARM Memory Architecture IBM Cell Memory Architecture SPM is Essential SPM is for Optimization http://www.public.asu.edu/~ashriva6/cml

  11. Our Approach Heap Size = 32bytes sizeof(student)=16bytes typedefstruct{ int id; float score; }Student; main() { for (i=0; i<N; i++) { student[i] = malloc( sizeof(Student) ); } for (i=0; i<N; i++) { student[i].id = i; } } malloc3 malloc2 malloc1 Global Memory Local Memory GM_HP HP • mymalloc() • May need to evict older heap objects to global memory • It may need to allocate more global memory • malloc() • allocates space in local memory http://www.public.asu.edu/~ashriva6/cml

  12. How to evict data to global memory? • Can use DMA to transfer heap object to global memory • DMA is very fast – no core-to-core communication • But eventually, you can overwrite some other data • Need OS mediation Global Memory Execution Core DMA malloc Global Memory Main Core Execution Core malloc malloc • Thread communication between cores is slow! http://www.public.asu.edu/~ashriva6/cml

  13. Hybrid DMA + Communication • Can use DMA to transfer heap object to global memory • DMA is very fast – no core-to-core communication • But eventually, you can overwrite some other data • Need OS mediation DMA write from local memory to global memory malloc() { if(enough space in global memory) then write function frame using DMA else request more space in global memory } S allocate ≥S space mail-box based communication startAddrendAddr Execution Thread on execution core Main core Global Memory • free() frees global space. • Communication is similar to malloc(). • Sent the global address to global thread http://www.public.asu.edu/~ashriva6/cml

  14. Address Translation Functions Heap Size = 32bytes sizeof(student)=16bytes main() { for (i=0; i<N; i++) { student[i] = malloc( sizeof(Student) ); } for (i=0; i<N; i++) { student[i].id = i; } } malloc3 student[i] = p2s(student[i]); malloc2 malloc1 student[i] = s2p(student[i]); Global Memory Local Memory • Mapping from SPU address to global address is one to many. • Cannot easily find global address from SPU address • All heap accesses must happen through global addresses GM_HP HP • p2s() will translate the global address to spu address • Make sure the heap object is in the local memory • s2p() will translate the spu address to global address More details in the paper http://www.public.asu.edu/~ashriva6/cml

  15. Heap Management API • malloc() • allocate space in local memory and global memory and return global addr • free() • free space in the global memory • p2s() • Assures heap variable exists in the local memory and uses spuAddr. • s2p() • Translate the spuAddr back to ppuAddr. • Code with HeapManagement • Original Code typedefstruct{ int id; float score; }Student; main() { for (i=0; i<N; i++) { student[i] = malloc(sizeof(Student)); student[i].id = i; } } typedefstruct{ int id; float score; }Student; main() { for (i=0; i<N; i++) { student[i] = malloc(sizeof(Student)); student[i].id = i; } } student[i] = p2s(student[i]); student[i] = s2p(student[i]); Our approach provides an illusion of unlimited space in the local memory! http://www.public.asu.edu/~ashriva6/cml

  16. Experimental Setup • Sony PlayStation 3 running a Fedora Core 9 Linux • MiBench Benchmark Suite and other possible applications • http://www.public.asu.edu/~kbai3/publications.html • The runtimes are measured with spu_decrementer()for SPE and _mftb()for the PPE provided with IBM Cell SDK 3.1 http://www.public.asu.edu/~ashriva6/cml

  17. Unrestricted Heap Size Runtimes are comparable http://www.public.asu.edu/~ashriva6/cml

  18. Larger Heap Space  Lower Runtime http://www.public.asu.edu/~ashriva6/cml

  19. Runtime decreases with Granularity • Granularity: # of heap objects combined as a transfer unit http://www.public.asu.edu/~ashriva6/cml

  20. Embedded Systems Optimization • If the maximum heap space needed is known • No thread communication is needed. • DMAs are sufficient Average 14% improvement http://www.public.asu.edu/~ashriva6/cml

  21. Scalability of Heap Management http://www.public.asu.edu/~ashriva6/cml

  22. Summary • Moving from multi-core to many-core systems • Scaling the memory architecture is a major challenge • Limited Local Memory architectures are promising • Code and data should be managed if they can not fit in the limited local memory • We propose a heap data management scheme • Manage any size of heap data in a constant space in local memory • It’s automatable, then can increase productivity of programmers • It’s scalable for different number of cores • Overhead ~ 4-20% • Comparison with software cache • Does not support pointer • One SW cache for one data type • Cannot optimize any further http://www.public.asu.edu/~ashriva6/cml

More Related