Dual-Mode JIT Compiler for SIMD and Compatibility

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

The .NET Compact Framework JIT compiler historically emits code performing all floating-point arithmetic in double precision, which can break backwards compatibility if switched to single precision, and existing systems lack the ability to efficiently utilize SIMD instructions for data-parallel calculations while ensuring compatibility across multiple applications running concurrently.

Innovation Solution

A dual-mode JIT compiler that allows applications to select between single-precision and double-precision code generation modes, enabling the generation of SIMD instructions and ensuring backwards compatibility by performing JIT-time and runtime checks based on the application's preferred mode for floating-point calculations.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If the JIT compiler emits code performing all floating-point arithmetic in double precision, then backwards compatibility is maintained, but performance benefits of SIMD instructions for data-parallel calculations are lost

Engineering Contradiction:
Improvebackwards compatibilityVSAvoidperformance of data-parallel calculations
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The code generation is segmented into two distinct modes: single-precision SIMD mode and double-precision mode. The JIT compiler determines which mode to use based on whether the application has opted-in to SIMD code generation and whether the method call originated from application code or platform code. This segmentation allows each mode to be optimized for its specific purpose while maintaining overall system compatibility.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system dynamically switches between single-precision and double-precision code generation based on runtime conditions. For application code that has opted-in, the compiler performs JIT-time checks and generates appropriate code. For calls from platform code, runtime checks are performed to determine the application's preferred mode. This dynamic adaptation resolves the contradiction by allowing the system to be both compatible and performant as needed.

Inventive Principle:
Principle #15Dynamics

2Productivity

If the JIT compiler generates SIMD instructions for all applications, then performance of data-parallel calculations is improved, but backwards compatibility is broken for legacy applications

Engineering Contradiction:
Improveperformance of data-parallel calculationsVSAvoidbackwards compatibility
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

SIMD code generation is applied locally only to applications that have explicitly opted-in through compilation with the -optimize:simd flag. The JIT compiler checks at JIT-time whether the application code has opted-in before generating SIMD instructions. This localized application of SIMD optimization allows performance improvements for targeted applications while leaving legacy applications unaffected, thus maintaining backwards compatibility.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The system changes the precision parameter dynamically based on application preferences. When an application has opted-in and the call originated from application code, the JIT compiler generates single-precision SIMD code. When called from platform code, runtime checks determine the preferred precision mode. This parameter change allows the system to optimize for performance when appropriate while maintaining compatibility when needed.

Inventive Principle:
Principle #35Parameter changes

3Productivity

If the JIT compiler performs JIT-time checks for SIMD optimization, then code generation efficiency is improved, but complexity of the compilation process increases

Engineering Contradiction:
Improvecode generation efficiencyVSAvoidcomplexity of JIT compilation process
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The system performs preliminary checks at JIT-time to determine whether an application has opted-in to SIMD code generation and whether the method call originated from application code or platform code. These preliminary determinations allow the JIT compiler to take the appropriate code generation path efficiently, avoiding unnecessary runtime checks for applications that have already opted-in, thus balancing efficiency with the added complexity.

Inventive Principle:
Principle #10Preliminary action

4Adaptability or versatility

If the JIT compiler performs runtime checks for method dispatch, then adaptability to different precision modes is improved, but execution overhead increases

Engineering Contradiction:
Improveadaptability to different precision modesVSAvoidexecution overhead
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The system dynamically determines the application's preferred precision mode at runtime through checks performed when platform code calls SIMD-enabled methods. This dynamic adaptation allows the system to support multiple precision modes and maintain versatility. The runtime checks are performed only when necessary (for platform code calls), minimizing the execution overhead while maintaining adaptability.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS8756589B2Selectable dual-mode JIT compiler for SIMD instructions
Publication Date: 2014.06.17 MICROSOFT TECHNOLOGY LICENSING LLC
  • US8756589B2 patent drawing
  • US8756589B2 patent drawing
  • US8756589B2 patent drawing

AI summary

A JIT (Just-In-Time) compiler performs dual-mode code generation by determining whether an application has opted-in to SIMD (Single Instruction Multiple Data) code generation both at JIT-time and at runtime. The application may select the code generation mode by identifying whether it has opted-in to SIMD code generation. As a result, the underlying implementation guarantees application compatibility by allowing the application to select the code generation mode. Additionally, applications have the ability to select into different code generation modes during concurrent execution.