Host-Device Code Coverage Coordination for GPU Functions
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current compiler techniques fail to provide code coverage information for code executed by co-processors like GPUs due to the difficulty in coordinating between host and device processors during instrumentation.
Innovation Solution
An integrated compiler system that generates instrumented executable code with coverage instrumentation counters, mapping information, and memory requirements, enabling code coverage reporting by coordinating between host and device processors.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of information
If current compiler techniques are used, then compilation is simple, but code coverage information for co-processor code cannot be obtained
Solution Approach 1:
The system segments code coverage tracking into two independent parts: host processor coverage tracking handled by the host compiler, and device processor coverage tracking handled by the device compiler. Each compiler independently instruments its respective code without requiring complex coordination mechanisms, thus obtaining complete coverage information while avoiding coordination complexity.
Solution Approach 2:
The patent introduces an intermediary mechanism in the form of a standardized interface between host and device compilers. This interface allows each compiler to independently generate coverage instrumentation while maintaining compatibility through predefined protocols, enabling coverage information collection without direct complex coordination between host and device processors.
2Loss of information
If code coverage instrumentation is added to device code, then coverage information can be collected, but coordination difficulty between host and device increases
Solution Approach 1:
The instrumentation process is segmented into independent host and device components. The device compiler independently instruments device code with coverage counters and mapping information without requiring real-time coordination with the host compiler during the instrumentation phase, reducing detection and measurement difficulty.
Solution Approach 2:
All coverage instrumentation for device code is performed in advance during the compilation phase. The device compiler generates instrumented device code with embedded coverage counters and mapping information before execution, eliminating the need for complex runtime coordination between host and device for instrumentation purposes.
3Adaptability or versatility
If separate compilation is used, then compilation flexibility is improved, but complete function call list is unavailable during device code compilation
Solution Approach 1:
The device compiler performs preliminary instrumentation of device code with placeholder coverage counters and mapping information during separate compilation, even without the complete function call list. The actual coverage data collection occurs during execution, allowing flexible separate compilation while still obtaining complete coverage information.
Solution Approach 2:
The system implements a feedback mechanism where the device compiler generates instrumented code with coverage counters that are populated during actual device code execution. The coverage information is fed back through the execution environment, allowing separate compilation to maintain flexibility while complete coverage data is collected during runtime based on actual function calls.
Data Source
AI summary
System and method of compiling a program having a mixture of host code and device code to enable code coverage data collection for device code execution. An exemplary integrated compiler can compile source code programmed to be executed by a host processor (e.g., CPU) and a co-processor (e.g., a GPU) concurrently. The compilation can generate an instrumented executable code which includes: coverage instrumentation counters for the device functions; mapping information that maps the counters with the instrumented source points; and instructions for the host processor to allocate and initialize device memory for the counters and to retrieve collected code coverage information from the device memory to the host memory. Execution of the instrumented executable can yield a coverage report on the device code functions.


