Weak-Memory Program Detection for Reordering Error Analysis

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Programs developed for strong memory models face issues when ported to weak memory models, leading to potential crashes, restarts, or incorrect calculations, with low reproducibility and high costs for debugging due to the software ecological environment lag.

Innovation Solution

A program detection method and apparatus that uses a query parameter to determine the maximum interval between operations prone to reordering, applying memory read/write mode query rules to identify errors in programs running on weak memory environments, providing results and modification suggestions for efficient debugging.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If manual testing and debugging is performed by experienced developers to detect program errors on weak memory model platforms, then detection accuracy is improved, but detection efficiency deteriorates and costs increase

Engineering Contradiction:
Improvedetection accuracyVSAvoiddetection efficiency
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The system performs self-detection of memory ordering issues by automatically analyzing program code and generating test cases that expose reordering problems, eliminating the need for manual debugging while maintaining high detection accuracy through automated static analysis and dynamic testing mechanisms

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

An automated detection tool acts as an intermediary between the program and the weak memory model platform, inserting instrumentation code that tracks memory operation ordering and identifies violations without requiring manual intervention from developers

Inventive Principle:
Principle #24Intermediary (Mediator)

2Measurement precision

If repeated testing and debugging is performed to reproduce exceptions on weak memory model platforms, then detection accuracy is improved, but time consumption increases

Engineering Contradiction:
Improvedetection accuracyVSAvoidtime consumption
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The system performs preliminary static analysis of the program code before execution to identify potential memory ordering issues and pre-generates targeted test cases that are likely to expose reordering problems, eliminating the need for repeated trial-and-error testing to reproduce exceptions

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system proactively prevents time loss by inserting instrumentation code that anticipates and detects memory reordering issues before they manifest as hard-to-reproduce exceptions, allowing immediate identification of problematic code paths without repeated testing

Inventive Principle:
Principle #9Preliminary anti-action

3Measurement precision

If extensive manual testing is performed to account for low reproducibility of exceptions, then detection accuracy is improved, but costs increase

Engineering Contradiction:
Improvedetection accuracyVSAvoidtesting complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

An automated detection tool serves as an intermediary that systematically manages the complexity of testing by handling test case generation, execution, and analysis, reducing the burden on testers and eliminating the need for extensive manual testing while maintaining high detection accuracy

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS12379872B2Program detection method and apparatus
Publication Date: 2025.08.05 HUAWEI TECH CO LTD
  • US12379872B2 patent drawing
  • US12379872B2 patent drawing
  • US12379872B2 patent drawing

AI summary

A program detection method includes receiving a program provided by a user, and obtaining, based on a query parameter and the program, a result of the program running in a weak memory environment. The query parameter indicates a maximum interval between two operations on which reordering occurs and that are of the program.