setBuffer(_:offset:for:)
Sets the buffer and byte offset to use as backing storage for the given plane.
Declaration
func setBuffer(_ buffer: any MTLBuffer, offset: Int, for plane: MTLTensorPlaneType)Parameters
- buffer:
The buffer to back the plane.
- offset:
The byte offset into the buffer.
- plane:
The plane type to associate the buffer with.
Discussion
The offset needs to be aligned to 128 bytes if the plane uses MTLTensorDataType.int2, MTLTensorDataType.uint2, MTLTensorDataType.int4, MTLTensorDataType.uint4, MTLTensorDataType.metalFloat4e2m1, MTLTensorDataType.metalFloat8e4m3, MTLTensorDataType.metalFloat8e5m2, or MTLTensorDataType.metalFloat8ue8m0, otherwise it needs to be aligned to the size of the plane’s data type in bytes.