Compiler Optimization for N-Dimensional Variable Arrays

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Compilers generating object code from source code with instructions for accessing data in multidimensional variable-length arrays often result in cache misses, leading to inefficient execution due to non-contiguous memory access, which decreases the cache hit rate and degrades CPU performance.

Innovation Solution

The compiler converts instructions for storing and accessing data in N-dimensional variable-length arrays into instructions for storing data in N-dimensional fixed-length arrays and subsequently converting these to contiguous one-dimensional fixed-length arrays, optimizing memory access and improving cache hit rates.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If data is stored in N-dimensional variable-length arrays, then memory flexibility and adaptability are improved, but memory access becomes non-contiguous causing cache misses and degrading CPU performance

Engineering Contradiction:
Improvememory flexibilityVSAvoidCPU execution efficiency
Core Design Contradiction:
Adaptability or versatilityVSProductivity

Solution Approach 1:

The patent segments the N-dimensional variable-length array into multiple one-dimensional fixed-length arrays, where each dimension becomes a separate array. This segmentation allows each dimension to be accessed contiguously in memory while preserving the flexibility of variable-length arrays, thereby resolving the contradiction between memory flexibility and CPU execution efficiency.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent transforms the N-dimensional array structure into multiple one-dimensional arrays by adding a new dimension for storing array metadata (bounds, offsets). This dimensional transformation enables contiguous memory access patterns while maintaining the variable-length characteristics of the original N-dimensional array, thus improving both cache hit rate and execution efficiency.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Adaptability or versatility

If data is stored in N-dimensional variable-length arrays, then adaptability is improved, but cache hit rate decreases due to non-contiguous access

Engineering Contradiction:
Improvearray flexibilityVSAvoidcache hit rate
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent segments the multi-dimensional array into multiple one-dimensional arrays, ensuring that data within each dimension is stored contiguously in memory. This segmentation strategy maintains the adaptability of variable-length arrays while improving cache hit rates by eliminating non-contiguous access patterns that cause cache misses.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces metadata structures (storing bounds, offsets, and dimensions) as intermediaries between the variable-length array requirements and the fixed-length array storage. These intermediaries enable the system to maintain array flexibility while using contiguous fixed-length arrays for actual data storage, thereby improving cache performance.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Adaptability or versatility

If compilers generate object code for N-dimensional variable-length arrays, then programming versatility is maintained, but execution efficiency degrades due to non-contiguous memory access

Engineering Contradiction:
Improveprogramming flexibilityVSAvoidexecution time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The patent segments the N-dimensional array into multiple one-dimensional fixed-length arrays during compilation, allowing the compiler to generate optimized object code that accesses data contiguously. This segmentation enables the program to maintain variable-length array versatility while executing with improved time efficiency due to better cache utilization.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary transformation of the N-dimensional variable-length array into multiple one-dimensional fixed-length arrays during the compilation phase. This preliminary action allows the compiler to optimize memory access patterns before execution, reducing execution time while preserving the original program's versatility.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS11231917B2Information processing apparatus, computer-readable recording medium storing therein compiler program, and compiling method
Publication Date: 2022.01.25 FUJITSU LTD
  • US11231917B2 patent drawing
  • US11231917B2 patent drawing
  • US11231917B2 patent drawing

AI summary

An information processing apparatus includes a memory; and a processor coupled to the memory and the processor configured to when source code includes an instruction for storing units of data in an area of an N-dimensional variable-length array (N being an integer and a value of N being equal to or greater than 2), generate object code in the memory to cause the units of data to be stored in an area of an N-dimensional fixed-length array instead of the area of the N-dimensional variable-length array, and when the source code includes an instruction for successively accessing the unit of data stored in the area of the N-dimensional variable-length array, generate the object code in the memory to cause the units of data stored in the area of the N-dimensional fixed-length array to be stored contiguously in an area of a one-dimensional fixed-length array.