Compiler-Inserted System Calls for SMT Thread Contention

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current OS schedulers and compilers fail to proactively manage contention between software threads competing for the same CPU resource in SMT-enabled CPUs, leading to inefficiencies where one thread waits while the CPU resource remains idle on another core.

Innovation Solution

An enhanced compiler identifies instructions directed to inner computation units and inserts system calls to direct threads to available CPU resources, allowing the OS scheduler to dynamically dispatch threads to separate CPUs, thereby optimizing resource utilization.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If the OS scheduler dispatches software threads to CPU resources without proactive contention detection, then the scheduling process is simple and fast, but thread contention occurs causing threads to wait while CPU resources remain underutilized

Engineering Contradiction:
ImproveCPU resource utilizationVSAvoidthread wait time
Core Design Contradiction:
ProductivityVSLoss of time

Solution Approach 1:

The compiler inserts system calls at the beginning of code blocks that execute on inner computation units, proactively announcing the thread's intent to use specific CPU resources before execution begins. This allows the OS scheduler to detect resource requests in advance and dispatch multiple threads to different CPUs, preventing contention and wait states before they occur.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system implements a feedback mechanism where threads send system calls to the OS scheduler indicating their resource requirements, and the scheduler responds by making informed dispatching decisions. This closed-loop communication enables the scheduler to optimize thread placement based on real-time resource availability information.

Inventive Principle:
Principle #23Feedback

2Productivity

If the OS scheduler proactively detects contention and dispatches threads to separate CPUs, then thread contention is prevented and CPU utilization improves, but the scheduling complexity increases

Engineering Contradiction:
ImproveCPU resource utilizationVSAvoidscheduler complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The compiler acts as an intermediary that automatically inserts system calls into the code, translating high-level program logic into resource-aware executable code. This intermediary handles the complexity of resource annotation, allowing the OS scheduler to work with simple, standardized system call interfaces rather than implementing complex analysis logic itself.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The compilation process performs self-service by automatically analyzing the code, identifying inner computation unit instructions, and inserting appropriate system calls without requiring manual intervention. This automation reduces the operational complexity of implementing proactive scheduling, as the system configures itself during compilation.

Inventive Principle:
Principle #25Self-service

3Productivity

If system calls are inserted in the executable code to indicate inner computation unit usage, then the OS scheduler can optimize thread dispatching, but the code generation complexity increases

Engineering Contradiction:
Improvethread dispatching efficiencyVSAvoidcode generation complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The compiler detects changes in execution context parameters (such as entering or leaving code blocks that use inner computation units) and inserts system calls at these boundary points. By monitoring parameter changes in the code structure, the compiler automatically generates appropriate resource annotation code without requiring complex manual code transformation rules.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS11966726B2Operating system (OS) scheduler and compiler for code generation optimization in a (simultaneous multi-threading) SMT enabled CPU
Publication Date: 2024.04.23 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US11966726B2 patent drawing
  • US11966726B2 patent drawing
  • US11966726B2 patent drawing

AI summary

A method, computer program product, and computer system are provided. An enhanced compiler identifies instructions for execution among them, instructions directed to an inner computation unit of a CPU core. In response to identifying instructions directed to the inner computation unit, locating in a system call table a system call to indicate a begin of an executable code block of instructions that are directed to the inner computation unit of the CPU core. The enhanced compiler searches the system hardware registry for the parameter corresponding to the inner computation unit of the CPU core. The system call is inserted as an interrupt instruction in the compiler output at the begin of the executable code block of instructions that are directed to the inner computation unit of the CPU core. The enhanced compiler executable code output is saved for later selection by a scheduler of an operating system.