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

# setThreadgroupMemoryLength(_:index:)

Configures the size of a threadgroup memory buffer for a threadgroup argument in the compute shader function.

## Declaration

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

## Parameters

- `length`: The size of the threadgroup memory, in bytes. Use a multiple of 16 bytes.
- `index`: An integer that corresponds to the index of the argument you annotate with attribute [[threadgroup(index)]] in the shader function.

## See Also

### Configuring the pass

- [setComputePipelineState(_:)](metal/mtl4computecommandencoder/setcomputepipelinestate(_:).md)
- [setArgumentTable(_:)](metal/mtl4computecommandencoder/setargumenttable(_:).md)
- [setImageblockSize(width:height:)](metal/mtl4computecommandencoder/setimageblocksize(width:height:).md)
