Contents

AccessoryGPUWorker

A feature for GPU work that carries data between your data provider and transport extensions.

Declaration

struct AccessoryGPUWorker

Mentioned in

Overview

An accessory GPU worker exchanges information in the background like AccessoryWorker does, but runs under a more permissive sandbox profile that permits GPU access. Create an instance of this structure in the extensionPoint of your AccessoryDataProvider extension, and open sessions from your transport extension with makeFeatureSession(_:) in response to events from your accessory. Your app defines the data format, and the Accessory Transport Extension framework treats the data as opaque, with no additional encryption. Enroll the feature for each accessory with requestAuthorization(for:). For more information, see Sending data to an accessory in the background.

Perform GPU work in the background

To perform work that requires the GPU in the background, you can use Metal, Metal Performance Shaders, Core ML inference on the GPU or Neural Engine, and direct GPU memory access through Metal buffers (MTLBuffer).

Run a worker with scheduling and thermal limits

Use the GPU worker only when your accessory genuinely needs it. The system launches your GPU worker extension and keeps it running for as long as your accessory requires background GPU work for the accessory’s functionality. Because background work takes a lower priority than what’s running in the foreground, the system runs it at a background quality-of-service (QoS) level rather than real-time priority.

Build your extension to tolerate system pauses or session stops under thermal pressure so you can react to the unpredictable nature of background work.

Topics

Handling data-provider sessions

Handling transport-extension sessions

Checking authorization

Creating the feature

See Also

Background work