Code Translation Barrier Reduction for Execution Speed

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional translators emit unnecessary memory barriers when translating processor instructions from a stronger memory model to a weaker one, leading to increased instruction count and decreased execution performance.

Innovation Solution

A method that analyzes processor instructions to determine which memory operations can be made order-independent in the target ISA, emitting unbarriered instructions for such operations and only emitting barriered instructions when necessary, thereby reducing the number of barriered instructions and improving performance.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If memory barriers are emitted for all memory operations when translating from a stronger memory model to a weaker one, then memory ordering correctness is preserved, but instruction count increases and execution performance decreases

Engineering Contradiction:
Improvememory ordering correctnessVSAvoidexecution performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent applies local quality by differentiating between various types of memory operations and applying memory barriers only where necessary. Instead of uniformly barriering all memory operations, the system analyzes each operation's characteristics (load vs. store, synchronization variables vs. regular variables, ordering constraints) and selectively applies barriers only to operations that require ordering guarantees in the weaker memory model, thereby preserving correctness while minimizing performance impact.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The patent changes the parameter of memory operation ordering by analyzing the source memory model's constraints and transforming them appropriately for the target memory model. The system evaluates ordering requirements based on the source ISA's memory model properties and only enforces ordering where the target memory model would otherwise violate correctness, thus adapting the ordering parameters dynamically rather than applying a fixed conservative approach.

Inventive Principle:
Principle #35Parameter changes

2Reliability

If memory barriers are emitted for all memory operations when translating from a stronger memory model to a weaker one, then memory ordering correctness is preserved, but code size increases

Engineering Contradiction:
Improvememory ordering correctnessVSAvoidcode size
Core Design Contradiction:
ReliabilityVSQuantity of substance

Solution Approach 1:

The patent reduces code size by applying memory barriers locally only to specific memory operations that require ordering, rather than inserting barriers for all memory operations. The system identifies operations with ordering requirements based on the source memory model and target memory model comparison, and emits barriers only for those operations, thereby minimizing the increase in code size while maintaining correctness.

Inventive Principle:
Principle #3Local quality

3Reliability

If conventional translators emit barriered instructions for all memory operations, then memory reordering issues are addressed, but the translated code executes slower

Engineering Contradiction:
Improvememory reordering handlingVSAvoidexecution speed
Core Design Contradiction:
ReliabilityVSSpeed

Solution Approach 1:

The patent improves execution speed by applying memory barriers locally only to memory operations that have reordering issues in the target memory model. The system analyzes each memory operation's characteristics and the relationship between source and target memory models to determine whether a barrier is necessary, emitting barriers only where needed rather than universally, thus preserving reordering correctness while minimizing speed degradation.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The patent changes the execution speed parameter by dynamically determining ordering requirements based on the source and target memory model properties. Instead of always emitting barriers, the system evaluates whether ordering constraints are necessary for each operation and adjusts the barrier emission accordingly, thereby optimizing execution speed while maintaining memory reordering correctness.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS10552131B2Barrier reduction during code translation
Publication Date: 2020.02.04 MICROSOFT TECHNOLOGY LICENSING LLC
  • US10552131B2 patent drawing
  • US10552131B2 patent drawing
  • US10552131B2 patent drawing

AI summary

Reducing emission of barriered instructions when translating processor instructions between instruction set architectures (ISA's). Embodiments include obtaining block(s) of processor instructions formatted according to a first processor ISA. The block(s) include an instruction that performs a memory operation whose execution order is constrained based on a hardware memory model of the first processor ISA. Based on an analysis of the block(s) of processor instructions, it is determined that the memory operation of the at least one instruction can be made order-independent in a hardware memory model of a second processor ISA. Based on the determination, one or more unbarriered processor instructions that are formatted according to the second processor ISA are emitted. The unbarriered processor instruction(s) are structured to perform the memory operation without ordering constraint.