Contents

setThreadgroupMemoryLength(_:index:)

Configures the size of a block of threadgroup memory.

Declaration

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

Parameters

  • length:

    The size of the threadgroup memory, in bytes, which needs to be a multiple of 16 bytes.

  • index:

    The index in the threadgroup memory argument table using this allocation.

Discussion

The threadgroup memory space allows for sharing data between multiple threads in a threadgroup, which can be faster than using device memory in your kernels. Before using any threadgroup memory, call this method to configure the threadgroup memory argument table. Kernels accessing their arguments from threadgroup memory have the [[threadgroup]] attribute.

To learn more about using the threadgroup address space, see the Metal Shading Language Specification section 4.4.

See Also

Configuring tile memory