---
title: "setThreadgroupMemoryLength(_:offset:index:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtl4rendercommandencoder/setthreadgroupmemorylength(_:offset:index:)"
---

# setThreadgroupMemoryLength(_:offset:index:)

Configures the size of a threadgroup memory buffer for a threadgroup argument in the fragment and tile shader functions.

## Declaration

```swift
func setThreadgroupMemoryLength(_ length: Int, offset: Int, index: Int)
```

## Parameters

- `length`: The size of the threadgroup memory, in bytes.
- `offset`: An integer that represents the location, in bytes, from the start of the threadgroup memory buffer at index where the threadgroup memory begins.
- `index`: An integer that corresponds to the index of the argument you annotate with attribute [[threadgroup(index)]] in the shader function.

## See Also

### Configuring persistent threadgroup memory

- [setObjectThreadgroupMemoryLength(_:index:)](metal/mtl4rendercommandencoder/setobjectthreadgroupmemorylength(_:index:).md)
