Function Segment Prefetch Layout for Cross-Library Cache Hits

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for prefetching function segments across different libraries result in cache misses, leading to reduced program processing efficiency due to the inability to hit the L1 cache effectively.

Innovation Solution

The method involves loading a dynamic library file with function segments from different libraries adjacently in memory based on a loading script that considers function call frequencies, ensuring that frequently called segments are placed next to each other, thereby improving cache hit rates.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of manufacture

If function segments from different libraries are loaded sequentially to memory, then the loading process is simple, but cache hit rate decreases due to cross-library calls

Engineering Contradiction:
Improveloading process simplicityVSAvoidcache hit rate
Core Design Contradiction:
Ease of manufactureVSReliability

Solution Approach 1:

The patent applies preliminary action by analyzing function call relationships before loading function segments into memory. The system pre-determines the arrangement of function segments based on call frequency and call relationships, placing frequently called functions from different libraries in adjacent memory locations. This preliminary arrangement ensures that when prefetching occurs, the L1 cache can hit the required function segments, thereby resolving the cache miss problem caused by sequential loading from different libraries.

Inventive Principle:
Principle #10Preliminary action

2Productivity

If function segments are arranged by function order within each library, then intra-library function calls are efficient, but inter-library function calls result in cache misses

Engineering Contradiction:
Improveintra-library processing efficiencyVSAvoidinter-library cache hit rate
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent applies local quality by differentiating the arrangement strategy based on the type of function call. For intra-library calls, function segments are arranged by function order to maintain efficiency. For inter-library calls, the system identifies frequently called functions and places them in adjacent memory locations regardless of library boundaries. This localized optimization ensures that both intra-library and inter-library function calls can achieve high cache hit rates, resolving the contradiction between the two types of calls.

Inventive Principle:
Principle #3Local quality

3Reliability

If frequently called function segments from different libraries are placed adjacently in memory, then cache hit rate improves, but memory arrangement complexity increases

Engineering Contradiction:
Improvecache hit rateVSAvoidmemory arrangement complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent applies feedback by using call graph analysis to gather information about function call relationships and call frequencies. This feedback information is then used to optimize the memory arrangement of function segments. The system continuously monitors and analyzes call patterns, and adjusts the memory arrangement accordingly. This feedback-driven approach enables the system to achieve high cache hit rates for inter-library calls without requiring complex manual arrangement, as the optimization is automatically driven by actual runtime behavior data.

Inventive Principle:
Principle #23Feedback

Data Source

PatentEP4471582B1Method for pre-fetching function segment, and network device
Publication Date: 2026.03.25 HUAWEI TECH CO LTD
  • EP4471582B1 patent drawingFigure 1
  • EP4471582B1 patent drawingFigure 2
  • EP4471582B1 patent drawingFigure 3

AI summary

A method for prefetching a function segment is provided. The method includes: after a starting program instruction is received, obtaining a loading script based on the starting program instruction, loading, based on the loading script, a dynamic library file including a first function segment and a second function segment to a memory, and executing the first function segment and prefetching the second function segment from the memory. A quantity of times that the first function segment calls the second function segment is greater than a quantity of times that the first function segment calls another function segment. The first function segment and the second function segment that correspond to different function libraries are placed at adjacent locations in the memory based on a quantity of function call times, so that when an inter-library function segment is prefetched, a cache hit rate can be improved and program processing efficiency can be improved. This application further provides a network device that can implement the foregoing method.