GPU Workgroup Synchronization via Waiting Atomic Instructions

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Graphics Processing Units (GPUs) face issues with independent forward progress due to oversubscribed execution scenarios and resource deadlocks, particularly when kernels use fine-grain synchronization, leading to difficulties in detecting waiting workgroups and performing context switches.

Innovation Solution

A processing system that employs waiting atomic instructions to detect workgroups waiting for synchronization variables by comparing loaded data with expected values, monitors these workgroups, and manages context switches to prevent deadlocks by identifying and awakening waiting workgroups when synchronization variables are released.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If GPUs use pre-emption to ensure independent forward progress for concurrently executing kernels, then kernel execution independence is improved, but hardware deadlocks still occur in fine-grain synchronization scenarios

Engineering Contradiction:
Improveindependent forward progressVSAvoidhardware deadlocks
Core Design Contradiction:
ReliabilityVSObject-affected harmful factors

Solution Approach 1:

The system performs preliminary actions by detecting which workgroups are waiting for synchronization variables before context switching occurs. This is achieved through waiting atomic instructions that allow the scheduler to identify waiting workgroups in advance, preventing deadlocks by ensuring that pre-empted workgroups that are waiting do not hold synchronization variables that would block other workgroups.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system implements feedback mechanisms where workgroups execute waiting atomic instructions that provide information back to the scheduler about their synchronization state. The scheduler uses this feedback to make informed context switching decisions, only pre-empting workgroups that are not waiting for synchronization variables, thus preventing hardware deadlocks while maintaining independent forward progress.

Inventive Principle:
Principle #23Feedback

2Adaptability or versatility

If GPUs allow fine-grain synchronization for inter-workgroup coordination, then workgroup coordination capability is improved, but resource contention and deadlocks increase

Engineering Contradiction:
Improveinter-workgroup coordinationVSAvoidresource deadlock prevention
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The scheduler acts as an intermediary between workgroups and synchronization variables. It introduces a coordination mechanism where workgroups must execute waiting atomic instructions to indicate they are waiting for synchronization variables. The scheduler mediates context switching decisions based on this information, preventing deadlocks by ensuring that waiting workgroups are not pre-empted while holding synchronization variables, thus enabling safe fine-grain synchronization.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

Workgroups self-identify their waiting state by executing waiting atomic instructions that compare loaded data with expected values. This self-service mechanism allows the system to detect waiting workgroups without complex external monitoring, enabling the scheduler to make informed decisions about which workgroups can be safely pre-empted, thus preventing deadlocks while maintaining coordination capability.

Inventive Principle:
Principle #25Self-service

3Ease of operation

If the system performs context switches of waiting workgroups, then execution flexibility is improved, but detecting which workgroups are waiting becomes impractical

Engineering Contradiction:
Improvecontext switch flexibilityVSAvoidwaiting workgroup detection
Core Design Contradiction:
Ease of operationVSDifficulty of detecting and measuring

Solution Approach 1:

Workgroups self-identify their waiting state by executing waiting atomic instructions that compare loaded data with expected values. This self-service mechanism allows the system to detect waiting workgroups without complex external monitoring, enabling the scheduler to make informed decisions about which workgroups can be safely pre-empted.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system replaces complex mechanical monitoring mechanisms with software-based waiting atomic instructions. Instead of using complex hardware circuits to detect waiting workgroups, the invention uses software instructions that workgroups execute themselves, providing a simpler and more scalable solution for detecting waiting state while maintaining context switch flexibility.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentUS12131199B2Workgroup synchronization and processing
Publication Date: 2024.10.29 ADVANCED MICRO DEVICES INC
  • US12131199B2 patent drawing
  • US12131199B2 patent drawing
  • US12131199B2 patent drawing

AI summary

A processing system monitors and synchronizes parallel execution of workgroups (WGs). One or more of the WGs perform (e.g., periodically or in response to a trigger such as an indication of oversubscription) a waiting atomic instruction. In response to a comparison between an atomic value produced as a result of the waiting atomic instruction and an expected value, WGs that fail to produce a correct atomic value are identified as being in a waiting state (e.g., waiting for a synchronization variable). Execution of WGs in the waiting state is prevented (e.g., by a context switch) until corresponding synchronization variables are released.