Compiler Data Packing for Graphics Shader Memory Optimization

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing graphics processing pipelines face inefficiencies in memory usage due to data being output by one shader program not being used by another, leading to wasted memory storage and gaps in memory.

Innovation Solution

A compiler analyzes the output instructions of a first shader program to identify data not used by a second shader program, and modifies the shader programs to avoid generating memory writes for unused data, using data packing to aggregate memory access instructions and reduce memory footprint.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If shader programs output all possible data to ensure compatibility with multiple subsequent shader programs, then adaptability is improved, but memory usage increases due to unused data being stored

Engineering Contradiction:
Improveshader program compatibilityVSAvoidmemory usage
Core Design Contradiction:
Adaptability or versatilityVSQuantity of substance

Solution Approach 1:

The compiler performs preliminary analysis of shader programs to determine which data outputs from a first shader program are actually used by subsequent shader programs. This advance analysis allows the system to optimize memory usage by only storing and transferring necessary data, rather than all possible data, thereby reducing memory consumption while maintaining adaptability through compiler-driven compatibility management

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system dynamically changes the data transmission parameters between shader programs based on actual usage requirements. The compiler analyzes and determines the optimal data subset to transfer, adjusting the data volume and content parameters according to what is actually needed by subsequent shader stages, thus reducing unnecessary memory allocation while preserving program compatibility

Inventive Principle:
Principle #35Parameter changes

2Ease of operation

If data is written to general purpose memory for inter-shader communication, then ease of operation is improved, but memory footprint increases due to gaps and unused data

Engineering Contradiction:
Improvedata transmission simplicityVSAvoidmemory footprint
Core Design Contradiction:
Ease of operationVSQuantity of substance

Solution Approach 1:

The compiler extracts and identifies only the necessary data elements that need to be transmitted between shader programs. By separating the essential data from unnecessary data and gaps, the system creates an optimized data transmission mechanism that maintains the simplicity of general purpose memory access while eliminating wasted memory footprint through precise data extraction and selective transfer

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

Instead of writing all possible data to memory (excessive action), the compiler performs partial action by writing only the specific data elements that are actually used by subsequent shader programs. This partial writing approach reduces memory footprint by eliminating gaps and unused data while maintaining ease of operation through the compiler's automated data selection and optimized memory access patterns

Inventive Principle:
Principle #16Partial or excessive action

3Reliability

If multiple memory access instructions are used to ensure all data is transmitted, then reliability is improved, but productivity decreases due to increased memory access overhead

Engineering Contradiction:
Improvedata transmission completenessVSAvoidprocessing throughput
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The compiler performs preliminary analysis to identify and aggregate memory access instructions that can be combined. By pre-determining which data elements are actually used and grouping their access operations, the system reduces the total number of memory access instructions required, thereby improving processing throughput while maintaining data transmission completeness through compiler-verified data coverage

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system merges and aggregates multiple memory access instructions into fewer, more efficient operations. The compiler analyzes data usage patterns and combines adjacent or related memory accesses into single optimized instructions, reducing the overhead of multiple separate access operations while ensuring all necessary data is reliably transmitted to subsequent shader programs

Inventive Principle:
Principle #5Merging (Combining)

Data Source

PatentEP3803777B1Compiler-assisted techniques for memory use reduction in graphics pipeline
Publication Date: 2025.05.21 ADVANCED MICRO DEVICES INC
  • EP3803777B1 patent drawingFigure 1
  • EP3803777B1 patent drawingFigure 2
  • EP3803777B1 patent drawingFigure 3

AI summary

Techniques for improving memory utilization for communication between stages of a graphics processing pipeline are disclosed. The techniques include analyzing output instructions of a first shader program to determine whether any such output instructions output some data that is not used by a second shader program. The compiler performs data packing if gaps exist between used output data to reduce memory footprint. The compiler generates optimized output instructions in the first shader program and optimized input instructions in the second shader program to output the used data from the first shader program and input that data in the second shader program in a packed format based on information about usage of output data and data packing. If needed, the compiler inserts instructions to perform runtime checking to identify unused output data of the first shader program based on information not known at compile-time.