Ctrl + k

or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/pyopencl@2025.2.x
tile.json

tessl/pypi-pyopencl

tessl install tessl/pypi-pyopencl@2025.2.0

Python wrapper for OpenCL enabling GPU and parallel computing with comprehensive array operations and mathematical functions

Agent Success

Agent success rate when using this tile

86%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.28x

Baseline

Agent success rate without this tile

67%

task.mdevals/scenario-7/

GPU Image Processing Pipeline with Graphics Interoperability

Build a GPU-accelerated image processing system that processes images rendered by OpenGL using parallel compute operations. The system should enable bidirectional data sharing between graphics rendering and compute processing.

Requirements

Image Processing Setup

Create a processing pipeline that:

  • Accepts an OpenGL buffer or texture containing image data
  • Applies a brightness adjustment operation on the GPU
  • Returns the processed result back to OpenGL for rendering
  • Handles synchronization between graphics and compute operations

Core Functionality

Implement a function process_gl_image(gl_buffer, brightness_factor) that:

  • Takes a shared graphics buffer handle and a brightness multiplier
  • Gains exclusive compute access to the buffer
  • Performs element-wise brightness scaling on all pixels
  • Releases the buffer back to graphics control
  • Returns successfully when processing is complete

The brightness adjustment should multiply each color channel by the brightness factor while preserving the alpha channel.

Synchronization Requirements

Ensure proper resource management:

  • Buffer must be locked for compute before processing
  • Buffer must be unlocked for graphics after processing
  • All compute operations must complete before releasing
  • Support for dependency tracking between operations

Test Cases

  • When processing a shared GL buffer with brightness factor 1.5, all RGB channels are multiplied by 1.5 while alpha remains unchanged @test
  • When attempting to access a GL buffer without proper acquisition, an error is raised @test
  • When multiple processing operations are queued, they execute in order without data races @test

Implementation

@generates

API

def process_gl_image(gl_buffer, brightness_factor: float, queue=None, context=None):
    """
    Process an OpenGL buffer using GPU compute operations.

    Args:
        gl_buffer: OpenGL buffer object handle to process
        brightness_factor: Multiplier for RGB channel brightness (float)
        queue: Optional compute command queue to use
        context: Optional compute context (must be GL-sharing enabled)

    Returns:
        None (modifies buffer in place)

    Raises:
        RuntimeError: If buffer cannot be acquired for compute access
        ValueError: If brightness_factor is negative
    """
    pass

Dependencies { .dependencies }

pyopencl { .dependency }

Provides GPU compute capabilities and OpenGL interoperability support for sharing graphics resources with compute operations.