Compiler Bit-Width Analysis for Variable Liveness

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional compilers waste computational resources by representing variables with a fixed number of bits, leading to inefficient power consumption and performance in processing systems, as they do not account for the actual bit usage during program execution.

Innovation Solution

Implementing bit-width analysis during compilation to determine the smallest bit size required for each variable while ensuring correct program semantics, using backwards flow analysis and transfer functions to estimate the minimum number of bits needed based on instruction operations and variable liveness.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If variables are represented by a fixed number of bits (e.g., 64 bits for all pointers), then program correctness is ensured, but computational resources are wasted and power consumption increases

Engineering Contradiction:
Improveprogram correctnessVSAvoidcomputational resource usage
Core Design Contradiction:
ReliabilityVSUse of energy by moving object

Solution Approach 1:

The patent applies dynamics by making bit-width allocation dynamic rather than static. The system performs bit-width analysis during compilation to determine the actual minimum bit requirements for each variable based on program semantics and control flow analysis. This allows the bit-width to adapt to the actual needs of each variable instance, using more bits only when necessary for correctness and fewer bits when sufficient, thereby resolving the contradiction between ensuring program correctness and reducing computational resource usage.

Inventive Principle:
Principle #15Dynamics

2Ease of manufacture

If variables are represented by a fixed number of bits, then implementation simplicity is maintained, but hardware efficiency and performance are degraded

Engineering Contradiction:
Improveimplementation simplicityVSAvoidhardware efficiency
Core Design Contradiction:
Ease of manufactureVSProductivity

Solution Approach 1:

The patent applies preliminary action by performing bit-width analysis during the compilation phase rather than during runtime or hardware operation. The compiler analyzes the program semantics, control flow, and variable usage patterns to determine the minimum required bit-width for each variable before code generation. This preliminary determination allows the generated code to use optimized bit-widths that improve hardware efficiency while keeping the implementation approach relatively simple, as the complexity is shifted to the compilation stage.

Inventive Principle:
Principle #10Preliminary action

3Reliability

If full bit allocation is used for all variables, then program semantics are preserved, but unnecessary computations occur and performance suffers

Engineering Contradiction:
Improveprogram semantics preservationVSAvoidexecution time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent applies local quality by allowing different variables to have different bit-width allocations based on their specific requirements in the program. Instead of uniformly allocating the same bit-width to all variables, the system performs local analysis for each variable to determine its minimum required bit-width based on its usage context, data type, and control flow. This localized optimization ensures program semantics are preserved for each variable while avoiding unnecessary computations associated with using excessive bit-widths.

Inventive Principle:
Principle #3Local quality

Data Source

PatentUS10180826B2Estimation of bit widths of variables based on liveness
Publication Date: 2019.01.15 ADVANCED MICRO DEVICES INC
  • US10180826B2 patent drawing
  • US10180826B2 patent drawing
  • US10180826B2 patent drawing

AI summary

A compiler generates transfer functions for blocks of a program during compilation of the program. The transfer functions estimate bit widths of variables in the blocks based on numbers of bits needed to carry out at least one instruction in the blocks and whether the variables are live in the blocks. For example, a transfer function may return a number indicating how many bits of a variable are needed to execute a current instruction as a function of the number of bits of the variable used by the program in subsequent instructions. Numbers of bits to represent the variables in the compiled program based on the transfer functions.