GPU Kernel Out-of-Bound Access Prevention via Automated Boundary Checks

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current GPU programming techniques struggle to effectively detect and prevent out-of-bound array accesses, which are common sources of errors and security vulnerabilities, especially due to their complexity and the limited effectiveness of existing detection methods.

Innovation Solution

An automated method is introduced that modifies GPU kernel source code to include array size parameters and boundary checks, transforming the code into LLVM Intermediate Representation to transparently provide array sizes at runtime, preventing out-of-bound access through a polyglot virtual machine.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If static program analysis is used to detect out-of-bound accesses, then detection capability is provided, but the detection is limited and cannot modify code to offer protection

Engineering Contradiction:
Improvedetection capabilityVSAvoidprotection effectiveness
Core Design Contradiction:
Measurement precisionVSReliability

Solution Approach 1:

The system performs preliminary actions by automatically modifying GPU kernel source code to include boundary checks before execution. The compilation process inserts runtime checks that verify array indices against declared sizes, preventing out-of-bound accesses before they can cause errors or security vulnerabilities.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The invention introduces an intermediary compilation process that acts as a mediator between static analysis and runtime execution. This intermediary automatically transforms source code by adding boundary checking logic, bridging the gap between detection capability and actual protection without requiring manual intervention.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Object-affected harmful factors

If sandboxed environment is used to mitigate out-of-bound accesses, then security effects are reduced, but out-of-bound accesses still occur and can provide wrong results

Engineering Contradiction:
Improvesecurity vulnerability impactVSAvoidexecution correctness
Core Design Contradiction:
Object-affected harmful factorsVSReliability

Solution Approach 1:

The system applies preliminary anti-action by proactively preventing out-of-bound accesses through automatically inserted boundary checks in the compiled code. Rather than merely containing the effects of such accesses in a sandbox, the system actively blocks them before they can occur, ensuring both security and execution correctness.

Inventive Principle:
Principle #9Preliminary anti-action

3Measurement precision

If manual prevention and fixing of out-of-bound accesses is required, then detection capability is provided, but automation is not offered and user burden increases

Engineering Contradiction:
Improvedetection capabilityVSAvoiduser burden
Core Design Contradiction:
Measurement precisionVSEase of operation

Solution Approach 1:

The invention enables self-service by making the compilation process automatically modify GPU kernel source code to include boundary checks. The system serves itself by autonomously analyzing code, identifying potential out-of-bound accesses, and inserting appropriate protection logic without requiring manual intervention from developers.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system performs preliminary actions by automatically modifying GPU kernel source code to include boundary checks before execution. The compilation process inserts runtime checks that verify array indices against declared sizes, preventing out-of-bound accesses before they can cause errors or security vulnerabilities.

Inventive Principle:
Principle #10Preliminary action

4Device complexity

If existing code is not modified to include boundary checks, then code simplicity is maintained, but out-of-bound accesses cannot be prevented

Engineering Contradiction:
Improvecode simplicityVSAvoidaccess safety
Core Design Contradiction:
Device complexityVSReliability

Solution Approach 1:

The system performs preliminary actions by automatically modifying GPU kernel source code to include boundary checks before execution. The compilation process inserts runtime checks that verify array indices against declared sizes, preventing out-of-bound accesses before they can cause errors or security vulnerabilities.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The invention introduces an intermediary compilation process that acts as a mediator between source code and executable code. This intermediary automatically transforms source code by adding boundary checking logic, providing protection without requiring changes to the original program logic or increasing apparent code complexity for the user.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS11288108B2Automatic out-of-bound access prevention in GPU kernels executed in a managed environment
Publication Date: 2022.03.29 ORACLE INT CORP
  • US11288108B2 patent drawing
  • US11288108B2 patent drawing
  • US11288108B2 patent drawing

AI summary

Techniques are provided for an automated method of adding out-of-bound access prevention in GPU kernels executed in a managed environment. In an embodiment, a system of computers compiles a GPU kernel code function that includes one or more array references that are memory address dependent. The system of computers compiles the kernel code function by generating a rewritten GPU kernel code module that includes, within the function signature of the rewritten GPU kernel code module, a respective array size parameter for each array reference of the one or more array references included in the GPU kernel code function. The system of computers further compiles the kernel code function by adding bounding protection instructions to the one or more potential out-of-bound access instructions in the rewritten GPU kernel code module. The potential out-of-bound access instructions comprise instructions that reference each respective array size parameter of the one or more array references. Afterwards, the rewritten GPU kernel code module is loaded in a virtual machine. Loading the rewritten GPU kernel code module in the virtual machine comprises modifying a host application to automatically transmit, from the host application, one or more input array size values. The one or more input array size values is referenced by the one or more potential out-of-bound-access instructions.