Instance Method

dispatchThreads(_:threadsPerThreadgroup:)

Encodes a compute command using an arbitrarily sized grid.

Required.

Declaration

func dispatchThreads(_ threadsPerGrid: MTLSize, threadsPerThreadgroup: MTLSize)

Parameters

threadsPerGrid

The number of threads in the grid, in each dimension.

threadsPerThreadgroup

The number of threads in one threadgroup, in each dimension.

Discussion

Use this method only if the device supports non-uniform threadgroup sizes. See Metal Feature Set Tables.

This method encodes a dispatch call that specifies an arbitrary number of threads in a grid (threadsPerGrid). Metal calculates the number of threadgroups needed, providing partial threadgroups if necessary.

When the compute command is encoded, any necessary references to parameters or resources previously set on the encoder are recorded as part of the command. After encoding a command, you can safely change the encoding state to set up parameters needed to encode other commands.

See Also

Executing a Compute Function Directly

func dispatchThreadgroups(MTLSize, threadsPerThreadgroup: MTLSize)

Encodes a compute command using a grid aligned to threadgroup boundaries.

Required.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software