automated bug detection for pointers and memory accesses
play

Automated Bug Detection for Pointers and Memory Accesses in - PowerPoint PPT Presentation

Automated Bug Detection for Pointers and Memory Accesses in High-Level Synthesis Compilers Pietro Fezzardi Fabrizio Ferrandi pietro.fezzardi@polimi.it fabrizio.ferrandi@polimi.it Dipartimento di Elettronica, Informazione e Bioingegneria


  1. Automated Bug Detection for Pointers and Memory Accesses in High-Level Synthesis Compilers Pietro Fezzardi Fabrizio Ferrandi pietro.fezzardi@polimi.it fabrizio.ferrandi@polimi.it Dipartimento di Elettronica, Informazione e Bioingegneria Politecnico di Milano Milano, Italy FPL 2016 – Lausanne – 01/09/2016

  2. Outline Introduction and Motivation Background and Assumptions Automated Bug Detection for Pointers Evaluated Tools, Experiments and Results Conclusion and Future Work

  3. Motivation Adoption of High-Level Synthesis is increasing HLS tools are becoming increasingly complex Memory optimizations bring substantial improvements Memory bugs introduced by HLS tools are hard to debug A methodology to automatically find memory bugs introduced by the compiler would: • Make existing memory allocation and optimizations more reliable • Ease development and deployment of new memory architectures in HLS • Speed up testing of new memory optimizations in HLS • Make easier for HLS developers and users to isolate the cause of bugs P.Fezzardi – pietro.fezzardi@polimi.it 1 FPL 2016 – Lausanne – 01/09/2016

  4. Goals General Ideas • Take advantage of HLS information to support all compiler optimizations • Automatically isolate the wrong signal, failing operation and component • Automatically backtrack the error to the original source code • Avoid user interaction to enable massive automated testing in production Goals Related to Pointers • Specifically target memory bugs involving pointers and addresses • Completely support C standard pointer based descriptions • Support different memory technologies and partitioning patterns • Independent of memory optimizations P.Fezzardi – pietro.fezzardi@polimi.it 2 FPL 2016 – Lausanne – 01/09/2016

  5. Discrepancy Analysis Debug Flow CONTROL ORIGINAL FINITE HARDWARE DATA DATA SOURCE STATE DESCRIPTION FRONTEND FLOW HLS PATH BACKEND CODE MACHINE LANGUAGE GRAPH (DP) ( C ) (FSM) (HDL) (CDFG) P.Fezzardi – pietro.fezzardi@polimi.it 3 FPL 2016 – Lausanne – 01/09/2016

  6. Discrepancy Analysis Debug Flow CONTROL ORIGINAL FINITE HARDWARE DATA DATA SOURCE STATE DESCRIPTION FRONTEND FLOW HLS PATH BACKEND CODE MACHINE LANGUAGE GRAPH (DP) ( C ) (FSM) (HDL) (CDFG) INFORMATION EXTRACTED FSM optimizations source level chaining information pipelining resource sharing list of signals instrumented to collect C code in SSA scheduling HW traces after frontend binding optimizations allocation P.Fezzardi – pietro.fezzardi@polimi.it 3 FPL 2016 – Lausanne – 01/09/2016

  7. Discrepancy Analysis Debug Flow CONTROL ORIGINAL FINITE HARDWARE DATA DATA SOURCE STATE DESCRIPTION FRONTEND FLOW HLS PATH BACKEND CODE MACHINE LANGUAGE GRAPH (DP) ( C ) (FSM) (HDL) (CDFG) INFORMATION EXTRACTED FSM optimizations source level chaining information pipelining resource sharing list of signals instrumented to collect C code in SSA scheduling HW traces after frontend binding optimizations allocation DEBUGGING compilation + STEPS execution SW Traces P.Fezzardi – pietro.fezzardi@polimi.it 3 FPL 2016 – Lausanne – 01/09/2016

  8. Discrepancy Analysis Debug Flow CONTROL ORIGINAL FINITE HARDWARE DATA DATA SOURCE STATE DESCRIPTION FRONTEND FLOW HLS PATH BACKEND CODE MACHINE LANGUAGE GRAPH (DP) ( C ) (FSM) (HDL) (CDFG) INFORMATION EXTRACTED FSM optimizations source level chaining information pipelining resource sharing list of signals instrumented to collect C code in SSA scheduling HW traces after frontend binding optimizations allocation DEBUGGING compilation cycle accurate RTL simulation + STEPS execution SW Traces HW Traces (VCD) P.Fezzardi – pietro.fezzardi@polimi.it 3 FPL 2016 – Lausanne – 01/09/2016

  9. Discrepancy Analysis Debug Flow CONTROL ORIGINAL FINITE HARDWARE DATA DATA SOURCE STATE DESCRIPTION FRONTEND FLOW HLS PATH BACKEND CODE MACHINE LANGUAGE GRAPH (DP) ( C ) (FSM) (HDL) (CDFG) INFORMATION EXTRACTED FSM optimizations source level chaining information pipelining resource sharing list of signals instrumented to collect C code in SSA scheduling HW traces after frontend binding optimizations allocation DEBUGGING compilation cycle accurate RTL simulation + STEPS execution SW Traces HW Traces (VCD) DISCREPANCY ANALYSIS P.Fezzardi – pietro.fezzardi@polimi.it 3 FPL 2016 – Lausanne – 01/09/2016

  10. Discrepancy Analysis Debug Flow CONTROL ORIGINAL FINITE HARDWARE DATA DATA SOURCE STATE DESCRIPTION FRONTEND FLOW HLS PATH BACKEND CODE MACHINE LANGUAGE GRAPH (DP) ( C ) (FSM) (HDL) (CDFG) INFORMATION EXTRACTED FSM optimizations source level chaining information pipelining resource sharing list of signals instrumented to collect C code in SSA scheduling HW traces after frontend binding optimizations allocation DEBUGGING compilation cycle accurate RTL simulation + STEPS execution SW Traces HW Traces (VCD) DISCREPANCY ANALYSIS INFORMATION first mismatch between faulty module DEBUG HW and SW executions in HW design state of FSM hierachical path and value of the name of the wrong signal wrong signal failed operation in C start and end time value of the of the failed operation related C variable SW call stack trace P.Fezzardi – pietro.fezzardi@polimi.it 3 FPL 2016 – Lausanne – 01/09/2016

  11. Memory Locations Memory Location A Memory Location � M i , B i , S i � is an unambiguous representation of a position in memory In HW In SW ◦ M i : unique identifier for a memory module ◦ M i : can be omitted ◦ B i : an offset in the memory module identified by M i ◦ B i : address in main memory ◦ S i : size of the memory location ◦ S i : size of the memory location Similar to Location Sets [Wilson and Lam; PLDI’95] [S´ em´ eria and De Micheli; TCAD’01] Abstract concepts, independent of the target memory architecture HW Memory Locations are not addresses but can be directly translated to addresses Evaluated HLS compilers (Bambu, LegUp, Commercial Tool) use equivalent representations P.Fezzardi – pietro.fezzardi@polimi.it 4 FPL 2016 – Lausanne – 01/09/2016

  12. Memory Allocation For memory allocation, HLS tools take mainly two decisions: which variables have to be allocated in memory • usually global, static , volatile , arrays, and struct s • possibly others, according to alias analysis the location where every memory-mapped variable is stored • depends on HLS implementation • depends on memory architecture of the generated design • depends on the memory optimizations and partitioning P.Fezzardi – pietro.fezzardi@polimi.it 5 FPL 2016 – Lausanne – 01/09/2016

  13. Assumptions for Address Discrepancy Analysis General Assumption I Every HW Memory Location must be associated to a single memory-mapped variable The inverse mapping of high-level variables onto HW Memory Locations must be known It is simply the inverse of the mapping computed by memory allocation in HLS � General Assumption II It has to be possible to identify the signals representing pointer variables in HW Previous results show that this is possible � P.Fezzardi – pietro.fezzardi@polimi.it 6 FPL 2016 – Lausanne – 01/09/2016

  14. Address Space Translation Scheme Address Space Translation Scheme (ASTS) Hardware Address Table (HAT) Software Address Table (SAT) � M i , B i , S i � � CB i , CS i � i j i i : variable identifier j : SW Call Context ID � M i , B i , S i � : HW Memory Location � CB i , CS i � : SW Memory Location i : variable identifier P.Fezzardi – pietro.fezzardi@polimi.it 7 FPL 2016 – Lausanne – 01/09/2016

  15. The Software Call Context Identifier In HW fun a The HAT is computed by memory allocation during HLS Memory Locations in HW are defined once ahead of time In SW Local variables are allocated on the stack &d = fun b 0xFFFF1234 Different Memory Location at every function call An ID is necessary to distinguish between calls &d = 0xFFFF4321 An ID uniquely identifies a path on the call graph Function calls are instrumented in the C code fun c int d; Context ID and memory mapping are printed at runtime P.Fezzardi – pietro.fezzardi@polimi.it 8 FPL 2016 – Lausanne – 01/09/2016

  16. The Extended Address Discrepancy Analysis Flow CONTROL ORIGINAL FINITE HARDWARE DATA DATA SOURCE STATE DESCRIPTION FRONTEND FLOW HLS PATH BACKEND CODE MACHINE LANGUAGE GRAPH (DP) ( C ) (FSM) (HDL) (CDFG) INFORMATION EXTRACTED FSM optimizations source level chaining information pipelining resource sharing list of signals instrumented to collect C code in SSA scheduling HW traces after frontend binding optimizations allocation DEBUGGING compilation cycle accurate RTL simulation + STEPS execution SW Traces HW Traces (VCD) DISCREPANCY ANALYSIS INFORMATION first mismatch between faulty module DEBUG HW and SW executions in HW design state of FSM hierachical path and value of the name of the wrong signal wrong signal failed operation in C start and end time value of the of the failed operation related C variable SW call stack trace P.Fezzardi – pietro.fezzardi@polimi.it 9 FPL 2016 – Lausanne – 01/09/2016

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