Separate Compilation of Host and Device Code

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional host linkers are unable to generate executable files from multiple host objects, each containing respective host code for CPU execution and device code for GPU execution, as they fail to properly link device code embedded in each host object.

Innovation Solution

A method and system that support separate compilation and linking of host code and device code, allowing device code to be extracted from host object files, linked together, and embedded back into a host object, which is then passed to a host linker to form a final executable file, enabling the creation of executable files from multiple host objects with separate CPU and GPU code.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If device code is embedded in multiple host objects, then code modularity and reusability are improved, but conventional host linkers cannot properly link the device code

Engineering Contradiction:
Improvecode modularityVSAvoidlinking capability
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent segments the linking process into two independent phases: a device linker phase that processes device code from multiple host objects, and a host linker phase that processes host code. This segmentation allows device code to be extracted, linked separately, and then re-integrated into the final executable, resolving the contradiction between code modularity and linking capability.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a device linker as an intermediary component between the host objects and the final executable. This intermediary specifically handles device code extraction, linking, and reintegration, enabling multiple host objects with embedded device code to be properly linked without compromising code modularity.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Productivity

If separate compilation of host and device code is implemented, then compilation efficiency and maintainability are improved, but complexity of the compilation system increases

Engineering Contradiction:
Improvecompilation efficiencyVSAvoidcompilation system complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The compilation system is segmented into separate compilers for host code and device code, along with separate linking phases. This allows independent compilation of host and device code, improving productivity and maintainability while managing complexity through structured separation of concerns.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The device code is extracted and linked separately before the final host executable is generated. This preliminary action of device code processing allows the main host code to be compiled and linked independently, improving compilation efficiency while the extracted device code is handled in a dedicated phase.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS9483235B2Method and system for separate compilation of device code embedded in host code
Publication Date: 2016.11.01 NVIDIA CORP
  • US9483235B2 patent drawing
  • US9483235B2 patent drawing
  • US9483235B2 patent drawing

AI summary

Embodiments of the present invention provide a novel solution that supports the separate compilation of host code and device code used within a heterogeneous programming environment. Embodiments of the present invention are operable to link device code embedded within multiple host object files using a separate device linking operation. Embodiments of the present invention may extract device code from their respective host object files and then linked them together to form linked device code. This linked device code may then be embedded back into a host object generated by embodiments of the present invention which may then be passed to a host linker to form a host executable file. As such, device code may be split into multiple files and then linked together to form a final executable file by embodiments of the present invention.