<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreAI",
  "identifier" : "/documentation/CoreAI/ComputeStream",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Core AI"
    ],
    "preciseIdentifier" : "s:13CoreAIRuntime13ComputeStreamC"
  },
  "title" : "ComputeStream"
}
-->

# ComputeStream

A stream of work to be run asynchronously.

```
final class ComputeStream
```

## Overview

A compute stream is what is provided to [`encode(inputs:states:outputViews:to:)`](/documentation/CoreAI/InferenceFunction/encode(inputs:states:outputViews:to:))
to encode the work onto the stream. Multiple inferences encoded to the same stream are serialized as needed
based on the the values read/written.

## Topics

### Creating a stream

[`init()`](/documentation/CoreAI/ComputeStream/init())

Initialize an empty compute stream.

[`init(commandQueue:)`](/documentation/CoreAI/ComputeStream/init(commandQueue:))

Initialize a compute stream which will encode its work to the provided command queue.

### Waiting for work to finish

[`currentWorkCompleted()`](/documentation/CoreAI/ComputeStream/currentWorkCompleted())

Waits for all previous work encoded to this stream to be complete.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)