Locality-Centric Thread Scheduling for Bulk-Synchronous Programming Models on CPU Architectures

locality centric thread scheduling for bulk n.w
1 / 27
Embed
Share

Explore the optimization of OpenCL for CPUs, focusing on data locality and work-item scheduling. Discover how to bridge the gap between CPU and GPU performance for portable efficiency.

  • OpenCL
  • CPU optimization
  • Data locality
  • Work-item scheduling
  • Parallel programming

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Locality-Centric Thread Scheduling for Bulk-synchronous Programming Models on CPU Architectures Hee-Seok Kim, Izzat El Hajj, John Stratton, Steven Lumetta and Wen-mei Hwu

  2. OpenCL as a portable language OpenCL This work abstract computing model (massive parallelism) CPU backend GPU backend FPGA backend CPU GPU FPGA 2 (Intel, AMD, PowerPC) (NVIDIA, AMD, Imagination, ARM) (Altera, Xilinx)

  3. Why care about CPUs for OpenCL? We want portable performance from single source Accelerators based on CPU architecture Intel Xeon Phi CPU to GPU performance gap remains < ~10x Amdahl s law for communication They are everywhere! 3

  4. Contributions Exploiting data locality in scheduling work- items for performance Real system and measurement demonstrates speedups of 3.32x and 1.71x over AMD and Intel OpenCL implementations 18 benchmarks from Parboil and Rodinia AE certified 4

  5. OpenCL Execution Model wg1 wgW/LS-1 wg0 wi0wi1 wiLS-1 wiLSwiLS+1 wi2LS-1 wiW-1 void kernel( ) { i0; i1; ia-1; barrier(); ia; ia+1; in-1; } i0 i1 region0 ia-1 ia ia+1 region1 kernel code in-1 immediate dependency instruction(s) barrier for work-items in a work-group W, LS ii index space 5

  6. Work-group Scheduling Distribute work-groups to different cores Considerations: load balance, locality CPU Core CPU Core CPU Core CPU Core 6

  7. Region Scheduling within WG Serialize barrier-separated regions 7

  8. Work-item Scheduling Performance changes substantially based on work-item scheduling policy 8

  9. Existing Compilers Industry Intel AMD (Twin Peaks) Academia Karrenberg & Hack SnuCL pocl 9

  10. Existing Approaches Industry Intel AMD (Twin Peaks) Academia Karrenberg & Hack SnuCL pocl Depth First Order (DFO) Scheduling 10

  11. Existing Approaches Industry Intel AMD (Twin Peaks) Academia Karrenberg & Hack SnuCL pocl DFO Scheduling with Vectorization (time progresses as color gets darker) 11

  12. DFO and Locality work-item id wid = get_local_id(0); for(k=0; k < N; ++k){ foo(arr[k]); } 0 1 2 0 1 0 2 1 k 2 ... arr 12

  13. DFO and Locality work-item id wid = get_local_id(0); for(k=0; k < N; ++k){ foo(arr[k][wid]); } 0 1 2 0 1 0 1 2 2 0 ... k ... S ... 2S ... ... ... ... ... ... ... ... ... ... ... arr 13

  14. Alternative Schedule: BFO Breadth First Order (BFO) Scheduling 14

  15. Alternative Schedule: BFO BFO with Vectorization (time progresses as color gets darker) 15

  16. DFOs vs. BFOs Impact on Locality DFO BFO lower is better 1 0.8 L1 data cache misses (normalized to worst) 0.6 0.4 0.2 0 BFO has better locality DFO has better locality BFO is preferred by more benchmarks (13 vs. 5) No single schedule can universally exploit data locality 16

  17. Locality-Centric(LC) Scheduling Flow ibefore for(k=0; k<N; ++k) { ik } iafter wi0wi1 wiLS-1 ibefore i0 region region iN-1 input region iafter DFO scheduling A loop in the region wi0wi1 wiLS-1 sum of memory access pattern classification subregion0 ibefore i0 i1 subregion1 (loop) region Prefers BFO? No iN-1 Yes subregion2 iafter scheduling decision 17 BFO scheduling

  18. Locality Centric (LC) Scheduling Classify memory accesses per loop body and tally which schedule has greater popularity Two loops can even be scheduled differently in the same kernel Work-item Stride 0 1 Other Loop Iteration Stride 0 - DFO DFO 1 BFO - DFO Other BFO BFO - 18

  19. The proposed approach scheduling decision Comparison of scheduling policies (1/3) for(k=0; k<N; ++k) { foo(arr[k]); } An example region Work-item stride 0 (W0) 1 (W1) Other (WX) 0 (L0) - DFO DFO Loop iteration stride 1 (L1) BFO - DFO Other (LX) BFO BFO - wi0wi1 wiLS-1 i0 N i1 Memory address region iN-1 time DFO scheduling Number of cache misses = LS*N/LineSize wi0wi1 wiLS-1 i0 i1 Memory address region LS iN-1 time Number of cache misses = N/LineSize BFO scheduling 19

  20. The proposed approach scheduling decision Comparison of scheduling policies (2/3) for(k=0; k<N; ++k) { foo(arr[f(k)]); } An example region Work-item stride 0 (W0) 1 (W1) Other (WX) 0 (L0) - DFO DFO Loop iteration stride 1 (L1) BFO - DFO Other (LX) BFO BFO - wi0wi1 wiLS-1 N i0 i1 Memory address region iN-1 time DFO scheduling Number of cache misses = LS*N wi0wi1 wiLS-1 i0 LS i1 Memory address region iN-1 time Number of cache misses = N BFO scheduling 20

  21. The proposed approach scheduling decision Comparison of scheduling policies (3/3) for(k=0; k<N; ++k) { foo(arr[f(k)+wid]); } An example region Work-item stride 0 (W0) 1 (W1) Other (WX) 0 (L0) - DFO DFO Loop iteration stride 1 (L1) BFO - DFO Other (LX) BFO BFO - wi0wi1 wiLS-1 i0 N i1 Memory address region iN-1 time DFO scheduling Number of cache misses = LS*N wi0wi1 wiLS-1 LS i0 i1 Memory address region iN-1 time Number of cache misses = N*LS/LineSize BFO scheduling 21

  22. LCs Impact on Locality DFO BFO LC lower is better 1 0.8 L1 data cache misses (normalized to worst) 0.6 0.4 0.2 0 BFO has better locality DFO has better locality LC closely follows best of the two 22

  23. Locality Comparison AMD Intel LC lower is better 1 L1 data cache misses (normalized to worst) 0.8 0.6 0.4 0.2 0 LC outperforms data locality in most benchmarks 23

  24. Performance Results AMD Intel LC (no vec.) LC higher is better 1 (normalized to fastest) 0.8 Speedup 0.6 0.4 0.2 0 LC outperforms 3.32x and 1.71x over AMD and Intel LC(no vec.) is faster than Intel(DFO, vectorized) by 1.04x 24

  25. Summary of Evaluation Metric LC/AMD LC/Intel Speedup 3.32 1.71 L1 Data Cache Misses 0.10 0.30 Data TLB Misses 0.26 0.33 LLC Misses 0.92 0.77 LC(no vec)/AMD (not vectorized) LC/Intel (vectorized) Metric Speedup 2.01 1.71 Instructions 0.80 0.98 25 25

  26. Summary Exploiting data locality in work-items scheduling results in higher performance We proposed an alternative scheduling approach(BFO) and adaptive code generation technique(LC) The proposed approach outperforms state-of- the-art implementations in memory system efficiency and performance 26 26

  27. Thank you! Q & A Hee-Seok Kim kim868@illinois.edu 27

More Related Content