Documentation
¶
Overview ¶
Package mpscore provides purego-based Go bindings for the macOS MPSCore framework.
Apple documentation: https://developer.apple.com/documentation/mpscore
Index ¶
- func BuiltinClz(arg uint) int
- func MPSDataTypeBitsCount(t MPSDataType) uint
- func MPSGetCustomKernelBatchedDestinationIndex(c MPSCustomKernelArgumentCount) uint
- func MPSGetCustomKernelBatchedSourceIndex(c MPSCustomKernelArgumentCount, sourceIndex uint, mpsMaxTextures uint) uint
- func MPSGetCustomKernelBroadcastSourceIndex(c MPSCustomKernelArgumentCount, sourceIndex uint, mpsMaxTextures uint) uint
- func MPSGetCustomKernelMaxBatchSize(c MPSCustomKernelArgumentCount, mpsMaxTextures uint) uint
- func MPSGetImageType(image *MPSImage) objc.ID
- func MPSImageBatchIncrementReadCount(batch unsafe.Pointer, amount int) uint
- func MPSImageBatchIterate(batch unsafe.Pointer, iteratorBlock func(*MPSImage, uint) int) int
- func MPSImageBatchResourceSize(batch unsafe.Pointer) uint
- func MPSImageBatchSynchronize(batch unsafe.Pointer, cmdBuf metal.MTLCommandBuffer)
- func MPSKeyedUnarchiverUnarchiveObjectWithDataDevice(data *foundation.NSData, device metal.MTLDevice) objc.ID
- func MPSKeyedUnarchiverUnarchiveObjectWithFileDevice(path *foundation.NSString, device metal.MTLDevice) objc.ID
- func MPSKeyedUnarchiverUnarchivedObjectOfClassFromDataDeviceError(cls objc.Class, data *foundation.NSData, device metal.MTLDevice) (objc.ID, error)
- func MPSKeyedUnarchiverUnarchivedObjectOfClassesFromDataDeviceError(classes *foundation.NSSet[objc.Class], data *foundation.NSData, ...) (objc.ID, error)
- func MPSMatrixDescriptorRowBytesForColumnsDataType(columns uint, dataType MPSDataType) uint
- func MPSMatrixDescriptorRowBytesFromColumnsDataType(columns uint, dataType MPSDataType) uint
- func MPSRectNoClip() metal.MTLRegion
- func MPSSizeofMPSDataType(t MPSDataType) uint
- func MPSStateBatchIncrementReadCount(batch unsafe.Pointer, amount int) uint
- func MPSStateBatchResourceSize(batch unsafe.Pointer) uint
- func MPSStateBatchSynchronize(batch unsafe.Pointer, cmdBuf metal.MTLCommandBuffer)
- func MPSTemporaryImagePrefetchStorageWithCommandBufferImageDescriptorList(commandBuffer metal.MTLCommandBuffer, ...)
- func MPSTemporaryMatrixPrefetchStorageWithCommandBufferMatrixDescriptorList(commandBuffer metal.MTLCommandBuffer, ...)
- func MPSTemporaryVectorPrefetchStorageWithCommandBufferDescriptorList(commandBuffer metal.MTLCommandBuffer, ...)
- func MPSVectorDescriptorVectorBytesForLengthDataType(length uint, dataType MPSDataType) uint
- func SymbolAvailable(symbol string) bool
- type Acl_entry_id_t
- type Acl_flag_t
- type Acl_perm_t
- type Acl_tag_t
- type Acl_type_t
- type Clockid_t
- type Dispatch_autorelease_frequency_t
- type Dispatch_block_flags_t
- type Filesec_property_t
- type Idtype_t
- type Ipc_info_object_type_t
- type Launch_data_type_t
- type MDLabelDomain
- type MDQueryOptionFlags
- type MDQuerySortOptionFlags
- type MPSAliasingStrategy
- type MPSCommandBuffer
- func (o *MPSCommandBuffer) CommandBuffer() metal.MTLCommandBuffer
- func (o *MPSCommandBuffer) CommitAndContinue()
- func (o *MPSCommandBuffer) HeapProvider() MPSHeapProvider
- func (o *MPSCommandBuffer) InitWithCommandBuffer(commandBuffer metal.MTLCommandBuffer) *MPSCommandBuffer
- func (o *MPSCommandBuffer) Predicate() *MPSPredicate
- func (o *MPSCommandBuffer) PrefetchHeapForWorkloadSize(size uint)
- func (o *MPSCommandBuffer) RootCommandBuffer() metal.MTLCommandBuffer
- func (o *MPSCommandBuffer) SetHeapProvider(heapProvider MPSHeapProvider)
- func (o *MPSCommandBuffer) SetPredicate(predicate *MPSPredicate)
- type MPSCustomKernelArgumentCount
- type MPSCustomKernelIndex
- type MPSCustomKernelInfo
- type MPSCustomKernelSourceInfo
- type MPSDataLayout
- type MPSDataType
- type MPSDeviceCapsValues
- type MPSDeviceProvider
- type MPSDimensionSlice
- type MPSFloatDataTypeBit
- type MPSFloatDataTypeShift
- type MPSHeapProvider
- type MPSImage
- func (o *MPSImage) BatchRepresentation() unsafe.Pointer
- func (o *MPSImage) BatchRepresentationWithSubRange(subRange foundation.NSRange) unsafe.Pointer
- func (o *MPSImage) Device() metal.MTLDevice
- func (o *MPSImage) FeatureChannelFormat() MPSImageFeatureChannelFormat
- func (o *MPSImage) FeatureChannels() uint
- func (o *MPSImage) Height() uint
- func (o *MPSImage) InitWithDeviceImageDescriptor(device metal.MTLDevice, imageDescriptor *MPSImageDescriptor) *MPSImage
- func (o *MPSImage) InitWithParentImageSliceRangeFeatureChannels(parent *MPSImage, sliceRange foundation.NSRange, featureChannels uint) *MPSImage
- func (o *MPSImage) InitWithTextureFeatureChannels(texture metal.MTLTexture, featureChannels uint) *MPSImage
- func (o *MPSImage) Label() *foundation.NSString
- func (o *MPSImage) NumberOfImages() uint
- func (o *MPSImage) Parent() *MPSImage
- func (o *MPSImage) PixelFormat() metal.MTLPixelFormat
- func (o *MPSImage) PixelSize() uint
- func (o *MPSImage) Precision() uint
- func (o *MPSImage) ReadBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, bytesPerRow uint, ...)
- func (o *MPSImage) ReadBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, bytesPerRow uint, ...)
- func (o *MPSImage) ReadBytesDataLayoutImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, imageIndex uint)
- func (o *MPSImage) ResourceSize() uint
- func (o *MPSImage) SetLabel(label *foundation.NSString)
- func (o *MPSImage) SetPurgeableState(state MPSPurgeableState) MPSPurgeableState
- func (o *MPSImage) SubImageWithFeatureChannelRange(range_ foundation.NSRange) *MPSImage
- func (o *MPSImage) SynchronizeOnCommandBuffer(commandBuffer metal.MTLCommandBuffer)
- func (o *MPSImage) Texture() metal.MTLTexture
- func (o *MPSImage) TextureType() metal.MTLTextureType
- func (o *MPSImage) Usage() metal.MTLTextureUsage
- func (o *MPSImage) Width() uint
- func (o *MPSImage) WriteBytesDataLayoutBytesPerColumnBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, bytesPerColumn uint, ...)
- func (o *MPSImage) WriteBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, bytesPerRow uint, ...)
- func (o *MPSImage) WriteBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, bytesPerRow uint, ...)
- func (o *MPSImage) WriteBytesDataLayoutImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, imageIndex uint)
- type MPSImageAllocator
- type MPSImageCoordinate
- type MPSImageDescriptor
- func MPSImageDescriptorFromID(id objc.ID) *MPSImageDescriptor
- func MPSImageDescriptorImageDescriptorWithChannelFormatWidthHeightFeatureChannels(channelFormat MPSImageFeatureChannelFormat, width uint, height uint, ...) *MPSImageDescriptor
- func MPSImageDescriptorImageDescriptorWithChannelFormatWidthHeightFeatureChannelsNumberOfImagesUsage(channelFormat MPSImageFeatureChannelFormat, width uint, height uint, ...) *MPSImageDescriptor
- func (o *MPSImageDescriptor) ChannelFormat() MPSImageFeatureChannelFormat
- func (o *MPSImageDescriptor) CpuCacheMode() metal.MTLCPUCacheMode
- func (o *MPSImageDescriptor) FeatureChannels() uint
- func (o *MPSImageDescriptor) Height() uint
- func (o *MPSImageDescriptor) NumberOfImages() uint
- func (o *MPSImageDescriptor) PixelFormat() metal.MTLPixelFormat
- func (o *MPSImageDescriptor) SetChannelFormat(channelFormat MPSImageFeatureChannelFormat)
- func (o *MPSImageDescriptor) SetCpuCacheMode(cpuCacheMode metal.MTLCPUCacheMode)
- func (o *MPSImageDescriptor) SetFeatureChannels(featureChannels uint)
- func (o *MPSImageDescriptor) SetHeight(height uint)
- func (o *MPSImageDescriptor) SetNumberOfImages(numberOfImages uint)
- func (o *MPSImageDescriptor) SetStorageMode(storageMode metal.MTLStorageMode)
- func (o *MPSImageDescriptor) SetUsage(usage metal.MTLTextureUsage)
- func (o *MPSImageDescriptor) SetWidth(width uint)
- func (o *MPSImageDescriptor) StorageMode() metal.MTLStorageMode
- func (o *MPSImageDescriptor) Usage() metal.MTLTextureUsage
- func (o *MPSImageDescriptor) Width() uint
- type MPSImageEdgeMode
- type MPSImageFeatureChannelFormat
- type MPSImageReadWriteParams
- type MPSImageRegion
- type MPSImageType
- type MPSIntegerDivisionParams
- type MPSKernel
- func (o *MPSKernel) CopyWithZoneDevice(zone unsafe.Pointer, device metal.MTLDevice) *MPSKernel
- func (o *MPSKernel) Device() metal.MTLDevice
- func (o *MPSKernel) InitWithCoder(aDecoder *foundation.NSCoder) *MPSKernel
- func (o *MPSKernel) InitWithCoderDevice(aDecoder *foundation.NSCoder, device metal.MTLDevice) *MPSKernel
- func (o *MPSKernel) InitWithDevice(device metal.MTLDevice) *MPSKernel
- func (o *MPSKernel) Label() *foundation.NSString
- func (o *MPSKernel) Options() MPSKernelOptions
- func (o *MPSKernel) SetLabel(label *foundation.NSString)
- func (o *MPSKernel) SetOptions(options MPSKernelOptions)
- type MPSKernelOptions
- type MPSKeyedUnarchiver
- func (o *MPSKeyedUnarchiver) InitForReadingFromDataDeviceError(data *foundation.NSData, device metal.MTLDevice) (*MPSKeyedUnarchiver, error)
- func (o *MPSKeyedUnarchiver) InitForReadingWithDataDevice(data *foundation.NSData, device metal.MTLDevice) *MPSKeyedUnarchiver
- func (o *MPSKeyedUnarchiver) InitWithDevice(device metal.MTLDevice) *MPSKeyedUnarchiver
- func (o *MPSKeyedUnarchiver) MpsMTLDevice() metal.MTLDevice
- type MPSMatrix
- func (o *MPSMatrix) Columns() uint
- func (o *MPSMatrix) Data() metal.MTLBuffer
- func (o *MPSMatrix) DataType() MPSDataType
- func (o *MPSMatrix) Device() metal.MTLDevice
- func (o *MPSMatrix) InitWithBufferDescriptor(buffer metal.MTLBuffer, descriptor *MPSMatrixDescriptor) *MPSMatrix
- func (o *MPSMatrix) InitWithBufferOffsetDescriptor(buffer metal.MTLBuffer, offset uint, descriptor *MPSMatrixDescriptor) *MPSMatrix
- func (o *MPSMatrix) InitWithDeviceDescriptor(device metal.MTLDevice, descriptor *MPSMatrixDescriptor) *MPSMatrix
- func (o *MPSMatrix) Matrices() uint
- func (o *MPSMatrix) MatrixBytes() uint
- func (o *MPSMatrix) Offset() uint
- func (o *MPSMatrix) ResourceSize() uint
- func (o *MPSMatrix) RowBytes() uint
- func (o *MPSMatrix) Rows() uint
- func (o *MPSMatrix) SynchronizeOnCommandBuffer(commandBuffer metal.MTLCommandBuffer)
- type MPSMatrixDescriptor
- func MPSMatrixDescriptorFromID(id objc.ID) *MPSMatrixDescriptor
- func MPSMatrixDescriptorMatrixDescriptorWithDimensionsColumnsRowBytesDataType(rows uint, columns uint, rowBytes uint, dataType MPSDataType) *MPSMatrixDescriptor
- func MPSMatrixDescriptorMatrixDescriptorWithRowsColumnsMatricesRowBytesMatrixBytesDataType(rows uint, columns uint, matrices uint, rowBytes uint, matrixBytes uint, ...) *MPSMatrixDescriptor
- func MPSMatrixDescriptorMatrixDescriptorWithRowsColumnsRowBytesDataType(rows uint, columns uint, rowBytes uint, dataType MPSDataType) *MPSMatrixDescriptor
- func (o *MPSMatrixDescriptor) Columns() uint
- func (o *MPSMatrixDescriptor) DataType() MPSDataType
- func (o *MPSMatrixDescriptor) Matrices() uint
- func (o *MPSMatrixDescriptor) MatrixBytes() uint
- func (o *MPSMatrixDescriptor) RowBytes() uint
- func (o *MPSMatrixDescriptor) Rows() uint
- func (o *MPSMatrixDescriptor) SetColumns(columns uint)
- func (o *MPSMatrixDescriptor) SetDataType(dataType MPSDataType)
- func (o *MPSMatrixDescriptor) SetRowBytes(rowBytes uint)
- func (o *MPSMatrixDescriptor) SetRows(rows uint)
- type MPSMatrixOffset
- type MPSNDArray
- func (o *MPSNDArray) ArrayViewWithCommandBufferDescriptorAliasing(cmdBuf metal.MTLCommandBuffer, descriptor *MPSNDArrayDescriptor, ...) *MPSNDArray
- func (o *MPSNDArray) ArrayViewWithDescriptor(descriptor *MPSNDArrayDescriptor) *MPSNDArray
- func (o *MPSNDArray) ArrayViewWithDimensionCountDimensionSizesStrides(numberOfDimensions uint, dimensionSizes *uint, dimStrides *uint) *MPSNDArray
- func (o *MPSNDArray) ArrayViewWithShapeStrides(shape unsafe.Pointer, strides unsafe.Pointer) *MPSNDArray
- func (o *MPSNDArray) DataType() MPSDataType
- func (o *MPSNDArray) DataTypeSize() uint
- func (o *MPSNDArray) Descriptor() *MPSNDArrayDescriptor
- func (o *MPSNDArray) Device() metal.MTLDevice
- func (o *MPSNDArray) ExportDataWithCommandBufferToBufferDestinationDataTypeOffsetRowStrides(cmdBuf metal.MTLCommandBuffer, buffer metal.MTLBuffer, ...)
- func (o *MPSNDArray) ExportDataWithCommandBufferToImagesOffset(cmdBuf metal.MTLCommandBuffer, images unsafe.Pointer, ...)
- func (o *MPSNDArray) ImportDataWithCommandBufferFromBufferSourceDataTypeOffsetRowStrides(cmdBuf metal.MTLCommandBuffer, buffer metal.MTLBuffer, ...)
- func (o *MPSNDArray) ImportDataWithCommandBufferFromImagesOffset(cmdBuf metal.MTLCommandBuffer, images unsafe.Pointer, ...)
- func (o *MPSNDArray) InitWithBufferOffsetDescriptor(buffer metal.MTLBuffer, offset uint, descriptor *MPSNDArrayDescriptor) *MPSNDArray
- func (o *MPSNDArray) InitWithDeviceDescriptor(device metal.MTLDevice, descriptor *MPSNDArrayDescriptor) *MPSNDArray
- func (o *MPSNDArray) InitWithDeviceScalar(device metal.MTLDevice, value float64) *MPSNDArray
- func (o *MPSNDArray) Label() *foundation.NSString
- func (o *MPSNDArray) LengthOfDimension(dimensionIndex uint) uint
- func (o *MPSNDArray) NumberOfDimensions() uint
- func (o *MPSNDArray) Parent() *MPSNDArray
- func (o *MPSNDArray) ReadBytesStrideBytes(buffer unsafe.Pointer, strideBytesPerDimension *int64)
- func (o *MPSNDArray) ResourceSize() uint
- func (o *MPSNDArray) SetLabel(label *foundation.NSString)
- func (o *MPSNDArray) SynchronizeOnCommandBuffer(commandBuffer metal.MTLCommandBuffer)
- func (o *MPSNDArray) UserBuffer() metal.MTLBuffer
- func (o *MPSNDArray) WriteBytesStrideBytes(buffer unsafe.Pointer, strideBytesPerDimension *int64)
- type MPSNDArrayAllocator
- type MPSNDArrayDescriptor
- func MPSNDArrayDescriptorDescriptorWithDataTypeDimensionCountDimensionSizes(dataType MPSDataType, numberOfDimensions uint, dimensionSizes *uint) *MPSNDArrayDescriptor
- func MPSNDArrayDescriptorDescriptorWithDataTypeShape(dataType MPSDataType, shape *foundation.NSArray[*foundation.NSNumber]) *MPSNDArrayDescriptor
- func MPSNDArrayDescriptorFromID(id objc.ID) *MPSNDArrayDescriptor
- func (o *MPSNDArrayDescriptor) DataType() MPSDataType
- func (o *MPSNDArrayDescriptor) DimensionOrder() unsafe.Pointer
- func (o *MPSNDArrayDescriptor) GetShape() *foundation.NSArray[*foundation.NSNumber]
- func (o *MPSNDArrayDescriptor) LengthOfDimension(dimensionIndex uint) uint
- func (o *MPSNDArrayDescriptor) NumberOfDimensions() uint
- func (o *MPSNDArrayDescriptor) PermuteWithDimensionOrder(dimensionOrder *uint)
- func (o *MPSNDArrayDescriptor) PreferPackedRows() bool
- func (o *MPSNDArrayDescriptor) ReshapeWithDimensionCountDimensionSizes(numberOfDimensions uint, dimensionSizes *uint)
- func (o *MPSNDArrayDescriptor) ReshapeWithShape(shape *foundation.NSArray[*foundation.NSNumber])
- func (o *MPSNDArrayDescriptor) SetDataType(dataType MPSDataType)
- func (o *MPSNDArrayDescriptor) SetNumberOfDimensions(numberOfDimensions uint)
- func (o *MPSNDArrayDescriptor) SetPreferPackedRows(preferPackedRows bool)
- func (o *MPSNDArrayDescriptor) SliceDimensionWithSubrange(dimensionIndex uint, subRange MPSDimensionSlice)
- func (o *MPSNDArrayDescriptor) SliceRangeForDimension(dimensionIndex uint) MPSDimensionSlice
- func (o *MPSNDArrayDescriptor) TransposeDimensionWithDimension(dimensionIndex uint, dimensionIndex2 uint)
- type MPSOffset
- type MPSOrigin
- type MPSPredicate
- type MPSPurgeableState
- type MPSRegion
- type MPSScaleTransform
- type MPSSize
- type MPSState
- func MPSStateFromID(id objc.ID) *MPSState
- func MPSStateTemporaryStateWithCommandBuffer(cmdBuf metal.MTLCommandBuffer) *MPSState
- func MPSStateTemporaryStateWithCommandBufferBufferSize(cmdBuf metal.MTLCommandBuffer, bufferSize uint) *MPSState
- func MPSStateTemporaryStateWithCommandBufferResourceList(commandBuffer metal.MTLCommandBuffer, resourceList *MPSStateResourceList) *MPSState
- func MPSStateTemporaryStateWithCommandBufferTextureDescriptor(cmdBuf metal.MTLCommandBuffer, descriptor *metal.MTLTextureDescriptor) *MPSState
- func (o *MPSState) BufferSizeAtIndex(index uint) uint
- func (o *MPSState) DestinationImageDescriptorForSourceImagesSourceStatesForKernelSuggestedDescriptor(sourceImages *foundation.NSArray[*MPSImage], ...) *MPSImageDescriptor
- func (o *MPSState) InitWithDeviceBufferSize(device metal.MTLDevice, bufferSize uint) *MPSState
- func (o *MPSState) InitWithDeviceResourceList(device metal.MTLDevice, resourceList *MPSStateResourceList) *MPSState
- func (o *MPSState) InitWithDeviceTextureDescriptor(device metal.MTLDevice, descriptor *metal.MTLTextureDescriptor) *MPSState
- func (o *MPSState) InitWithResource(resource metal.MTLResource) *MPSState
- func (o *MPSState) InitWithResources(resources *foundation.NSArray[metal.MTLResource]) *MPSState
- func (o *MPSState) IsTemporary() bool
- func (o *MPSState) Label() *foundation.NSString
- func (o *MPSState) ReadCount() uint
- func (o *MPSState) Resource() unsafe.Pointer
- func (o *MPSState) ResourceAtIndexAllocateMemory(index uint, allocateMemory bool) metal.MTLResource
- func (o *MPSState) ResourceCount() uint
- func (o *MPSState) ResourceSize() uint
- func (o *MPSState) ResourceTypeAtIndex(index uint) MPSStateResourceType
- func (o *MPSState) SetLabel(label *foundation.NSString)
- func (o *MPSState) SetReadCount(readCount uint)
- func (o *MPSState) SynchronizeOnCommandBuffer(commandBuffer metal.MTLCommandBuffer)
- func (o *MPSState) TextureInfoAtIndex(index uint) MPSStateTextureInfo
- type MPSStateResourceList
- type MPSStateResourceType
- type MPSStateTextureInfo
- type MPSTemporaryImage
- func MPSTemporaryImageFromID(id objc.ID) *MPSTemporaryImage
- func MPSTemporaryImageTemporaryImageWithCommandBufferImageDescriptor(commandBuffer metal.MTLCommandBuffer, imageDescriptor *MPSImageDescriptor) *MPSTemporaryImage
- func MPSTemporaryImageTemporaryImageWithCommandBufferTextureDescriptor(commandBuffer metal.MTLCommandBuffer, ...) *MPSTemporaryImage
- func MPSTemporaryImageTemporaryImageWithCommandBufferTextureDescriptorFeatureChannels(commandBuffer metal.MTLCommandBuffer, ...) *MPSTemporaryImage
- type MPSTemporaryMatrix
- type MPSTemporaryNDArray
- type MPSTemporaryVector
- type MPSVector
- func (o *MPSVector) Data() metal.MTLBuffer
- func (o *MPSVector) DataType() MPSDataType
- func (o *MPSVector) Device() metal.MTLDevice
- func (o *MPSVector) InitWithBufferDescriptor(buffer metal.MTLBuffer, descriptor *MPSVectorDescriptor) *MPSVector
- func (o *MPSVector) InitWithBufferOffsetDescriptor(buffer metal.MTLBuffer, offset uint, descriptor *MPSVectorDescriptor) *MPSVector
- func (o *MPSVector) InitWithDeviceDescriptor(device metal.MTLDevice, descriptor *MPSVectorDescriptor) *MPSVector
- func (o *MPSVector) Length() uint
- func (o *MPSVector) Offset() uint
- func (o *MPSVector) ResourceSize() uint
- func (o *MPSVector) SynchronizeOnCommandBuffer(commandBuffer metal.MTLCommandBuffer)
- func (o *MPSVector) VectorBytes() uint
- func (o *MPSVector) Vectors() uint
- type MPSVectorDescriptor
- func MPSVectorDescriptorFromID(id objc.ID) *MPSVectorDescriptor
- func MPSVectorDescriptorVectorDescriptorWithLengthDataType(length uint, dataType MPSDataType) *MPSVectorDescriptor
- func MPSVectorDescriptorVectorDescriptorWithLengthVectorsVectorBytesDataType(length uint, vectors uint, vectorBytes uint, dataType MPSDataType) *MPSVectorDescriptor
- func (o *MPSVectorDescriptor) DataType() MPSDataType
- func (o *MPSVectorDescriptor) Length() uint
- func (o *MPSVectorDescriptor) SetDataType(dataType MPSDataType)
- func (o *MPSVectorDescriptor) SetLength(length uint)
- func (o *MPSVectorDescriptor) VectorBytes() uint
- func (o *MPSVectorDescriptor) Vectors() uint
- type Mach_vm_range_flags_t
- type Mach_vm_range_flavor_t
- type Mach_vm_range_tag_t
- type Mpo_flags_t
- type Os_clockid_t
- type Ptrauth_key
- type Qos_class_t
- type Virtual_memory_guard_exception_code_t
- type Xpc_listener_create_flags_t
- type Xpc_session_create_flags_t
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MPSDataTypeBitsCount ¶
func MPSDataTypeBitsCount(t MPSDataType) uint
func MPSGetCustomKernelBatchedDestinationIndex ¶
func MPSGetCustomKernelBatchedDestinationIndex(c MPSCustomKernelArgumentCount) uint
@abstract The index of the first destination texture argument
func MPSGetCustomKernelBatchedSourceIndex ¶
func MPSGetCustomKernelBatchedSourceIndex(c MPSCustomKernelArgumentCount, sourceIndex uint, mpsMaxTextures uint) uint
@abstract The index of the ith batched source texture argument
func MPSGetCustomKernelBroadcastSourceIndex ¶
func MPSGetCustomKernelBroadcastSourceIndex(c MPSCustomKernelArgumentCount, sourceIndex uint, mpsMaxTextures uint) uint
@abstract The index of the ith non-batched source texture argument. @discussion A non-batched source is one that is shared for all items in a batch
func MPSGetCustomKernelMaxBatchSize ¶
func MPSGetCustomKernelMaxBatchSize(c MPSCustomKernelArgumentCount, mpsMaxTextures uint) uint
@abstract maximum allowed batch size
func MPSGetImageType ¶
func MPSImageBatchIncrementReadCount ¶
@abstract raise or lower the readcount of a batch by a set amount @discussion In some circumstances, a MPSImage may appear in a MPSImageBatch multiple times. This is particularly common when the MPSImage serves as an accumulator across the entire batch, such as when accumulating gradients for convolution weight update or batch statistics for batch normalization. A naive function would then end up incrementing the state multiple times, probably leading to an error. MPSImageBatchIncrementReadCount() will efficiently increment the readCounts of each object in the batch only once, avoiding this problem. Non-temporary images and images with readCount already 0 will be ignored. CAUTION: At many places in MPS, the framework assumes all images in the batch have the same characteristics, such as MPSImageFeatureChannelFormat. At times, for example, it is necessary to patch in a special version of the kernel to handle BFloat16 or another characteristic. When this happens, the kernel generally can't respond correctly when some images in a batch have that characteristic and some do not, because the special case handling code is hard compiled in. For this reason, all images in a batch should be constructed from the same list of descriptor parameters. @param batch The MPSImageBatch to increment @param amount The value to add to the read count for each unique image in the batch @return The number of different images in the batch
func MPSImageBatchIterate ¶
@abstract Iterate over unique images in the batch @discussion This function looks only at image address to determine uniqueness. The same texture stored in different MPSImages would be considered not unique. @param batch The image batch @param iteratorBlock Callback block to execute once for each unique image. Return a value greater than NSIntegerMin to terminate early. The index gives the first position in the batch where the image appears. Behavior is undefined if MPSImageBatchIterate is called recursively on the same images. @return The value returned by the iterator block for the last image on which it ran
func MPSImageBatchResourceSize ¶
@abstract Call [MTLBlitEncoder resourceSize] on unique resources and return sum
func MPSImageBatchSynchronize ¶
func MPSImageBatchSynchronize(batch unsafe.Pointer, cmdBuf metal.MTLCommandBuffer)
@abstract Call [MTLBlitEncoder synchronizeResource:] on unique resources
func MPSMatrixDescriptorRowBytesForColumnsDataType ¶
func MPSMatrixDescriptorRowBytesForColumnsDataType(columns uint, dataType MPSDataType) uint
func MPSMatrixDescriptorRowBytesFromColumnsDataType ¶
func MPSMatrixDescriptorRowBytesFromColumnsDataType(columns uint, dataType MPSDataType) uint
@abstract Return the recommended row stride, in bytes, for a given number of columns. @param columns The number of columns in the matrix for which the recommended row stride, in bytes, is to be determined. @param dataType The type of matrix data values. @discussion To achieve best performance the optimal stride between rows of a matrix is not necessarily equivalent to the number of columns. This method returns the row stride, in bytes, which gives best performance for a given number of columns. Using this row stride to construct your array is recommended, but not required (provided that the stride used is still large enough to allocate a full row of data).
func MPSRectNoClip ¶
@memberof MPSKernel @constant MPSRectNoClip @discussion This is a special constant to indicate no clipping is to be done. The entire image will be used. This is the default clipping rectangle or the input extent for MPSKernels.
func MPSSizeofMPSDataType ¶
func MPSSizeofMPSDataType(t MPSDataType) uint
func MPSStateBatchIncrementReadCount ¶
@abstract raise or lower the readcount of a batch by a set amount @discussion In some circumstances, a MPSState may appear in a MPSStateBatch multiple times. This is particularly common when the MPSState serves as an accumulator across the entire batch, such as when accumulating gradients for convolution weight update or batch statistics for batch normalization. A naive function would then end up incrementing the state multiple times, probably leading to an error. MPSStateBatchIncrementReadCount() will efficiently increment the readCounts of each object in the batch only once, avoiding this problem. @param batch The MPSStateBatch to increment @param amount The value to add to the read count for each unique state in the batch @return The number of different objects in the batch
func MPSStateBatchResourceSize ¶
@abstract Call [MTLBlitEncoder resourceSize] on unique resources
func MPSStateBatchSynchronize ¶
func MPSStateBatchSynchronize(batch unsafe.Pointer, cmdBuf metal.MTLCommandBuffer)
@abstract Call [MTLBlitEncoder synchronizeResource:] on unique resources
func MPSTemporaryImagePrefetchStorageWithCommandBufferImageDescriptorList ¶
func MPSTemporaryImagePrefetchStorageWithCommandBufferImageDescriptorList(commandBuffer metal.MTLCommandBuffer, descriptorList *foundation.NSArray[*MPSImageDescriptor])
@abstract Help MPS decide which allocations to make ahead of time @discussion The texture cache that underlies the MPSTemporaryImage can automatically allocate new storage as needed as you create new temporary images. However, sometimes a more global view of what you plan to make is useful for maximizing memory reuse to get the most efficient operation. This class method hints to the cache what the list of images will be. It is never necessary to call this method. It is purely a performance and memory optimization. This method makes a conservative estimate of memory required and may not fully cover temporary memory needs, resulting in additional allocations later that could encounter pathological behavior, if they are too small. If the full extent and timing of the workload is known in advance, it is recommended that MPSHintTemporaryMemoryHighWaterMark() be used instead. @param commandBuffer The command buffer on which the MPSTemporaryImages will be used @param descriptorList A NSArray of MPSImageDescriptors, indicating images that will be created
func MPSTemporaryMatrixPrefetchStorageWithCommandBufferMatrixDescriptorList ¶
func MPSTemporaryMatrixPrefetchStorageWithCommandBufferMatrixDescriptorList(commandBuffer metal.MTLCommandBuffer, descriptorList *foundation.NSArray[*MPSMatrixDescriptor])
@abstract Help MPS decide which allocations to make ahead of time @discussion The buffer cache that underlies the MPSTemporaryMatrix can automatically allocate new storage as needed as you create new temporary matrices. However, sometimes a more global view of what you plan to make is useful for maximizing memory reuse to get the most efficient operation. This class method hints to the cache what the list of matrices will be. It is never necessary to call this method. It is purely a performance and memory optimization. @param commandBuffer The command buffer on which the MPSTemporaryMatrix will be used @param descriptorList A NSArray of MPSMatrixDescriptor, indicating matrices that will be created
func MPSTemporaryVectorPrefetchStorageWithCommandBufferDescriptorList ¶
func MPSTemporaryVectorPrefetchStorageWithCommandBufferDescriptorList(commandBuffer metal.MTLCommandBuffer, descriptorList *foundation.NSArray[*MPSVectorDescriptor])
@abstract Help MPS decide which allocations to make ahead of time @discussion The buffer cache that underlies the MPSTemporaryVector can automatically allocate new storage as needed as you create new temporary vectors. However, sometimes a more global view of what you plan to make is useful for maximizing memory reuse to get the most efficient operation. This class method hints to the cache what the list of matrices will be. It is never necessary to call this method. It is purely a performance and memory optimization. @param commandBuffer The command buffer on which the MPSTemporaryVector will be used @param descriptorList A NSArray of MPSVectorDescriptor objects, indicating vectors that will be created
func MPSVectorDescriptorVectorBytesForLengthDataType ¶
func MPSVectorDescriptorVectorBytesForLengthDataType(length uint, dataType MPSDataType) uint
@abstract Return the recommended stride, in bytes, to be used for an array of vectors of a given length. @param length The number of elements in a single vector. @param dataType The type of vector data values. @discussion To achieve best performance the optimal stride between vectors within an array of vectors is not necessarily equivalent to the number of elements per vector. This method returns the stride, in bytes, which gives best performance for a given vector length. Using this stride to construct your array is recommended, but not required (provided that the stride used is still large enough to allocate a full vector of data).
func SymbolAvailable ¶
SymbolAvailable reports whether the named C symbol was bound when the library loaded. Calling a generated wrapper whose symbol is unavailable dereferences a nil function variable and panics.
Types ¶
type Acl_entry_id_t ¶
type Acl_entry_id_t int64
const ( ACL_FIRST_ENTRY Acl_entry_id_t = 0 ACL_NEXT_ENTRY Acl_entry_id_t = -1 ACL_LAST_ENTRY Acl_entry_id_t = -2 )
func (Acl_entry_id_t) String ¶
func (e Acl_entry_id_t) String() string
type Acl_flag_t ¶
type Acl_flag_t int64
const ( ACL_FLAG_DEFER_INHERIT Acl_flag_t = 1 ACL_FLAG_NO_INHERIT Acl_flag_t = 131072 ACL_ENTRY_INHERITED Acl_flag_t = 16 ACL_ENTRY_FILE_INHERIT Acl_flag_t = 32 ACL_ENTRY_DIRECTORY_INHERIT Acl_flag_t = 64 ACL_ENTRY_LIMIT_INHERIT Acl_flag_t = 128 ACL_ENTRY_ONLY_INHERIT Acl_flag_t = 256 )
func (Acl_flag_t) String ¶
func (e Acl_flag_t) String() string
type Acl_perm_t ¶
type Acl_perm_t int64
const ( ACL_READ_DATA Acl_perm_t = 2 ACL_LIST_DIRECTORY Acl_perm_t = 2 ACL_WRITE_DATA Acl_perm_t = 4 ACL_ADD_FILE Acl_perm_t = 4 ACL_EXECUTE Acl_perm_t = 8 ACL_SEARCH Acl_perm_t = 8 ACL_DELETE Acl_perm_t = 16 ACL_APPEND_DATA Acl_perm_t = 32 ACL_ADD_SUBDIRECTORY Acl_perm_t = 32 ACL_DELETE_CHILD Acl_perm_t = 64 ACL_READ_ATTRIBUTES Acl_perm_t = 128 ACL_WRITE_ATTRIBUTES Acl_perm_t = 256 ACL_READ_EXTATTRIBUTES Acl_perm_t = 512 ACL_WRITE_EXTATTRIBUTES Acl_perm_t = 1024 ACL_READ_SECURITY Acl_perm_t = 2048 ACL_WRITE_SECURITY Acl_perm_t = 4096 ACL_CHANGE_OWNER Acl_perm_t = 8192 ACL_SYNCHRONIZE Acl_perm_t = 1048576 )
func (Acl_perm_t) String ¶
func (e Acl_perm_t) String() string
type Acl_type_t ¶
type Acl_type_t int64
const ( ACL_TYPE_EXTENDED Acl_type_t = 256 ACL_TYPE_ACCESS Acl_type_t = 0 ACL_TYPE_DEFAULT Acl_type_t = 1 ACL_TYPE_AFS Acl_type_t = 2 ACL_TYPE_CODA Acl_type_t = 3 ACL_TYPE_NTFS Acl_type_t = 4 ACL_TYPE_NWFS Acl_type_t = 5 )
func (Acl_type_t) String ¶
func (e Acl_type_t) String() string
type Dispatch_autorelease_frequency_t ¶
type Dispatch_autorelease_frequency_t uint64
const ( DISPATCH_AUTORELEASE_FREQUENCY_INHERIT Dispatch_autorelease_frequency_t = 0 DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM Dispatch_autorelease_frequency_t = 1 DISPATCH_AUTORELEASE_FREQUENCY_NEVER Dispatch_autorelease_frequency_t = 2 )
func (Dispatch_autorelease_frequency_t) String ¶
func (e Dispatch_autorelease_frequency_t) String() string
type Dispatch_block_flags_t ¶
type Dispatch_block_flags_t uint64
const ( DISPATCH_BLOCK_BARRIER Dispatch_block_flags_t = 1 DISPATCH_BLOCK_DETACHED Dispatch_block_flags_t = 2 DISPATCH_BLOCK_ASSIGN_CURRENT Dispatch_block_flags_t = 4 DISPATCH_BLOCK_NO_QOS_CLASS Dispatch_block_flags_t = 8 DISPATCH_BLOCK_INHERIT_QOS_CLASS Dispatch_block_flags_t = 16 DISPATCH_BLOCK_ENFORCE_QOS_CLASS Dispatch_block_flags_t = 32 )
func (Dispatch_block_flags_t) String ¶
func (e Dispatch_block_flags_t) String() string
type Filesec_property_t ¶
type Filesec_property_t int64
const ( FILESEC_OWNER Filesec_property_t = 1 FILESEC_GROUP Filesec_property_t = 2 FILESEC_UUID Filesec_property_t = 3 FILESEC_MODE Filesec_property_t = 4 FILESEC_ACL Filesec_property_t = 5 FILESEC_GRPUUID Filesec_property_t = 6 FILESEC_ACL_RAW Filesec_property_t = 100 FILESEC_ACL_ALLOCSIZE Filesec_property_t = 101 )
func (Filesec_property_t) String ¶
func (e Filesec_property_t) String() string
type Ipc_info_object_type_t ¶
type Ipc_info_object_type_t int64
const ( IPC_OTYPE_NONE Ipc_info_object_type_t = 0 IPC_OTYPE_THREAD_CONTROL Ipc_info_object_type_t = 1 IPC_OTYPE_TASK_CONTROL Ipc_info_object_type_t = 2 IPC_OTYPE_HOST Ipc_info_object_type_t = 3 IPC_OTYPE_HOST_PRIV Ipc_info_object_type_t = 4 IPC_OTYPE_PROCESSOR Ipc_info_object_type_t = 5 IPC_OTYPE_PROCESSOR_SET Ipc_info_object_type_t = 6 IPC_OTYPE_PROCESSOR_SET_NAME Ipc_info_object_type_t = 7 IPC_OTYPE_TIMER Ipc_info_object_type_t = 8 IPC_OTYPE_PORT_SUBST_ONCE Ipc_info_object_type_t = 9 IPC_OTYPE_MIG Ipc_info_object_type_t = 10 IPC_OTYPE_MEMORY_OBJECT Ipc_info_object_type_t = 11 IPC_OTYPE_XMM_PAGER Ipc_info_object_type_t = 12 IPC_OTYPE_XMM_KERNEL Ipc_info_object_type_t = 13 IPC_OTYPE_XMM_REPLY Ipc_info_object_type_t = 14 IPC_OTYPE_UND_REPLY Ipc_info_object_type_t = 15 IPC_OTYPE_HOST_NOTIFY Ipc_info_object_type_t = 16 IPC_OTYPE_HOST_SECURITY Ipc_info_object_type_t = 17 IPC_OTYPE_LEDGER Ipc_info_object_type_t = 18 IPC_OTYPE_MAIN_DEVICE Ipc_info_object_type_t = 19 IPC_OTYPE_TASK_NAME Ipc_info_object_type_t = 20 IPC_OTYPE_SUBSYSTEM Ipc_info_object_type_t = 21 IPC_OTYPE_IO_DONE_QUEUE Ipc_info_object_type_t = 22 IPC_OTYPE_SEMAPHORE Ipc_info_object_type_t = 23 IPC_OTYPE_LOCK_SET Ipc_info_object_type_t = 24 IPC_OTYPE_CLOCK Ipc_info_object_type_t = 25 IPC_OTYPE_CLOCK_CTRL Ipc_info_object_type_t = 26 IPC_OTYPE_IOKIT_IDENT Ipc_info_object_type_t = 27 IPC_OTYPE_NAMED_ENTRY Ipc_info_object_type_t = 28 IPC_OTYPE_IOKIT_CONNECT Ipc_info_object_type_t = 29 IPC_OTYPE_IOKIT_OBJECT Ipc_info_object_type_t = 30 IPC_OTYPE_UPL Ipc_info_object_type_t = 31 IPC_OTYPE_MEM_OBJ_CONTROL Ipc_info_object_type_t = 32 IPC_OTYPE_AU_SESSIONPORT Ipc_info_object_type_t = 33 IPC_OTYPE_FILEPORT Ipc_info_object_type_t = 34 IPC_OTYPE_LABELH Ipc_info_object_type_t = 35 IPC_OTYPE_TASK_RESUME Ipc_info_object_type_t = 36 IPC_OTYPE_VOUCHER Ipc_info_object_type_t = 37 IPC_OTYPE_VOUCHER_ATTR_CONTROL Ipc_info_object_type_t = 38 IPC_OTYPE_WORK_INTERVAL Ipc_info_object_type_t = 39 IPC_OTYPE_UX_HANDLER Ipc_info_object_type_t = 40 IPC_OTYPE_UEXT_OBJECT Ipc_info_object_type_t = 41 IPC_OTYPE_ARCADE_REG Ipc_info_object_type_t = 42 IPC_OTYPE_EVENTLINK Ipc_info_object_type_t = 43 IPC_OTYPE_TASK_INSPECT Ipc_info_object_type_t = 44 IPC_OTYPE_TASK_READ Ipc_info_object_type_t = 45 IPC_OTYPE_THREAD_INSPECT Ipc_info_object_type_t = 46 IPC_OTYPE_THREAD_READ Ipc_info_object_type_t = 47 IPC_OTYPE_SUID_CRED Ipc_info_object_type_t = 48 IPC_OTYPE_HYPERVISOR Ipc_info_object_type_t = 49 IPC_OTYPE_TASK_ID_TOKEN Ipc_info_object_type_t = 50 IPC_OTYPE_TASK_FATAL Ipc_info_object_type_t = 51 IPC_OTYPE_KCDATA Ipc_info_object_type_t = 52 IPC_OTYPE_EXCLAVES_RESOURCE Ipc_info_object_type_t = 53 IPC_OTYPE_THREAD_RESUME Ipc_info_object_type_t = 54 IPC_OTYPE_UNKNOWN Ipc_info_object_type_t = 4294967295 )
func (Ipc_info_object_type_t) String ¶
func (e Ipc_info_object_type_t) String() string
type Launch_data_type_t ¶
type Launch_data_type_t int64
const ( LAUNCH_DATA_DICTIONARY Launch_data_type_t = 1 LAUNCH_DATA_ARRAY Launch_data_type_t = 2 LAUNCH_DATA_FD Launch_data_type_t = 3 LAUNCH_DATA_INTEGER Launch_data_type_t = 4 LAUNCH_DATA_REAL Launch_data_type_t = 5 LAUNCH_DATA_BOOL Launch_data_type_t = 6 LAUNCH_DATA_STRING Launch_data_type_t = 7 LAUNCH_DATA_OPAQUE Launch_data_type_t = 8 LAUNCH_DATA_ERRNO Launch_data_type_t = 9 LAUNCH_DATA_MACHPORT Launch_data_type_t = 10 )
func (Launch_data_type_t) String ¶
func (e Launch_data_type_t) String() string
type MDLabelDomain ¶
type MDLabelDomain int64
@typedef MDLabelDomain @abstract These constants are used to specify a domain to MDLabelCreate().
const ( KMDLabelUserDomain MDLabelDomain = 0 KMDLabelLocalDomain MDLabelDomain = 1 )
func (MDLabelDomain) String ¶
func (e MDLabelDomain) String() string
type MDQueryOptionFlags ¶
type MDQueryOptionFlags int64
const ( KMDQuerySynchronous MDQueryOptionFlags = 1 KMDQueryWantsUpdates MDQueryOptionFlags = 4 KMDQueryAllowFSTranslation MDQueryOptionFlags = 8 )
func (MDQueryOptionFlags) String ¶
func (e MDQueryOptionFlags) String() string
type MDQuerySortOptionFlags ¶
type MDQuerySortOptionFlags int64
@enum MDQuerySortOptionFlags @constant kMDQueryReverseSortOrderFlag Sort the attribute in reverse order.
const (
KMDQueryReverseSortOrderFlag MDQuerySortOptionFlags = 1
)
func (MDQuerySortOptionFlags) String ¶
func (e MDQuerySortOptionFlags) String() string
type MPSAliasingStrategy ¶
type MPSAliasingStrategy uint64
const ( MPSAliasingStrategyDefault MPSAliasingStrategy = 0 MPSAliasingStrategyDontCare MPSAliasingStrategy = 0 MPSAliasingStrategyShallAlias MPSAliasingStrategy = 1 MPSAliasingStrategyShallNotAlias MPSAliasingStrategy = 2 MPSAliasingStrategyAliasingReserved MPSAliasingStrategy = 3 MPSAliasingStrategyPreferTemporaryMemory MPSAliasingStrategy = 4 MPSAliasingStrategyPreferNonTemporaryMemory MPSAliasingStrategy = 8 )
func (MPSAliasingStrategy) String ¶
func (e MPSAliasingStrategy) String() string
type MPSCommandBuffer ¶
type MPSCommandBuffer struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpscommandbuffer
func MPSCommandBufferCommandBufferFromCommandQueue ¶
func MPSCommandBufferCommandBufferFromCommandQueue(commandQueue metal.MTLCommandQueue) *MPSCommandBuffer
@abstract Initializes a MPSCommandBuffer object from a given command queue. @result A pointer to the newly initialized MPSCommandBuffer object.
func MPSCommandBufferCommandBufferWithCommandBuffer ¶
func MPSCommandBufferCommandBufferWithCommandBuffer(commandBuffer metal.MTLCommandBuffer) *MPSCommandBuffer
@abstract Initializes a MPSCommandBuffer object with given MTLCommandBuffer. Once we create this MPSCommandBuffer, any methods utilizing it could call commitAndContinue and so the users original commandBuffer may have been committed. Please use the rootCommandBuffer method to get the current alive underlying MTLCommandBuffer. @result A pointer to the newly initialized MPSCommandBuffer object.
func MPSCommandBufferFromID ¶
func MPSCommandBufferFromID(id objc.ID) *MPSCommandBuffer
func (*MPSCommandBuffer) CommandBuffer ¶
func (o *MPSCommandBuffer) CommandBuffer() metal.MTLCommandBuffer
@property commandBuffer @abstract The Metal Command Buffer that was used to initialize this object.
func (*MPSCommandBuffer) CommitAndContinue ¶
func (o *MPSCommandBuffer) CommitAndContinue()
@abstract Commit work encoded so far and continue with a new underlying command buffer @discussion This method commits the underlying root MTLCommandBuffer, and makes a new one on the same command queue. The MPS heap is moved forward to the new command buffer such that temporary objects used by the previous command buffer can be still be used with the new one. This provides a way to move work already encoded into consideration by the Metal back end sooner. For large workloads, e.g. a neural networking graph periodically calling -commitAndContinue may allow you to improve CPU / GPU parallelism without the substantial memory increases associated with double buffering. It will also help decrease overall latency. Any Metal schedule or completion callbacks previously attached to this object will remain attached to the old command buffer and will fire as expected as the old command buffer is scheduled and completes. If your application is relying on such callbacks to coordinate retain / release of important objects that are needed for work encoded after -commitAndContinue, your application should retain these objects before calling commitAndContinue, and attach new release callbacks to this object with a new completion handler so that they persist through the lifetime of the new underlying command buffer. You may do this, for example by adding the objects to a mutable array before calling -commitAndContinue, then release the mutable array in a new completion callback added after -commitAndContinue. Because -commitAndContinue commits the old command buffer then switches to a new one, some aspects of command buffer completion may surprise unwary developers. For example, -waitUntilCompleted called immediately after -commitAndContinue asks Metal to wait for the new command buffer to finish, not the old one. Since the new command buffer presumably hasn't been committed yet, it is formally a deadlock, resources may leak and Metal may complain. Your application should ether call -commit before -waitUntilCompleted, or capture the -rootCommandBuffer from before the call to -commitAndContinue and wait on that. Similarly, your application should be sure to use the appropriate command buffer when querying the [MTLCommandBuffer status] property. If the underlying MTLCommandBuffer also implements -commitAndContinue, then the message will be forwarded to that object instead. In this way, underlying predicate objects and other state will be preserved.
func (*MPSCommandBuffer) HeapProvider ¶
func (o *MPSCommandBuffer) HeapProvider() MPSHeapProvider
@property heapProvider @abstract A application supplied object to allocate MTLHeaps for MPS @discussion By default this is nil, which will use MPS' device level global heap cache to allocate the heaps. This is a reasonable choice. However, it may be inefficient if you are keeping your own MTLHeap, since there will be two pessimistically sized free stores which may be larger than is strictly necessary, and of course fragmentation across multiple heaps. In such cases, the problem may be solved either by using MPS' automatically managed heap (simple) or having MPS use your heap. The heapProvider allows you to implement the second case. To use the MPS heap, simply make temporary MPSImages, vectors and matrices. If multiple MPSCommandBuffers reference the same MTLCommandBuffer, changing the heapProvider on one will change the heap provider for all of them.
func (*MPSCommandBuffer) InitWithCommandBuffer ¶
func (o *MPSCommandBuffer) InitWithCommandBuffer(commandBuffer metal.MTLCommandBuffer) *MPSCommandBuffer
@abstract Initializes an empty MPSCommandBuffer object with given MTLCommandBuffer. Once we create this MPSCommandBuffer, any methods utilizing it could call commitAndContinue and so the users original commandBuffer may have been committed. Please use the rootCommandBuffer method to get the current alive underlying MTLCommandBuffer. @result A pointer to the newly initialized MPSCommandBuffer object.
func (*MPSCommandBuffer) Predicate ¶
func (o *MPSCommandBuffer) Predicate() *MPSPredicate
@property predicate @abstract A GPU predicate object. Default: nil.
func (*MPSCommandBuffer) PrefetchHeapForWorkloadSize ¶
func (o *MPSCommandBuffer) PrefetchHeapForWorkloadSize(size uint)
@abstract Prefetch heap into the MPS command buffer heap cache. @discussion If there is not sufficient free storage in the MPS heap for the command buffer for allocations of total size size, pre-warm the MPS heap with a new MTLHeap allocation of sufficient size. If this size turns out to be too small MPS may ask for more heaps later to cover additional allocations. If heapProvider is not nil, the heapProvider will be used. @param size The minimum size of the free store needed
func (*MPSCommandBuffer) RootCommandBuffer ¶
func (o *MPSCommandBuffer) RootCommandBuffer() metal.MTLCommandBuffer
@property rootCommandBuffer @abstract The base MTLCommandBuffer underlying the MPSCommandBuffer @discussion MPSCommandBuffers may wrap other MPSCommandBuffers, in the process creating what is in effect a stack of predicate objects that may be pushed or popped by making new MPSCommandBuffers or by calling -commandBuffer. In some circumstances, it is preferable to use the root command buffer, particularly when trying to identify the command buffer that will be commited by -commitAndContinue.
func (*MPSCommandBuffer) SetHeapProvider ¶
func (o *MPSCommandBuffer) SetHeapProvider(heapProvider MPSHeapProvider)
func (*MPSCommandBuffer) SetPredicate ¶
func (o *MPSCommandBuffer) SetPredicate(predicate *MPSPredicate)
type MPSCustomKernelIndex ¶
type MPSCustomKernelIndex int64
const ( MPSCustomKernelIndexDestIndex MPSCustomKernelIndex = 0 MPSCustomKernelIndexSrc0Index MPSCustomKernelIndex = 0 MPSCustomKernelIndexSrc1Index MPSCustomKernelIndex = 1 MPSCustomKernelIndexSrc2Index MPSCustomKernelIndex = 2 MPSCustomKernelIndexSrc3Index MPSCustomKernelIndex = 3 MPSCustomKernelIndexSrc4Index MPSCustomKernelIndex = 4 MPSCustomKernelIndexUserDataIndex MPSCustomKernelIndex = 30 )
func (MPSCustomKernelIndex) String ¶
func (e MPSCustomKernelIndex) String() string
type MPSCustomKernelInfo ¶
type MPSDataLayout ¶
type MPSDataLayout uint64
const ( MPSDataLayoutHeightxWidthxFeatureChannels MPSDataLayout = 0 MPSDataLayoutFeatureChannelsxHeightxWidth MPSDataLayout = 1 )
func (MPSDataLayout) String ¶
func (e MPSDataLayout) String() string
type MPSDataType ¶
type MPSDataType int64
const ( MPSDataTypeInvalid MPSDataType = 0 MPSDataTypeFloatBit MPSDataType = 268435456 MPSDataTypeFloat32 MPSDataType = 268435488 MPSDataTypeFloat16 MPSDataType = 268435472 MPSDataTypeComplexBit MPSDataType = 16777216 MPSDataTypeComplexFloat32 MPSDataType = 285212736 MPSDataTypeComplexFloat16 MPSDataType = 285212704 MPSDataTypeSignedBit MPSDataType = 536870912 MPSDataTypeIntBit MPSDataType = 536870912 MPSDataTypeInt2 MPSDataType = 536870914 MPSDataTypeInt4 MPSDataType = 536870916 MPSDataTypeInt8 MPSDataType = 536870920 MPSDataTypeInt16 MPSDataType = 536870928 MPSDataTypeInt32 MPSDataType = 536870944 MPSDataTypeInt64 MPSDataType = 536870976 MPSDataTypeUInt2 MPSDataType = 2 MPSDataTypeUInt4 MPSDataType = 4 MPSDataTypeUInt8 MPSDataType = 8 MPSDataTypeUInt16 MPSDataType = 16 MPSDataTypeUInt32 MPSDataType = 32 MPSDataTypeUInt64 MPSDataType = 64 MPSDataTypeAlternateEncodingBit MPSDataType = 2147483648 MPSDataTypeBool MPSDataType = 2147483656 MPSDataTypeBFloat16 MPSDataType = 2415919120 MPSDataTypeComplexBFloat16 MPSDataType = 2432696352 MPSDataTypeNormalizedBit MPSDataType = 1073741824 MPSDataTypeUnorm1 MPSDataType = 1073741825 MPSDataTypeUnorm8 MPSDataType = 1073741832 )
func (MPSDataType) String ¶
func (e MPSDataType) String() string
type MPSDeviceCapsValues ¶
type MPSDeviceCapsValues int64
const ( MPSDeviceCapsNull MPSDeviceCapsValues = 0 MPSDeviceSupportsReadableArrayOfTextures MPSDeviceCapsValues = 1 MPSDeviceSupportsWritableArrayOfTextures MPSDeviceCapsValues = 2 MPSDeviceSupportsReadWriteTextures MPSDeviceCapsValues = 4 MPSDeviceSupportsSimdgroupBarrier MPSDeviceCapsValues = 8 MPSDeviceSupportsQuadShuffle MPSDeviceCapsValues = 16 MPSDeviceSupportsSimdShuffle MPSDeviceCapsValues = 32 MPSDeviceSupportsSimdReduction MPSDeviceCapsValues = 64 MPSDeviceSupportsFloat32Filtering MPSDeviceCapsValues = 128 MPSDeviceSupportsNorm16BicubicFiltering MPSDeviceCapsValues = 256 MPSDeviceSupportsFloat16BicubicFiltering MPSDeviceCapsValues = 512 MPSDeviceIsAppleDevice MPSDeviceCapsValues = 1024 MPSDeviceSupportsSimdShuffleAndFill MPSDeviceCapsValues = 2048 MPSDeviceSupportsBFloat16Arithmetic MPSDeviceCapsValues = 4096 MPSDeviceCapsLast MPSDeviceCapsValues = 8192 )
func (MPSDeviceCapsValues) String ¶
func (e MPSDeviceCapsValues) String() string
type MPSDeviceProvider ¶
MPSDeviceProvider wraps the ObjC protocol MPSDeviceProvider.
type MPSDimensionSlice ¶
@struct MPSDimensionSize @memberof MPSNDArray @abstract Describes a sub-region of an array dimension
type MPSFloatDataTypeBit ¶
type MPSFloatDataTypeBit int64
const ( MPSFloatDataTypeSignBit MPSFloatDataTypeBit = 8388608 MPSFloatDataTypeExponentBit MPSFloatDataTypeBit = 8126464 MPSFloatDataTypeMantissaBit MPSFloatDataTypeBit = 261120 )
func (MPSFloatDataTypeBit) String ¶
func (e MPSFloatDataTypeBit) String() string
type MPSFloatDataTypeShift ¶
type MPSFloatDataTypeShift int64
const ( MPSFloatDataTypeSignShift MPSFloatDataTypeShift = 23 MPSFloatDataTypeExponentShift MPSFloatDataTypeShift = 18 MPSFloatDataTypeMantissaShift MPSFloatDataTypeShift = 10 )
func (MPSFloatDataTypeShift) String ¶
func (e MPSFloatDataTypeShift) String() string
type MPSHeapProvider ¶
type MPSHeapProvider interface {
NewHeapWithDescriptor(descriptor *metal.MTLHeapDescriptor) metal.MTLHeap
}
MPSHeapProvider wraps the ObjC protocol MPSHeapProvider.
type MPSImage ¶
type MPSImage struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpsimage
func MPSImageFromID ¶
func (*MPSImage) BatchRepresentation ¶
@abstract Make a MPSImageBatch that points to the individual images in the MPSImage @discussion If the original is a temporary image, the result will be a temporary image. It will hold 1 readCount on the original. When the readCount drops to 0, it will decrement the appropriate counter on the parent. @return A MPSImageBatch aliasing the texel storage in the original batch image
func (*MPSImage) BatchRepresentationWithSubRange ¶
func (o *MPSImage) BatchRepresentationWithSubRange(subRange foundation.NSRange) unsafe.Pointer
@abstract Make a representation of a MPSImage (batch) as a MPSImageBatch @discussion Before the MPSImageBatch was introduced, several images could be concatenated into a MPSImage as multiple image slices in a MTLTexture2DArray to make a image batch. If the image contained more than 4 feature channels, then each image would have round_up( feature channels / 4) slices and the total number of slices in the MPSImage would be slices * number of images. Because many devices can operate on texture arrays of no more than 2048 slices, storage in this format is limited. For example in InceptionV3, 2048 feature channels at its widest point, the largest batch size that can be processed in this way is 4, well under commonly accepted practice for training. Consequently, the older batching style is deprecated and the MPSImageBatch is introduced. It is also easier to manage sub-batches and to concatenate sub-batches for memory management with the MPSImageBatch, so this format is favored going forward. To facilitate forward migration, this method will prepare an array of MPSImages that each point to the appropriate set of slices in storage for the original image. Since they share storage, writes to the parent will alter the content of the children, and vice versa. If the original is a temporary image, the result will be a temporary image. It will hold 1 readCount on the original. When the readCount drops to 0, it will decrement the appropriate counter on the parent. This is a much cheaper form of the slice operator, and should be used instead when the slice operator does not need to operate out of place. @param subRange The range of images in the original image from which the batch will be derived. @return A MPSImageBatch referencing a subregion of the original batch image.
func (*MPSImage) FeatureChannelFormat ¶
func (o *MPSImage) FeatureChannelFormat() MPSImageFeatureChannelFormat
@property featureChannelFormat @abstract The true encoding of the feature channels
func (*MPSImage) FeatureChannels ¶
@property featureChannels @abstract The number of feature channels per pixel.
func (*MPSImage) InitWithDeviceImageDescriptor ¶
func (o *MPSImage) InitWithDeviceImageDescriptor(device metal.MTLDevice, imageDescriptor *MPSImageDescriptor) *MPSImage
@abstract Initialize an empty image object @param device The device that the image will be used. May not be NULL. @param imageDescriptor The MPSImageDescriptor. May not be NULL. @return A valid MPSImage object or nil, if failure. @discussion Storage to store data needed is allocated lazily on first use of MPSImage or when application calls MPSImage.texture
func (*MPSImage) InitWithParentImageSliceRangeFeatureChannels ¶
func (o *MPSImage) InitWithParentImageSliceRangeFeatureChannels(parent *MPSImage, sliceRange foundation.NSRange, featureChannels uint) *MPSImage
@abstract Use -batchRepresentation or -subImageWithFeatureChannelRange instead @discussion Generally, you should call -batchRepresentation or -subImageWithFeatureChannelRange instead because they are safer. This is provided so that these interfaces will work with your MPSImage subclass. @param parent The parent image that owns the texture. It may be a sub-image. @param sliceRange The range of MTLTexture2dArray slices to be included in the sub-image @param featureChannels The number of feature channels in the new image. The number of images is inferred. @return A MPSImage that references a subregion of the texel storage in parent instead of using its own storage.
func (*MPSImage) InitWithTextureFeatureChannels ¶
func (o *MPSImage) InitWithTextureFeatureChannels(texture metal.MTLTexture, featureChannels uint) *MPSImage
@abstract Initialize an MPSImage object using Metal texture. Metal texture has been created by user for specific number of feature channels and number of images. @param texture The MTLTexture allocated by the user to be used as backing for MPSImage. @param featureChannels Number of feature channels this texture contains. @return A valid MPSImage object or nil, if failure. @discussion Application can let MPS framework allocate texture with properties specified in imageDescriptor using initWithDevice:MPSImageDescriptor API above. However in memory intensive application, you can save memory (and allocation/deallocation time) by using MPSTemporaryImage where MPS framework aggressively reuse memory underlying textures on same command buffer. See MPSTemporaryImage class for details below. However, in certain cases, application developer may want more control on allocation, placement, reusing/recycling of memory backing textures used in application using Metal Heaps API. In this case, application can create MPSImage from pre-allocated texture using initWithTexture:featureChannels. MTLTextureType of texture can be MTLTextureType2D ONLY if featureChannels <= 4 in which case MPSImage.numberOfImages is set to 1. Else it should be MTLTextureType2DArray with arrayLength == numberOfImage * ((featureChannels + 3)/4). MPSImage.numberOfImages is set to texture.arrayLength / ((featureChannels + 3)/4). For MTLTextures containing typical image data which application may obtain from MetalKit or other libraries such as that drawn from a JPEG or PNG, featureChannels should be set to number of valid color channel e.g. for RGB data, even thought MTLPixelFormat will be MTLPixelFormatRGBA, featureChannels should be set to 3.
func (*MPSImage) Label ¶
func (o *MPSImage) Label() *foundation.NSString
@property label @abstract A string to help identify this object.
func (*MPSImage) NumberOfImages ¶
@property numberOfImages @abstract numberOfImages for batch processing
func (*MPSImage) Parent ¶
@abstract The MPSImage from which this MPSImage was derived. Otherwise nil. @discussion This will point to the original image if this image was created using -batchRepresentation, -batchRepresentationWithRange: or -subImageWithFeatureChannelRange:.
func (*MPSImage) PixelFormat ¶
func (o *MPSImage) PixelFormat() metal.MTLPixelFormat
@property pixelFormat @abstract The MTLPixelFormat of the underlying texture @discussion Note that in some cases, this value may be misleading. For example, float16 data (BFloat16) is sometimes stored in MTLPixelFormatRGBA16Unorm Please consult the featureChannelFormat.
func (*MPSImage) PixelSize ¶
@property pixelSize @abstract Number of bytes from the first byte of one pixel to the first byte of the next pixel in storage order. (Includes padding.)
func (*MPSImage) Precision ¶
@property precision @abstract The number of bits of numeric precision available for each feature channel. @discussion This is precision, not size. That is, float is 24 bits, not 32. half precision floating-point is 11 bits, not 16. SNorm formats have one less bit of precision for the sign bit, etc. For formats like MTLPixelFormatB5G6R5Unorm it is the precision of the most precise channel, in this case 6. When this information is unavailable, typically compressed formats, 0 will be returned.
func (*MPSImage) ReadBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex ¶
func (o *MPSImage) ReadBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, bytesPerRow uint, bytesPerImage uint, region metal.MTLRegion, featureChannelInfo MPSImageReadWriteParams, imageIndex uint)
@method readBytes @abstract Get the values inside MPSImage and put them in the Buffer passed in. @param dataBytes The array allocated by the user to be used to put data from MPSImage, the length should be imageWidth * imageHeight * numberOfFeatureChannels and dataType should be inferred from pixelFormat defined in the Image Descriptor. @param dataLayout The enum tells how to layout MPS data in the buffer. @param bytesPerRow Bytes to stride to point to next row(pixel just below current one) in the user buffer. @param bytesPerImage Bytes to stride to point to next dataBytes image. See region.size.depth for image count. @param featureChannelInfo information user fills in to write to a set of feature channels in the image @param imageIndex Image index in MPSImage to write to. @param region region of the MPSImage to read from. A region is a structure with the origin in the Image from which to start reading values and a size which represents the width and height of the rectangular region to read from. The z direction denotes the number of images, thus for 1 image, origin.z = 0 and size.depth = 1 @discussion This method is used to copy data from the MPSImage to the storage provided by dataBytes. The ordering of data in your dataBytes buffer is given by dataLayout. Each image may be stored as either a series of planar images (a series of single WxH images, one per feature channel) or a single chunky image, WxHxfeature_channels. BytesPerRow and BytesPerImage are there to allow some padding between successive rows and successive images. No padding is allowed between successive feature channels. BUG: Prior to MacOS 10.15, iOS/tvOS 13.0, incorrect behavior may be observed if region.size.depth != 1 or if bytesPerRow allowed for unused padding between rows. BUG: To provide for full capability to extract and insert content from arbitrarily sized buffers, there should also be a featureChannelStride in addition to bytesPerRow and bytesPerImage. With the current design, when we finish the last feature channel, the next byte will contain the 0th feature channel for the next texel or slice, depending on packing order. This method can not be used to modify some but not all of the feature channels in an image.
func (*MPSImage) ReadBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex ¶
func (o *MPSImage) ReadBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, bytesPerRow uint, region metal.MTLRegion, featureChannelInfo MPSImageReadWriteParams, imageIndex uint)
@method readBytes @abstract Get the values inside MPSImage and put them in the Buffer passed in. @param dataBytes The array allocated by the user to be used to put data from MPSImage, the length should be imageWidth * imageHeight * numberOfFeatureChannels and dataType should be inferred from pixelFormat defined in the Image Descriptor. @param dataLayout The enum tells how to layout MPS data in the buffer. @param bytesPerRow Bytes to stride to point to next row(pixel just below current one) in the user buffer. @param featureChannelInfo information user fills in to write to a set of feature channels in the image @param imageIndex Image index in MPSImage to write to. @param region region of the MPSImage to read from. A region is a structure with the origin in the Image from which to start reading values and a size which represents the width and height of the rectangular region to read from. The z direction denotes the number of images, thus for 1 image, origin.z = 0 and size.depth = 1 @discussion Use the enum to set data is coming in with what order. The data type will be determined by the pixelFormat defined in the Image Descriptor.
func (*MPSImage) ReadBytesDataLayoutImageIndex ¶
func (o *MPSImage) ReadBytesDataLayoutImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, imageIndex uint)
@method readBytes @abstract Get the values inside MPSImage and put them in the Buffer passed in. @param dataBytes The array allocated by the user to be used to put data from MPSImage, the length should be imageWidth * imageHeight * numberOfFeatureChannels and dataType should be inferred from pixelFormat defined in the Image Descriptor. @param dataLayout The enum tells how to layout MPS data in the buffer. @param imageIndex Image index in MPSImage to read from. @discussion Use the enum to set data is coming in with what order. The data type will be determined by the pixelFormat defined in the Image Descriptor. Region is full image, buffer width and height is same as MPSImage width and height.
func (*MPSImage) ResourceSize ¶
@abstract Get the number of bytes used to allocate underyling MTLResources @discussion This is the size of the backing store of underlying MTLResources. It does not include all storage used by the object, for example the storage used to hold the MPSImage instantiation and MTLTexture is not included. It only measures the size of the allocation used to hold the texels in the image. This value is subject to change between different devices and operating systems. Except when -initWithTexture:featureChannels: is used, most MPSImages (including MPSTemporaryImages) are allocated without a backing store. The backing store is allocated lazily when it is needed, typically when the .texture property is called. Consequently, in most cases, it should be inexpensive to make a MPSImage to see how much memory it will need, and release it if it is too large. This method may fail in certain circumstances, such as when the MPSImage is created with -initWithTexture:featureChannels:, in which case 0 will be returned. 0 will also be returned if it is a sub-image or sub-batch (.parent is not nil).
func (*MPSImage) SetLabel ¶
func (o *MPSImage) SetLabel(label *foundation.NSString)
func (*MPSImage) SetPurgeableState ¶
func (o *MPSImage) SetPurgeableState(state MPSPurgeableState) MPSPurgeableState
@abstract Set (or query) the purgeability state of a MPSImage @discussion Usage is per [MTLResource setPurgeableState:], except that the MTLTexture might be MPSPurgeableStateAllocationDeferred, which means there is no texture to mark volatile / nonvolatile. Attempts to set purgeability on MTLTextures that have not been allocated will be ignored.
func (*MPSImage) SubImageWithFeatureChannelRange ¶
func (o *MPSImage) SubImageWithFeatureChannelRange(range_ foundation.NSRange) *MPSImage
func (*MPSImage) SynchronizeOnCommandBuffer ¶
func (o *MPSImage) SynchronizeOnCommandBuffer(commandBuffer metal.MTLCommandBuffer)
@abstract Flush the underlying MTLTexture from the device's caches, and invalidate any CPU caches if needed. @discussion This will call [id <MTLBlitEncoder> synchronizeResource: ] on the image's MTLTexture, if any. This is necessary for all MTLStorageModeManaged resources. For other resources, including temporary resources (these are all MTLStorageModePrivate), and textures that have not yet been allocated, nothing is done. It is more efficient to use this method than to attempt to do this yourself with the texture property. @param commandBuffer The commandbuffer on which to synchronize
func (*MPSImage) Texture ¶
func (o *MPSImage) Texture() metal.MTLTexture
@property texture @abstract The associated MTLTexture object. This is a 2D texture if numberOfImages is 1 and number of feature channels <= 4. It is a 2D texture array otherwise. @discussion To avoid the high cost of premature allocation of the underlying texture, avoid calling this property except when strictly necessary. [MPSCNNKernel encode...] calls typically cause their arguments to become allocated. Likewise, MPSImages initialized with -initWithTexture: featureChannels: have already been allocated.
func (*MPSImage) TextureType ¶
func (o *MPSImage) TextureType() metal.MTLTextureType
@property textureType @abstract The type of the underlying texture, typically MTLTextureType2D or MTLTextureType2DArray
func (*MPSImage) Usage ¶
func (o *MPSImage) Usage() metal.MTLTextureUsage
@property usage @abstract Description of texture usage.
func (*MPSImage) WriteBytesDataLayoutBytesPerColumnBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex ¶
func (o *MPSImage) WriteBytesDataLayoutBytesPerColumnBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, bytesPerColumn uint, bytesPerRow uint, bytesPerImage uint, region metal.MTLRegion, featureChannelInfo MPSImageReadWriteParams, imageIndex uint)
@abstract Set the values inside MPSImage with the Buffer passed in. @param dataBytes The array allocated by the user to be used to put data from MPSImage, the length should be imageWidth * imageHeight * numberOfFeatureChannels and dataType should be inferred from pixelFormat defined in the Image Descriptor. @param dataLayout The enum tells how to layout MPS data in the buffer. @param bytesPerColumn This is the stride in bytes from W[0] to W[1], for both HWC and CHW orderings in the buffer pointed to by dataBytes. @param bytesPerRow Bytes to stride to point to next row(pixel just below current one, i.e. H[0] to H[1]) in the buffer pointed to by dataBytes. @param bytesPerImage This is the stride in bytes from image[0] to image[1] im the buffer pointed to by dataBytes. @param region region of the MPSImage to write to. A region is a structure with the origin in the Image from which to start writing values and a size which represents the width and height of the rectangular region to write in. The z direction denotes the number of images, thus for 1 image, origin.z = 0 and size.depth = 1 @param featureChannelInfo information user fills in to read from a set of feature channels in the image @param imageIndex Image index in MPSImage to write to. @discussion This method is used to copy data from the storage provided by dataBytes to the MPSImage. The ordering of data in your dataBytes buffer is given by dataLayout. Each image may be stored as either a series of planar images (a series of single WxH images, one per feature channel) or a single chunky image, WxHxfeature_channels. BytesPerRow and BytesPerImage are there to allow some padding between successive rows and successive images. No padding is allowed between successive feature channels.
func (*MPSImage) WriteBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex ¶
func (o *MPSImage) WriteBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, bytesPerRow uint, bytesPerImage uint, region metal.MTLRegion, featureChannelInfo MPSImageReadWriteParams, imageIndex uint)
@method writeBytes @abstract Set the values inside MPSImage with the Buffer passed in. @param dataBytes The array allocated by the user to be used to put data from MPSImage, the length should be imageWidth * imageHeight * numberOfFeatureChannels and dataType should be inferred from pixelFormat defined in the Image Descriptor. @param dataLayout The enum tells how to layout MPS data in the buffer. @param bytesPerRow Bytes to stride to point to next row(pixel just below current one) in the user buffer. @param bytesPerImage Bytes to stride to point to next dataBytes image. See region.size.depth for image count. @param region region of the MPSImage to write to. A region is a structure with the origin in the Image from which to start writing values and a size which represents the width and height of the rectangular region to write in. The z direction denotes the number of images, thus for 1 image, origin.z = 0 and size.depth = 1 @param featureChannelInfo information user fills in to read from a set of feature channels in the image @param imageIndex Image index in MPSImage to write to. @discussion Use the enum to set data is coming in with what order. The data type will be determined by the pixelFormat defined in the Image Descriptor. BUG: Prior to MacOS 10.15, iOS/tvOS 13.0, incorrect behavior may be observed if region.size.depth != 1 or if bytesPerRow allowed for unused padding between rows. BUG: To provide for full capability to extract and insert content from arbitrarily sized buffers, there should also be a featureChannelStride in addition to bytesPerRow and bytesPerImage. With the current design, when we finish the last feature channel, the next byte will contain the 0th feature channel for the next texel or slice, depending on packing order. This method can not be used to modify some but not all of the feature channels in an image.
func (*MPSImage) WriteBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex ¶
func (o *MPSImage) WriteBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, bytesPerRow uint, region metal.MTLRegion, featureChannelInfo MPSImageReadWriteParams, imageIndex uint)
@abstract Set the values inside MPSImage with the Buffer passed in. @param dataBytes The array allocated by the user to be used to put data from MPSImage, the length should be imageWidth * imageHeight * numberOfFeatureChannels and dataType should be inferred from pixelFormat defined in the Image Descriptor. @param dataLayout The enum tells how to layout MPS data in the buffer. @param bytesPerRow Bytes to stride to point to next row(pixel just below current one) in the user buffer. @param region region of the MPSImage to write to. A region is a structure with the origin in the Image from which to start writing values and a size which represents the width and height of the rectangular region to write in. The z direction denotes the number of images, thus for 1 image, origin.z = 0 and size.depth = 1 @param featureChannelInfo information user fills in to read from a set of feature channels in the image @param imageIndex Image index in MPSImage to write to. @discussion This method is used to copy data from the storage provided by dataBytes to the MPSImage. The ordering of data in your dataBytes buffer is given by dataLayout. Each image may be stored as either a series of planar images (a series of single WxH images, one per feature channel) or a single chunky image, WxHxfeature_channels. BytesPerRow and BytesPerImage are there to allow some padding between successive rows and successive images. No padding is allowed between successive feature channels.
func (*MPSImage) WriteBytesDataLayoutImageIndex ¶
func (o *MPSImage) WriteBytesDataLayoutImageIndex(dataBytes unsafe.Pointer, dataLayout MPSDataLayout, imageIndex uint)
@method writeBytes @abstract Set the values inside MPSImage with the Buffer passed in. @param dataBytes The array allocated by the user to be used to put data from MPSImage, the length should be imageWidth * imageHeight * numberOfFeatureChannels and dataType should be inferred from pixelFormat defined in the Image Descriptor. @param dataLayout The enum tells how to layout MPS data in the buffer. @param imageIndex Image index in MPSImage to write to. @discussion Use the enum to set data is coming in with what order. The data type will be determined by the pixelFormat defined in the Image Descriptor. Region is full image, buffer width and height is same as MPSImage width and height.
type MPSImageAllocator ¶
type MPSImageAllocator interface {
foundation.NSSecureCoding
ImageForCommandBufferImageDescriptorKernel(cmdBuf metal.MTLCommandBuffer, descriptor *MPSImageDescriptor, kernel *MPSKernel) *MPSImage
}
MPSImageAllocator wraps the ObjC protocol MPSImageAllocator.
func MPSImageDefaultAllocator ¶
func MPSImageDefaultAllocator() MPSImageAllocator
Get a well known MPSImageAllocator that makes MPSImages
func MPSTemporaryImageDefaultAllocator ¶
func MPSTemporaryImageDefaultAllocator() MPSImageAllocator
Get a well known MPSImageAllocator that makes MPSTemporaryImages
type MPSImageCoordinate ¶
@struct MPSImageCoordinate @memberof MPSImage @abstract A unsigned coordinate with x, y and channel components
type MPSImageDescriptor ¶
type MPSImageDescriptor struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpsimagedescriptor
func MPSImageDescriptorFromID ¶
func MPSImageDescriptorFromID(id objc.ID) *MPSImageDescriptor
func MPSImageDescriptorImageDescriptorWithChannelFormatWidthHeightFeatureChannels ¶
func MPSImageDescriptorImageDescriptorWithChannelFormatWidthHeightFeatureChannels(channelFormat MPSImageFeatureChannelFormat, width uint, height uint, featureChannels uint) *MPSImageDescriptor
@abstract Create a MPSImageDescriptor for a single read/write cnn image.
func MPSImageDescriptorImageDescriptorWithChannelFormatWidthHeightFeatureChannelsNumberOfImagesUsage ¶
func MPSImageDescriptorImageDescriptorWithChannelFormatWidthHeightFeatureChannelsNumberOfImagesUsage(channelFormat MPSImageFeatureChannelFormat, width uint, height uint, featureChannels uint, numberOfImages uint, usage metal.MTLTextureUsage) *MPSImageDescriptor
@abstract Create a MPSImageDescriptor for a read/write cnn image with option to set usage and batch size (numberOfImages).
func (*MPSImageDescriptor) ChannelFormat ¶
func (o *MPSImageDescriptor) ChannelFormat() MPSImageFeatureChannelFormat
@property channelFormat @abstract The storage format to use for each channel in the image.
func (*MPSImageDescriptor) CpuCacheMode ¶
func (o *MPSImageDescriptor) CpuCacheMode() metal.MTLCPUCacheMode
@property cpuCacheMode @abstract Options to specify CPU cache mode of texture resource. Default = MTLCPUCacheModeDefaultCache
func (*MPSImageDescriptor) FeatureChannels ¶
func (o *MPSImageDescriptor) FeatureChannels() uint
@property featureChannels @abstract The number of feature channels per pixel. Default = 1.
func (*MPSImageDescriptor) Height ¶
func (o *MPSImageDescriptor) Height() uint
@property height @abstract The height of the CNN image. @discussion The formal height of the CNN image in pixels. Default = 1.
func (*MPSImageDescriptor) NumberOfImages ¶
func (o *MPSImageDescriptor) NumberOfImages() uint
@property numberOfImages @abstract The number of images for batch processing. Default = 1.
func (*MPSImageDescriptor) PixelFormat ¶
func (o *MPSImageDescriptor) PixelFormat() metal.MTLPixelFormat
@property pixelFormat @abstract The MTLPixelFormat expected for the underlying texture.
func (*MPSImageDescriptor) SetChannelFormat ¶
func (o *MPSImageDescriptor) SetChannelFormat(channelFormat MPSImageFeatureChannelFormat)
func (*MPSImageDescriptor) SetCpuCacheMode ¶
func (o *MPSImageDescriptor) SetCpuCacheMode(cpuCacheMode metal.MTLCPUCacheMode)
func (*MPSImageDescriptor) SetFeatureChannels ¶
func (o *MPSImageDescriptor) SetFeatureChannels(featureChannels uint)
func (*MPSImageDescriptor) SetHeight ¶
func (o *MPSImageDescriptor) SetHeight(height uint)
func (*MPSImageDescriptor) SetNumberOfImages ¶
func (o *MPSImageDescriptor) SetNumberOfImages(numberOfImages uint)
func (*MPSImageDescriptor) SetStorageMode ¶
func (o *MPSImageDescriptor) SetStorageMode(storageMode metal.MTLStorageMode)
func (*MPSImageDescriptor) SetUsage ¶
func (o *MPSImageDescriptor) SetUsage(usage metal.MTLTextureUsage)
func (*MPSImageDescriptor) SetWidth ¶
func (o *MPSImageDescriptor) SetWidth(width uint)
func (*MPSImageDescriptor) StorageMode ¶
func (o *MPSImageDescriptor) StorageMode() metal.MTLStorageMode
@property storageMode @abstract To specify storage mode of texture resource. @discussion Storage mode options: @code Default = MTLStorageModeShared on iOS MTLStorageModeManaged on Mac OSX MTLStorageModeShared not supported on Mac OSX. See Metal headers for synchronization requirements when using StorageModeManaged @endcode
func (*MPSImageDescriptor) Usage ¶
func (o *MPSImageDescriptor) Usage() metal.MTLTextureUsage
@property usage @abstract Description of texture usage. Default = MTLTextureUsageShaderRead/Write
func (*MPSImageDescriptor) Width ¶
func (o *MPSImageDescriptor) Width() uint
@property width @abstract The width of the CNN image. @discussion The formal width of the CNN image in pixels. Default = 1.
type MPSImageEdgeMode ¶
type MPSImageEdgeMode uint64
const ( // Out of bound pixels are (0,0,0,1) for image with pixel format without alpha channel and (0,0,0,0) for image with pixel format that has an alpha channel MPSImageEdgeModeZero MPSImageEdgeMode = 0 // Out of bound pixels are clamped to nearest edge pixel MPSImageEdgeModeClamp MPSImageEdgeMode = 1 // Out of bound pixels are mirrored wrt. the nearest edge pixel center - ie. the edge of the image is not repeated. NOTE: The only filter that currently supports this mode is @ref MPSNNPad - using this with other filters results in undefined behavior. MPSImageEdgeModeMirror MPSImageEdgeMode = 2 // Out of bound pixels are mirrored wrt. the nearest edge pixel nearest border - ie. the edge of the image is repeated. NOTE: The only filter that currently supports this mode is @ref MPSNNPad - using this with other filters results in undefined behavior. MPSImageEdgeModeMirrorWithEdge MPSImageEdgeMode = 3 // Out of bound pixels are filled with a constant value defined by the filter. NOTE: The only filter that currently supports this mode is @ref MPSNNPad - using this with other filters results in undefined behavior. MPSImageEdgeModeConstant MPSImageEdgeMode = 4 )
func (MPSImageEdgeMode) String ¶
func (e MPSImageEdgeMode) String() string
type MPSImageFeatureChannelFormat ¶
type MPSImageFeatureChannelFormat uint64
const ( // No format. This can mean according to context invalid format or any format. In the latter case, it is an invitation to MPS to pick a format. MPSImageFeatureChannelFormatNone MPSImageFeatureChannelFormat = 0 // uint8_t with value [0,255] encoding [0,1.0] MPSImageFeatureChannelFormatUnorm8 MPSImageFeatureChannelFormat = 1 // uint16_t with value [0,65535] encoding [0,1.0] MPSImageFeatureChannelFormatUnorm16 MPSImageFeatureChannelFormat = 2 // IEEE-754 16-bit floating-point value. "half precision" Representable normal range is +-[2**-14, 65504], 0, Infinity, NaN. 11 bits of precision + exponent. MPSImageFeatureChannelFormatFloat16 MPSImageFeatureChannelFormat = 3 // IEEE-754 32-bit floating-point value. "single precision" (standard float type in C) 24 bits of precision + exponent MPSImageFeatureChannelFormatFloat32 MPSImageFeatureChannelFormat = 4 // Reserved for later expansion MPSImageFeatureChannelFormat_reserved0 MPSImageFeatureChannelFormat = 5 MPSImageFeatureChannelFormatCount MPSImageFeatureChannelFormat = 6 )
func (MPSImageFeatureChannelFormat) String ¶
func (e MPSImageFeatureChannelFormat) String() string
type MPSImageReadWriteParams ¶
type MPSImageReadWriteParams struct {
FeatureChannelOffset uint
NumberOfFeatureChannelsToReadWrite uint
}
@struct MPSImageReadWriteParams @abstract these parameters are passed in to allow user to read/write to a particular set of featureChannels in an MPSImage
type MPSImageRegion ¶
type MPSImageRegion struct {
Offset MPSImageCoordinate
Size MPSImageCoordinate
}
@struct MPSImageRegion @memberof MPSImage @abstract A rectangular subregion of a MPSImage
type MPSImageType ¶
type MPSImageType int64
const ( MPSImageType2d MPSImageType = 0 MPSImageType2d_array MPSImageType = 1 MPSImageTypeArray2d MPSImageType = 2 MPSImageTypeArray2d_array MPSImageType = 3 MPSImageType_ArrayMask MPSImageType = 1 MPSImageType_BatchMask MPSImageType = 2 MPSImageType_typeMask MPSImageType = 3 MPSImageType_noAlpha MPSImageType = 4 MPSImageType_texelFormatMask MPSImageType = 56 MPSImageType_texelFormatShift MPSImageType = 3 MPSImageType_texelFormatStandard MPSImageType = 0 MPSImageType_texelFormatUnorm8 MPSImageType = 8 MPSImageType_texelFormatFloat16 MPSImageType = 16 MPSImageType_texelFormatBFloat16 MPSImageType = 24 MPSImageType_bitCount MPSImageType = 6 MPSImageType_mask MPSImageType = 63 MPSImageType2d_noAlpha MPSImageType = 4 MPSImageType2d_array_noAlpha MPSImageType = 5 MPSImageTypeArray2d_noAlpha MPSImageType = 6 MPSImageTypeArray2d_array_noAlpha MPSImageType = 7 )
func (MPSImageType) String ¶
func (e MPSImageType) String() string
type MPSIntegerDivisionParams ¶
func MPSFindIntegerDivisionParams ¶
func MPSFindIntegerDivisionParams(divisor uint16) MPSIntegerDivisionParams
type MPSKernel ¶
type MPSKernel struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpskernel
func MPSKernelFromID ¶
func (*MPSKernel) CopyWithZoneDevice ¶
@abstract Make a copy of this MPSKernel for a new device @discussion -copyWithZone: will call this API to make a copy of the MPSKernel on the same device. This interface may also be called directly to make a copy of the MPSKernel on a new device. Typically, the same MPSKernels should not be used to encode kernels on multiple command buffers from multiple threads. Many MPSKernels have mutable properties that might be changed by the other thread while this one is trying to encode. If you need to use a MPSKernel from multiple threads make a copy of it for each additional thread using -copyWithZone: or -copyWithZone:device: @param zone The NSZone in which to allocate the object @param device The device for the new MPSKernel. If nil, then use self.device. @result a pointer to a copy of this MPSKernel. This will fail, returning nil if the device is not supported. Devices must be MTLFeatureSet_iOS_GPUFamily2_v1 or later.
func (*MPSKernel) InitWithCoder ¶
func (o *MPSKernel) InitWithCoder(aDecoder *foundation.NSCoder) *MPSKernel
@abstract Called by NSCoder to decode MPSKernels @discussion This isn't the right interface to decode a MPSKernel, but it is the one that NSCoder uses. To enable your NSCoder (e.g. NSKeyedUnarchiver) to set which device to use extend the object to adopt the MPSDeviceProvider protocol. Otherwise, the Metal system default device will be used.
func (*MPSKernel) InitWithCoderDevice ¶
func (o *MPSKernel) InitWithCoderDevice(aDecoder *foundation.NSCoder, device metal.MTLDevice) *MPSKernel
@abstract NSSecureCoding compatability @discussion While the standard NSSecureCoding/NSCoding method -initWithCoder: should work, since the file can't know which device your data is allocated on, we have to guess and may guess incorrectly. To avoid that problem, use initWithCoder:device instead. @param aDecoder The NSCoder subclass with your serialized MPSKernel @param device The MTLDevice on which to make the MPSKernel @return A new MPSKernel object, or nil if failure.
func (*MPSKernel) InitWithDevice ¶
@abstract Standard init with default properties per filter type @param device The device that the filter will be used on. May not be NULL. @result a pointer to the newly initialized object. This will fail, returning nil if the device is not supported. Devices must be MTLFeatureSet_iOS_GPUFamily2_v1 or later.
func (*MPSKernel) Label ¶
func (o *MPSKernel) Label() *foundation.NSString
@property label @abstract A string to help identify this object.
func (*MPSKernel) Options ¶
func (o *MPSKernel) Options() MPSKernelOptions
@property options @abstract The set of options used to run the kernel. @ref subsubsection_options
func (*MPSKernel) SetLabel ¶
func (o *MPSKernel) SetLabel(label *foundation.NSString)
func (*MPSKernel) SetOptions ¶
func (o *MPSKernel) SetOptions(options MPSKernelOptions)
type MPSKernelOptions ¶
type MPSKernelOptions uint64
const ( // Use default options MPSKernelOptionsNone MPSKernelOptions = 0 // Most MPS functions will sanity check their arguments. This has a small but non-zero CPU cost. Setting the MPSKernelOptionsSkipAPIValidation will skip these checks. MPSKernelOptionsSkipAPIValidation does not skip checks for memory allocation failure. Caution: turning on MPSKernelOptionsSkipAPIValidation can result in undefined behavior if the requested operation can not be completed for some reason. Most error states will be passed through to Metal which may do nothing or abort the program if Metal API validation is turned on. MPSKernelOptionsSkipAPIValidation MPSKernelOptions = 1 // When possible, MPSKernels use a higher precision data representation internally than the destination storage format to avoid excessive accumulation of computational rounding error in the result. MPSKernelOptionsAllowReducedPrecision advises the MPSKernel that the destination storage format already has too much precision for what is ultimately required downstream, and the MPSKernel may use reduced precision internally when it feels that a less precise result would yield better performance. The expected performance win is often small, perhaps 0-20%. When enabled, the precision of the result may vary by hardware and operating system. MPSKernelOptionsAllowReducedPrecision MPSKernelOptions = 2 // Some MPSKernels may automatically split up the work internally into multiple tiles. This improves performance on larger textures and reduces the amount of memory needed by MPS for temporary storage. However, if you are using your own tiling scheme to achieve similar results, your tile sizes and MPS's choice of tile sizes may interfere with one another causing MPS to subdivide your tiles for its own use inefficiently. Pass MPSKernelOptionsDisableInternalTiling to force MPS to process your data tile as a single chunk. MPSKernelOptionsDisableInternalTiling MPSKernelOptions = 4 // Enabling this bit will cause various -encode... methods to call MTLCommandEncoder push/popDebugGroup. The debug string will be drawn from MPSKernel.label, if any or the name of the class otherwise. MPSKernelOptionsInsertDebugGroups MPSKernelOptions = 8 // Some parts of MPS can provide debug commentary and tuning advice when run. Setting this bit to 1 will cause the commentary to be emitted to stderr. Otherwise, the code is silent. This is especially useful for debugging MPSNNGraph. This option is on by default when the MPS_LOG_INFO environment variable is defined. For even more detailed output on a MPS object, you can use the po command in llvm with MPS objects: @code llvm> po <MPS object pointer> @endcode MPSKernelOptionsVerbose MPSKernelOptions = 16 )
func (MPSKernelOptions) String ¶
func (e MPSKernelOptions) String() string
type MPSKeyedUnarchiver ¶
type MPSKeyedUnarchiver struct {
foundation.NSKeyedUnarchiver
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpskeyedunarchiver
func MPSKeyedUnarchiverFromID ¶
func MPSKeyedUnarchiverFromID(id objc.ID) *MPSKeyedUnarchiver
func (*MPSKeyedUnarchiver) InitForReadingFromDataDeviceError ¶
func (o *MPSKeyedUnarchiver) InitForReadingFromDataDeviceError(data *foundation.NSData, device metal.MTLDevice) (*MPSKeyedUnarchiver, error)
func (*MPSKeyedUnarchiver) InitForReadingWithDataDevice ¶
func (o *MPSKeyedUnarchiver) InitForReadingWithDataDevice(data *foundation.NSData, device metal.MTLDevice) *MPSKeyedUnarchiver
func (*MPSKeyedUnarchiver) InitWithDevice ¶
func (o *MPSKeyedUnarchiver) InitWithDevice(device metal.MTLDevice) *MPSKeyedUnarchiver
func (*MPSKeyedUnarchiver) MpsMTLDevice ¶
func (o *MPSKeyedUnarchiver) MpsMTLDevice() metal.MTLDevice
@abstract Reports which device to use for unarchiving MPSKernels
type MPSMatrix ¶
type MPSMatrix struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpsmatrix
func MPSMatrixFromID ¶
func (*MPSMatrix) Columns ¶
@property columns @discussion The number of columns in a matrix in the MPSMatrix.
func (*MPSMatrix) DataType ¶
func (o *MPSMatrix) DataType() MPSDataType
@property dataType @discussion The type of the MPSMatrix data.
func (*MPSMatrix) Device ¶
@property device @discussion The device on which the MPSMatrix will be used.
func (*MPSMatrix) InitWithBufferDescriptor ¶
func (o *MPSMatrix) InitWithBufferDescriptor(buffer metal.MTLBuffer, descriptor *MPSMatrixDescriptor) *MPSMatrix
@abstract Initialize a MPSMatrix object with a MTLBuffer. @param buffer The MTLBuffer object which contains the data to use for the MPSMatrix. May not be NULL. @param descriptor The MPSMatrixDescriptor. May not be NULL. @return A valid MPSMatrix object or nil, if failure. @discussion This function returns a MPSMatrix object which uses the supplied MTLBuffer. The dimensions and stride of the matrix are specified by the MPSMatrixDescriptor object. The provided MTLBuffer must have enough storage to hold (descriptor.matrices-1) * descriptor.matrixBytes + (descriptor.rows-1) * descriptor.rowBytes + descriptor.columns * (element size) bytes.
func (*MPSMatrix) InitWithBufferOffsetDescriptor ¶
func (o *MPSMatrix) InitWithBufferOffsetDescriptor(buffer metal.MTLBuffer, offset uint, descriptor *MPSMatrixDescriptor) *MPSMatrix
@abstract Initialize a MPSMatrix object with a MTLBuffer at a given offset. @param buffer The MTLBuffer object which contains the data to use for the MPSMatrix. May not be NULL. @param offset The offset, in bytes, into the buffer at which the data begins. @param descriptor The MPSMatrixDescriptor describing the shape of the matrix.
func (*MPSMatrix) InitWithDeviceDescriptor ¶
func (o *MPSMatrix) InitWithDeviceDescriptor(device metal.MTLDevice, descriptor *MPSMatrixDescriptor) *MPSMatrix
@abstract Initialize a MPSMatrix object with a descriptor. Allocate the buffer. @param device The device with which it will be used @param descriptor The shape and style of the matrix @return A valid MPSMatrix object or nil @discussion The matrix object will be created, but the storage to hold the matrix data will only be allocated when it is needed, typically when the data property is invoked. In conjunction with -resourceSize, this will allow you to estimate storage needs without actually creating the backing store for the matrix.
func (*MPSMatrix) Matrices ¶
@property matrices @discussion The number of matrices in the MPSMatrix.
func (*MPSMatrix) MatrixBytes ¶
@property matrixBytes @discussion The stride, in bytes, between corresponding elements of consecutive matrices.
func (*MPSMatrix) Offset ¶
@property offset @discussion Byte-offset to the buffer where the matrix data begins - see @ref initWithBuffer: offset: descriptor: .
func (*MPSMatrix) ResourceSize ¶
@abstract Get the number of bytes used to allocate underyling MTLResources @discussion This is the size of the backing store of underlying MTLResources. It does not include all storage used by the object, for example the storage used to hold the MPSMatrix instantiation and MTLBuffer is not included. It only measures the size of the allocation used to hold the matrix data in the buffer. This value is subject to change between different devices and operating systems. Except when -initWithBuffer:descriptor: is used, most MPSMatrixes are allocated without a backing store. The backing store is allocated lazily when it is needed, typically when the .texture property is called. Consequently, in most cases, it should be inexpensive to make a MPSImage to see how much memory it will need, and release it if it is too large. This method may fail in certain circumstances, such as when the MPSImage is created with -initWithTexture:featureChannels:. In such cases, 0 will be returned.
func (*MPSMatrix) RowBytes ¶
@property rowBytes @discussion The stride, in bytes, between corresponding elements of consecutive rows.
func (*MPSMatrix) Rows ¶
@property rows @discussion The number of rows in a matrix in the MPSMatrix.
func (*MPSMatrix) SynchronizeOnCommandBuffer ¶
func (o *MPSMatrix) SynchronizeOnCommandBuffer(commandBuffer metal.MTLCommandBuffer)
@abstract Flush the underlying MTLBuffer from the device's caches, and invalidate any CPU caches if needed. @discussion This will call [id <MTLBlitEncoder> synchronizeResource: ] on the matrix's MTLBuffer, if any. This is necessary for all MTLStorageModeManaged resources. For other resources, including temporary resources (these are all MTLStorageModePrivate), and buffers that have not yet been allocated, nothing is done. It is more efficient to use this method than to attempt to do this yourself with the data property. @param commandBuffer The commandbuffer on which to synchronize
type MPSMatrixDescriptor ¶
type MPSMatrixDescriptor struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpsmatrixdescriptor
func MPSMatrixDescriptorFromID ¶
func MPSMatrixDescriptorFromID(id objc.ID) *MPSMatrixDescriptor
func MPSMatrixDescriptorMatrixDescriptorWithDimensionsColumnsRowBytesDataType ¶
func MPSMatrixDescriptorMatrixDescriptorWithDimensionsColumnsRowBytesDataType(rows uint, columns uint, rowBytes uint, dataType MPSDataType) *MPSMatrixDescriptor
@abstract Create a MPSMatrixDescriptor with the specified dimensions and data type. @param rows The number of rows of the matrix. @param columns The number of columns of the matrix. @param rowBytes The number of bytes between starting elements of consecutive rows. Must be a multiple of the element size. @param dataType The type of the data to be stored in the matrix. @discussion For performance considerations the optimal row stride may not necessarily be equal to the number of columns in the matrix. The MPSMatrix class provides a method which may be used to determine this value, see the rowBytesForColumns API in the MPSMatrix class. The number of matrices described is initialized to 1.
func MPSMatrixDescriptorMatrixDescriptorWithRowsColumnsMatricesRowBytesMatrixBytesDataType ¶
func MPSMatrixDescriptorMatrixDescriptorWithRowsColumnsMatricesRowBytesMatrixBytesDataType(rows uint, columns uint, matrices uint, rowBytes uint, matrixBytes uint, dataType MPSDataType) *MPSMatrixDescriptor
@abstract Create a MPSMatrixDescriptor with the specified dimensions and data type. @param rows The number of rows of a single matrix. @param columns The number of columns of a single matrix. @param matrices The number of matrices in the MPSMatrix object. @param rowBytes The number of bytes between starting elements of consecutive rows. Must be a multiple of the element size. @param matrixBytes The number of bytes between starting elements of consecutive matrices. Must be a multiple of rowBytes. @param dataType The type of the data to be stored in the matrix. @discussion For performance considerations the optimal row stride may not necessarily be equal to the number of columns in the matrix. The MPSMatrix class provides a method which may be used to determine this value, see the rowBytesForColumns API in the MPSMatrix class.
func MPSMatrixDescriptorMatrixDescriptorWithRowsColumnsRowBytesDataType ¶
func MPSMatrixDescriptorMatrixDescriptorWithRowsColumnsRowBytesDataType(rows uint, columns uint, rowBytes uint, dataType MPSDataType) *MPSMatrixDescriptor
func (*MPSMatrixDescriptor) Columns ¶
func (o *MPSMatrixDescriptor) Columns() uint
@property columns @discussion The number of columns in a matrix.
func (*MPSMatrixDescriptor) DataType ¶
func (o *MPSMatrixDescriptor) DataType() MPSDataType
@property dataType @discussion The type of the data which makes up the values of the matrix.
func (*MPSMatrixDescriptor) Matrices ¶
func (o *MPSMatrixDescriptor) Matrices() uint
@property matrices @discussion The number of matrices.
func (*MPSMatrixDescriptor) MatrixBytes ¶
func (o *MPSMatrixDescriptor) MatrixBytes() uint
@property matrixBytes @discussion The stride, in bytes, between corresponding elements of consecutive matrices. Must be a multiple of rowBytes.
func (*MPSMatrixDescriptor) RowBytes ¶
func (o *MPSMatrixDescriptor) RowBytes() uint
@property rowBytes @discussion The stride, in bytes, between corresponding elements of consecutive rows. Must be a multiple of the element size.
func (*MPSMatrixDescriptor) Rows ¶
func (o *MPSMatrixDescriptor) Rows() uint
@property rows @discussion The number of rows in a matrix.
func (*MPSMatrixDescriptor) SetColumns ¶
func (o *MPSMatrixDescriptor) SetColumns(columns uint)
func (*MPSMatrixDescriptor) SetDataType ¶
func (o *MPSMatrixDescriptor) SetDataType(dataType MPSDataType)
func (*MPSMatrixDescriptor) SetRowBytes ¶
func (o *MPSMatrixDescriptor) SetRowBytes(rowBytes uint)
func (*MPSMatrixDescriptor) SetRows ¶
func (o *MPSMatrixDescriptor) SetRows(rows uint)
type MPSMatrixOffset ¶
@struct MPSMatrixOffset @memberof MPSMatrix @abstract Specifies a row and column offset into an MPSMatrix.
type MPSNDArray ¶
type MPSNDArray struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpsndarray
func MPSNDArrayFromID ¶
func MPSNDArrayFromID(id objc.ID) *MPSNDArray
func (*MPSNDArray) ArrayViewWithCommandBufferDescriptorAliasing ¶
func (o *MPSNDArray) ArrayViewWithCommandBufferDescriptorAliasing(cmdBuf metal.MTLCommandBuffer, descriptor *MPSNDArrayDescriptor, aliasing MPSAliasingStrategy) *MPSNDArray
@abstract Make a new representation of a MPSNDArray with a slice, transpose or other change in property @discussion If possible, the views will merely record the slice or transpose without performing the operation. Many MPSKernels are able to operate on subregions of a MPSNDArray or operate on transposed data, so making a new copy of the data for these operations would be wasteful. A copy may be forced by a change in dataType, rowBytes, or when using a view with a MPSKernel that does not support the deferred operation. To force an operation to occur immediately, use MPSAliasingStrategyShallNotAlias Otherwise, it is likely that the new MPSNDArray will share a MTLBuffer with the parent and alias its memory. @param cmdBuf The command buffer on which to perform physical copies if any are required @param descriptor A MPSNDArrayDescriptor describing the shape of the new view of the data @param aliasing A aliasing strategy to direct MPS how to respond to cases when aliasing can or can not be performed. @return A new MPSNDArray, if it is possible to make one. Otherwise nil is returned. The MPSNDArray is autoreleased.
func (*MPSNDArray) ArrayViewWithDescriptor ¶
func (o *MPSNDArray) ArrayViewWithDescriptor(descriptor *MPSNDArrayDescriptor) *MPSNDArray
@abstract Make a new representation of a MPSNDArray with a slice, transpose or other change in property, trying to alias to result. @discussion The same as `arrayViewWithCommandBuffer`, except that tries to always alias, and therefore does not require a commanbuffer. If aliasing is not possible nil is returned. This method is useful in making aliasing transposes and slices, that are guaranteed to be able to alias. For reshapes it is recommended to use the `MPSNDArrayIdentity` methods. @param descriptor A MPSNDArrayDescriptor describing the shape of the new view of the data @return A new MPSNDArray, if it is possible to make one. Otherwise nil is returned. The MPSNDArray is autoreleased.
func (*MPSNDArray) ArrayViewWithDimensionCountDimensionSizesStrides ¶
func (o *MPSNDArray) ArrayViewWithDimensionCountDimensionSizesStrides(numberOfDimensions uint, dimensionSizes *uint, dimStrides *uint) *MPSNDArray
@abstract Make a new representation of a MPSNDArray with given strides and a new shape. @discussion This operation always returns a new view of the same underlying MTLBuffer, but works only with contiguous buffers. @param numberOfDimensions Number of dimensions in the new view. @param dimensionSizes Size of each new dimension. Fastest running dimension first. Must be of length numberOfDimensions. @param dimStrides The strides for each dimension. First number must be one. Must be non-decreasing. Must be of length numberOfDimensions. @return A new MPSNDArray, if it is possible to make one. Otherwise nil is returned. The MPSNDArray is autoreleased.
func (*MPSNDArray) ArrayViewWithShapeStrides ¶
func (o *MPSNDArray) ArrayViewWithShapeStrides(shape unsafe.Pointer, strides unsafe.Pointer) *MPSNDArray
@abstract Make a new representation of a MPSNDArray with given strides and a new shape. @discussion This operation always returns a new view of the same underlying MTLBuffer, but works only with contiguous buffers. @param shape The new shape for the NDArray. Fastest running dimension last. If nil then current shape is used. @param strides The strides for each dimension. Must be at least length of new shape. Last number must be one. Must be non-increasing. @return A new MPSNDArray, if it is possible to make one. Otherwise nil is returned. The MPSNDArray is autoreleased.
func (*MPSNDArray) DataType ¶
func (o *MPSNDArray) DataType() MPSDataType
@abstract The type of data stored by each element in the array
func (*MPSNDArray) DataTypeSize ¶
func (o *MPSNDArray) DataTypeSize() uint
@abstract The size of one element in the MPSNDArray
func (*MPSNDArray) Descriptor ¶
func (o *MPSNDArray) Descriptor() *MPSNDArrayDescriptor
@abstract Create a MPSNDArrayDescriptor that describes this MPSNDArray @discussion The descriptor will describe the shape of the MPSNDArray after all deferred slicing and transposes have completed. A new descriptor is created each time to allow for further customization of the descriptor by the application. @return A new autoreleased MPSNDArrayDescriptor that matches the shape of the MPSNDArray, suitable for introduction of slice, cast and transpose operations.
func (*MPSNDArray) Device ¶
func (o *MPSNDArray) Device() metal.MTLDevice
@property device @abstract The device on which the MSPNDArray may be used
func (*MPSNDArray) ExportDataWithCommandBufferToBufferDestinationDataTypeOffsetRowStrides ¶
func (o *MPSNDArray) ExportDataWithCommandBufferToBufferDestinationDataTypeOffsetRowStrides(cmdBuf metal.MTLCommandBuffer, buffer metal.MTLBuffer, destinationDataType MPSDataType, offset uint, rowStrides *int64)
@abstract Do a GPU side copy of the contents of a MPSNDArray to a MTLBuffer @discussion To do a transpose or slice as part of the operation, make a MPSNDArray view first that encodes that operation. @param cmdBuf The command buffer on which to encode the operation @param buffer The destination to overwrite @param destinationDataType The destination data type. @param offset The byte offset to where the {0,0,0...}th element will be written @param rowStrides An optional array of (numberOfDimensions-1) byte counts which describe the byte offset from position 0 of the respective dimension to position 1.
func (*MPSNDArray) ExportDataWithCommandBufferToImagesOffset ¶
func (o *MPSNDArray) ExportDataWithCommandBufferToImagesOffset(cmdBuf metal.MTLCommandBuffer, images unsafe.Pointer, offset MPSImageCoordinate)
func (*MPSNDArray) ImportDataWithCommandBufferFromBufferSourceDataTypeOffsetRowStrides ¶
func (o *MPSNDArray) ImportDataWithCommandBufferFromBufferSourceDataTypeOffsetRowStrides(cmdBuf metal.MTLCommandBuffer, buffer metal.MTLBuffer, sourceDataType MPSDataType, offset uint, rowStrides *int64)
@abstract Do a GPU side copy of the contents of a MTLBuffer into a MPSNDArray @discussion Copy data from provided buffer to the NDArray. Implicit transposes and slicing shall be honored. @param cmdBuf The command buffer on which to encode the operation @param buffer The destination to read from @param sourceDataType The source data type. @param offset The byte offset in the buffer from where the {0,0,0...}th element is to be read. @param rowStrides An optional array of (numberOfDimensions-1) byte counts which describe the byte offset from position 0 of the respective dimension to position 1.
func (*MPSNDArray) ImportDataWithCommandBufferFromImagesOffset ¶
func (o *MPSNDArray) ImportDataWithCommandBufferFromImagesOffset(cmdBuf metal.MTLCommandBuffer, images unsafe.Pointer, offset MPSImageCoordinate)
@abstract Do a GPU side copy of the contents of a MPSImageBatch into a MPSNDArray. @discussion This reverses exportDataWithCommandBuffer:toImages: function. @param cmdBuf The command buffer on which to encode the operation. @param images The source images. NOTE: you can use [images subarrayWithRange:...] to get a sub-batch of images. @param offset The offset to the image where to read - the size of the operation is defined by the destination array.
func (*MPSNDArray) InitWithBufferOffsetDescriptor ¶
func (o *MPSNDArray) InitWithBufferOffsetDescriptor(buffer metal.MTLBuffer, offset uint, descriptor *MPSNDArrayDescriptor) *MPSNDArray
func (*MPSNDArray) InitWithDeviceDescriptor ¶
func (o *MPSNDArray) InitWithDeviceDescriptor(device metal.MTLDevice, descriptor *MPSNDArrayDescriptor) *MPSNDArray
@abstract Initialize an MPSNDArrayDescriptor object on a device for given dimension sizes in descriptor. @param device The device on which the data type will be created. @param descriptor The MPSNDArrayDescriptor used for initializing the the NDArray @return A valid MPSNDArray object or nil, if failure.
func (*MPSNDArray) InitWithDeviceScalar ¶
func (o *MPSNDArray) InitWithDeviceScalar(device metal.MTLDevice, value float64) *MPSNDArray
@abstract Create a 1-Dimensional length=1 NDArray to hold a scalar
func (*MPSNDArray) Label ¶
func (o *MPSNDArray) Label() *foundation.NSString
@abstract A used specified string to help identify the array during debugging. @discussion May be externally visible to tools like Instruments
func (*MPSNDArray) LengthOfDimension ¶
func (o *MPSNDArray) LengthOfDimension(dimensionIndex uint) uint
@abstract The number of elements in the dimension at dimensionIndex @discussion The dimension length is at least as large as the existing slice length. Views of this MPSNDArray may have differing dimension lengths.
func (*MPSNDArray) NumberOfDimensions ¶
func (o *MPSNDArray) NumberOfDimensions() uint
@abstract Number of dimensions in the NDArray
func (*MPSNDArray) Parent ¶
func (o *MPSNDArray) Parent() *MPSNDArray
@abstract The parent MPSNDArray that this object aliases @discussion If the MPSNDArray was createrd as a array view of another MPSNDArray object, and aliases content in the same MTLBuffer, the original MPSNDArray will be retained as the parent here. Two MPSNDArrays alias if they share a common ancestor. Note that the parent may itself have a parent, and so forth.
func (*MPSNDArray) ReadBytesStrideBytes ¶
func (o *MPSNDArray) ReadBytesStrideBytes(buffer unsafe.Pointer, strideBytesPerDimension *int64)
@abstract Copy bytes from MPSNDArray into buffer @discussion The dimensionality and size of the copy region is given by the size of the MPSNDArray For subregions, use a MPSNDArray view. @param buffer A pointer to memory where to write the data @param strideBytesPerDimension An optional array of numberOfDimensions sizes, which gives the distance in bytes from one element to the next in that dimension in buffer. The first value is typically dataTypeSize. The next is a row bytes. The next is 2d matrix bytes, and so forth. If the value is nil, these are calculated for you assuming that the data is packed without additional space in between elements, rows, etc. 0 and negative values are permitted.
func (*MPSNDArray) ResourceSize ¶
func (o *MPSNDArray) ResourceSize() uint
@abstract Get the number of bytes used to allocate underyling MTLResources @discussion This is the size of the backing store of underlying MTLResources. It does not include all storage used by the object, for example the storage used to hold the MPSNDArray instantiation and MTLBuffer is not included. It only measures the size of the allocation used to hold the MPSNDArray data in the MTLBuffer. This value is subject to change between different devices and operating systems. Except when -initWithBuffer:descriptor: is used, most MPSNDArrays are allocated initiallly without a backing store. The backing store is allocated lazily when it is needed, typically when the MPSNDArray is written to the first time. Consequently, in most cases, it should be inexpensive to make a MPSImage to see how much memory it will need, and release it if it is too large.
func (*MPSNDArray) SetLabel ¶
func (o *MPSNDArray) SetLabel(label *foundation.NSString)
func (*MPSNDArray) SynchronizeOnCommandBuffer ¶
func (o *MPSNDArray) SynchronizeOnCommandBuffer(commandBuffer metal.MTLCommandBuffer)
@abstract Use a blit encoder if a discrete device to update CPU contents of underlying buffer with latest GPU value @param commandBuffer The commandBuffer on which we transfer the contents.
func (*MPSNDArray) UserBuffer ¶
func (o *MPSNDArray) UserBuffer() metal.MTLBuffer
@abstract Returns the user buffer in case the NDArray was initialized with an MTLBuffer. @return The user-provided MTLBuffer that was used to initialize this MPSNDArray or nil, in case it was not..
func (*MPSNDArray) WriteBytesStrideBytes ¶
func (o *MPSNDArray) WriteBytesStrideBytes(buffer unsafe.Pointer, strideBytesPerDimension *int64)
@abstract Copy bytes from a buffer into the MPSNDArray @discussion The dimensionality and size of the copy region is given by the size of the MPSNDArray For subregions, use a MPSNDArray view. @param buffer A pointer to memory where to read the data @param strideBytesPerDimension An optional array of numberOfDimensions sizes, which gives the distance in bytes from one element to the next in that dimension in buffer. The first value is typically dataTypeSize. The next is a row bytes. The next is 2d matrix bytes, and so forth. If strideBytesPerDimension is nil, these are calculated for you assuming that the data is packed without additional space in between elements, rows, etc. 0 and negative values are permitted.
type MPSNDArrayAllocator ¶
type MPSNDArrayAllocator interface {
foundation.NSSecureCoding
foundation.NSCopying
ArrayForCommandBufferArrayDescriptorKernel(cmdBuf metal.MTLCommandBuffer, descriptor *MPSNDArrayDescriptor, kernel *MPSKernel) *MPSNDArray
}
MPSNDArrayAllocator wraps the ObjC protocol MPSNDArrayAllocator.
func MPSNDArrayDefaultAllocator ¶
func MPSNDArrayDefaultAllocator() MPSNDArrayAllocator
Get a well known <MPSNDArrayAllocator> that makes standard MTLBuffers
func MPSTemporaryNDArrayDefaultAllocator ¶
func MPSTemporaryNDArrayDefaultAllocator() MPSNDArrayAllocator
Get a well known <MPSNDArrayAllocator> that makes temporary MTLBuffers
type MPSNDArrayDescriptor ¶
type MPSNDArrayDescriptor struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpsndarraydescriptor
func MPSNDArrayDescriptorDescriptorWithDataTypeDimensionCountDimensionSizes ¶
func MPSNDArrayDescriptorDescriptorWithDataTypeDimensionCountDimensionSizes(dataType MPSDataType, numberOfDimensions uint, dimensionSizes *uint) *MPSNDArrayDescriptor
@abstract Create an MPSNDArrayDescriptor object for a given size of dimensions. @discussion Sample code: @code // Creates an NDArrayDescriptor of dimensions [32, 6, 5, 3] NSUInteger sizes[] = {3,5,6,32}; [ MPSNDArray descriptorWithDataType: MPSDataTypeFloat32 dimensionCount: 4 dimensionSizes: sizes ]; // array of numberOfDimensions dimensions. Starts with dimension 0 @endcode @param dataType MPSDataType of elements in the MPSNDArray @param numberOfDimensions Number of dimensions in the NDArray. May not exceed 16. @param dimensionSizes An array of NSUIntegers where dimension lengths provided by the user goes from fastest moving to slowest moving dimension. The product of all dimension lengths must be less than 2**31. Additional system memory limits may apply @return A valid MPSNDArrayDescriptor object or nil, if failure.
func MPSNDArrayDescriptorDescriptorWithDataTypeShape ¶
func MPSNDArrayDescriptorDescriptorWithDataTypeShape(dataType MPSDataType, shape *foundation.NSArray[*foundation.NSNumber]) *MPSNDArrayDescriptor
@abstract A convenience function to create an MPSNDArrayDescriptor object for a given size of dimensions. @discussion Sample code: @code // Creates an NDArrayDescriptor of dimensions [32, 6, 5, 3] NSArray<NSNumber *> sizes = {@32,@6,@5,@3}; [ MPSNDArray descriptorWithDataType: MPSDataTypeFloat32 shape: &sizes]; @endcode @param dataType MPSDataType of elements in the MPSNDArray @param shape An array of NSUIntegers where dimension lengths provided by the user goes from slowest moving to fastest moving dimension. This is same order as MLMultiArray in coreML and most frameworks in Python The product of all dimension lengths must be less than 2**31. Additional system memory limits may apply @return A valid MPSNDArrayDescriptor object or nil, if failure.
func MPSNDArrayDescriptorFromID ¶
func MPSNDArrayDescriptorFromID(id objc.ID) *MPSNDArrayDescriptor
func (*MPSNDArrayDescriptor) DataType ¶
func (o *MPSNDArrayDescriptor) DataType() MPSDataType
@abstract Data Type of the MPSNDArray elements
func (*MPSNDArrayDescriptor) DimensionOrder ¶
func (o *MPSNDArrayDescriptor) DimensionOrder() unsafe.Pointer
@abstract The new ordering of dimensions @discussion If a transpose is applied, it will change the order of dimensions in the MPSNDArray. The default ordering is {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}. After a transpose of dimensions 0 and 1, it will be: {1,0,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
func (*MPSNDArrayDescriptor) GetShape ¶
func (o *MPSNDArrayDescriptor) GetShape() *foundation.NSArray[*foundation.NSNumber]
@abstract Returns the shape of the NDArray as MPSShape @discussion The length of the array is the number of dimensions and the size of the fastest running dimension is the last element in the array.
func (*MPSNDArrayDescriptor) LengthOfDimension ¶
func (o *MPSNDArrayDescriptor) LengthOfDimension(dimensionIndex uint) uint
@abstract The number of elements of type dataType in the indicated dimension. @discussion If dimensionIndex >= numberOfDimensions, 1 will be returned. @param dimensionIndex dimension the MPSNDArray for which to return the length @return The number of elements in that dimension.
func (*MPSNDArrayDescriptor) NumberOfDimensions ¶
func (o *MPSNDArrayDescriptor) NumberOfDimensions() uint
@abstract The number of dimensions in the NDArray. @discussion May not exceed 16. A 0-diumension MPSNDArray is a single scalar value. Undefined dimensions are implicitly length 1.
func (*MPSNDArrayDescriptor) PermuteWithDimensionOrder ¶
func (o *MPSNDArrayDescriptor) PermuteWithDimensionOrder(dimensionOrder *uint)
@abstract Permutes the dimensions of the current descriptor @param dimensionOrder A permutation of the dimensions of the NDArray. dimensionOrder[i] must contain the new postion of dimenson i. Size of the array must be equal to the original number of dimensions in the descriptor. Must have all the indices in [0, numberOfDimensions) present uniquely. @discussion This permutation is applied on top of whatever transpostions/permutations that may have been performed on the descriptor before.
func (*MPSNDArrayDescriptor) PreferPackedRows ¶
func (o *MPSNDArrayDescriptor) PreferPackedRows() bool
@property preferPackedRows @abstract If YES, then new NDArrays created with this descriptor will pack the rows. Default: NO.
func (*MPSNDArrayDescriptor) ReshapeWithDimensionCountDimensionSizes ¶
func (o *MPSNDArrayDescriptor) ReshapeWithDimensionCountDimensionSizes(numberOfDimensions uint, dimensionSizes *uint)
@abstract Changes dimension sizes and number of dimensions on the current descriptor @param numberOfDimensions Number of dimensions in the NDArray. May not exceed 16. @param dimensionSizes An array of NSUIntegers where dimension lengths provided by the user goes from fastest moving to slowest moving dimension. The product of all dimension lengths must be less than 2**31. Additional system memory limits may apply
func (*MPSNDArrayDescriptor) ReshapeWithShape ¶
func (o *MPSNDArrayDescriptor) ReshapeWithShape(shape *foundation.NSArray[*foundation.NSNumber])
@abstract Changes dimension sizes and number of dimensions on the current descriptor @param shape An array of NSUIntegers where dimension lengths provided by the user goes from slowest moving to fastest moving dimension. This is same order as MLMultiArray in coreML and most frameworks in Python The product of all dimension lengths must be less than 2**31. Additional system memory limits may apply
func (*MPSNDArrayDescriptor) SetDataType ¶
func (o *MPSNDArrayDescriptor) SetDataType(dataType MPSDataType)
func (*MPSNDArrayDescriptor) SetNumberOfDimensions ¶
func (o *MPSNDArrayDescriptor) SetNumberOfDimensions(numberOfDimensions uint)
func (*MPSNDArrayDescriptor) SetPreferPackedRows ¶
func (o *MPSNDArrayDescriptor) SetPreferPackedRows(preferPackedRows bool)
@property preferPackedRows @abstract If YES, then new NDArrays created with this descriptor will pack the rows. Default: NO.
func (*MPSNDArrayDescriptor) SliceDimensionWithSubrange ¶
func (o *MPSNDArrayDescriptor) SliceDimensionWithSubrange(dimensionIndex uint, subRange MPSDimensionSlice)
@abstract The slice dimensions for each dimension @discusion A slice is a subregion of a dimension. It is used to calve off a fraction of a larger NDArray. Default: NSRange(0, lengthOfDimension(i)) @param subRange The region of the slice, start value is wrt dimensionLength of the NDArray. @param dimensionIndex The index of the dimension. Must be < numberOfDimensions
func (*MPSNDArrayDescriptor) SliceRangeForDimension ¶
func (o *MPSNDArrayDescriptor) SliceRangeForDimension(dimensionIndex uint) MPSDimensionSlice
@abstract The slice dimensions for each dimension @discusion A slice is a subregion of a dimension. It is used to calve off a fraction of a larger NDArray. @param dimensionIndex The index of the dimension @return Returns the slice range for the index. If the dimensionIndex >= numberOfDimensions, {0,1} is returned.
func (*MPSNDArrayDescriptor) TransposeDimensionWithDimension ¶
func (o *MPSNDArrayDescriptor) TransposeDimensionWithDimension(dimensionIndex uint, dimensionIndex2 uint)
@abstract transpose two dimensions @discusion If the intention is to insert a length 1 dimension, increment the numberOfDimensions first. @param dimensionIndex The first dimension. Must be < numberOfDimensions @param dimensionIndex2 The second dimension. Must be < number of Dimensions.
type MPSOffset ¶
@struct MPSOffset @memberof MPSKernel @abstract A signed coordinate with x, y and z components
type MPSPredicate ¶
type MPSPredicate struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpspredicate
func MPSPredicateFromID ¶
func MPSPredicateFromID(id objc.ID) *MPSPredicate
func MPSPredicatePredicateWithBufferOffset ¶
func MPSPredicatePredicateWithBufferOffset(buffer metal.MTLBuffer, offset uint) *MPSPredicate
@abstract Initializes a MPSPredicate object with a buffer and given offset. @param buffer The buffer to use as a predicate. @param offset Byteoffset to the predicate buffer where the predicate is stored. @result A pointer to the newly initialized MPSPredicate object.
func (*MPSPredicate) InitWithBufferOffset ¶
func (o *MPSPredicate) InitWithBufferOffset(buffer metal.MTLBuffer, offset uint) *MPSPredicate
@abstract Initializes a MPSPredicate object with a buffer and given offset. @param buffer The buffer to use as a predicate. @param offset Byteoffset to the predicate buffer where the predicate is stored. @result A pointer to the newly initialized MPSPredicate object.
func (*MPSPredicate) InitWithDevice ¶
func (o *MPSPredicate) InitWithDevice(device metal.MTLDevice) *MPSPredicate
@abstract Initializes a MPSPredicate object for a given device. @discussion NOTE: The metal buffer used by the resulting MPSPredicate object may be shared among many MPSPredicate objects and therefore care must be used when writing to this buffer: writing to any other location in this buffer than the four bytes at the offset @ref predicateOffset results in undefined behavior. @param device The device the predicate is used with @result A pointer to the newly initialized MPSPredicate object.
func (*MPSPredicate) PredicateBuffer ¶
func (o *MPSPredicate) PredicateBuffer() metal.MTLBuffer
@property predicateBuffer @abstract The buffer that is used as the predicate
func (*MPSPredicate) PredicateOffset ¶
func (o *MPSPredicate) PredicateOffset() uint
@property predicateOffset @abstract Location of the predicate in bytes, must be multiple of four. @discussion If the uint32_t value stored at this location in @ref predicateBuffer is other than zero, then the predicate is considered to be true and the code is executed on the GPU. With this property a single MPSPredicate object can be used with multiple different predication operations. Default = 0;
type MPSPurgeableState ¶
type MPSPurgeableState uint64
const ( MPSPurgeableStateAllocationDeferred MPSPurgeableState = 0 MPSPurgeableStateKeepCurrent MPSPurgeableState = 1 MPSPurgeableStateNonVolatile MPSPurgeableState = 2 MPSPurgeableStateVolatile MPSPurgeableState = 3 MPSPurgeableStateEmpty MPSPurgeableState = 4 )
func (MPSPurgeableState) String ¶
func (e MPSPurgeableState) String() string
type MPSScaleTransform ¶
type MPSScaleTransform struct {
ScaleX float64
ScaleY float64
TranslateX float64
TranslateY float64
}
@struct MPSScaleTransform @abstract Transform matrix for explict control over resampling in MPSImageScale. @discussion The MPSScaleTransform is equivalent to: @code (CGAffineTransform) { .a = scaleX, .b = 0, .c = 0, .d = scaleY, .tx = translateX, .ty = translateY } @endcode @memberof MPSImageScale
type MPSState ¶
type MPSState struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpsstate
func MPSStateFromID ¶
func MPSStateTemporaryStateWithCommandBuffer ¶
func MPSStateTemporaryStateWithCommandBuffer(cmdBuf metal.MTLCommandBuffer) *MPSState
@abstract Create a new autoreleased temporary state object without underlying resource @param cmdBuf The command buffer with which the temporary resource is associated
func MPSStateTemporaryStateWithCommandBufferBufferSize ¶
func MPSStateTemporaryStateWithCommandBufferBufferSize(cmdBuf metal.MTLCommandBuffer, bufferSize uint) *MPSState
@abstract Create a MPSState holding a temporary MTLBuffer @param cmdBuf The command buffer against which the temporary resource is allocated @param bufferSize The size of the buffer in bytes
func MPSStateTemporaryStateWithCommandBufferResourceList ¶
func MPSStateTemporaryStateWithCommandBufferResourceList(commandBuffer metal.MTLCommandBuffer, resourceList *MPSStateResourceList) *MPSState
@abstract Initialize a temporary state to hold a number of textures and buffers @discussion The textures occur first in sequence
func MPSStateTemporaryStateWithCommandBufferTextureDescriptor ¶
func MPSStateTemporaryStateWithCommandBufferTextureDescriptor(cmdBuf metal.MTLCommandBuffer, descriptor *metal.MTLTextureDescriptor) *MPSState
@abstract Create a MPSState holding a temporary MTLTexture @param cmdBuf The command buffer against which the temporary resource is allocated @param descriptor A descriptor for the new temporary texture
func (*MPSState) BufferSizeAtIndex ¶
@abstract Return the buffer size of the MTLBuffer at index or 0 if it is not a MTLBuffer @discussion Does not force allocation of the MTLResource
func (*MPSState) DestinationImageDescriptorForSourceImagesSourceStatesForKernelSuggestedDescriptor ¶
func (o *MPSState) DestinationImageDescriptorForSourceImagesSourceStatesForKernelSuggestedDescriptor(sourceImages *foundation.NSArray[*MPSImage], sourceStates *foundation.NSArray[*MPSState], kernel *MPSKernel, inDescriptor *MPSImageDescriptor) *MPSImageDescriptor
@abstract Determine padding and sizing of result images @discussion A MPSState has the opportunity to reconfigure the MPSImageDescriptor used to create the filter result state and set the MPSKernel.offset to the correct value. By default, the MPSState does not modify the descriptor. There is a order of operations defined for who may update the descriptor: 1) Default padding code runs based on the MPSNNPaddingMethod in the MPSCNNKernel.padding. This creates the descriptor and picks a starting value for the MPSCNNKernel.offset. 2) MPSStates are called in order to apply this function and update the offset. 3) The MPSNNPadding custom padding method of the same name is called. 4) Some code that may prove helpful: @code const int centeringPolicy = 0; // When kernelSize is even: 0 pad bottom right. 1 pad top left. Centers the kernel for even sized kernels. typedef enum Style{ StyleValidOnly = -1, StyleSame = 0, StyleFull = 1 }Style; // Typical destination size in one dimension for forward filters (most filters) static int DestSize( int sourceSize, int stride, int filterWindowSize, Style style ){ sourceSize += style * (filterWindowSize - 1); // adjust how many pixels we are allowed to read return (sourceSize + stride - 1) / stride; // sourceSize / stride, round up } // Typical destination size in one dimension for reverse filters (e.g. convolution transpose) static int DestSizeReverse( int sourceSize, int stride, int filterWindowSize, Style style ){ return (sourceSize-1) * stride + // center tap for the last N-1 results. Take stride into account 1 + // center tap for the first result style * (filterWindowSize-1); // add or subtract (or ignore) the filter extent } // Find the MPSOffset in one dimension static int Offset( int sourceSize, int stride, int filterWindowSize, Style style ){ // The correction needed to adjust from position of left edge to center per MPSOffset definition int correction = filterWindowSize / 2; // exit if all we want is to start consuming pixels at the left edge of the image. if( 0 ) return correction; // Center the area consumed in the source image: // Calculate the size of the destination image int destSize = DestSize( sourceSize, stride, filterWindowSize, style ); // use DestSizeReverse here instead as appropriate // calculate extent of pixels we need to read in source to populate the destination int readSize = (destSize-1) * stride + filterWindowSize; // calculate number of missing pixels in source int extraSize = readSize - sourceSize; // number of missing pixels on left side int leftExtraPixels = (extraSize + centeringPolicy) / 2; // account for the fact that the offset is based on the center pixel, not the left edge return correction - leftExtraPixels; } @endcode @param sourceImages The list of source images to be used @param sourceStates The list of source states to be used @param kernel The MPSKernel the padding method will be applied to. Set the kernel.offset @param inDescriptor MPS will prepare a starting guess based on the padding policy (exclusive of MPSNNPaddingMethodCustom) set for the object. You should adjust the offset and image size accordingly. It is on an autoreleasepool. @return The MPSImageDescriptor to use to make a MPSImage to capture the results from the filter. The MPSImageDescriptor is assumed to be on an autoreleasepool. Your method must also set the kernel.offset property.
func (*MPSState) InitWithDeviceBufferSize ¶
func (*MPSState) InitWithDeviceResourceList ¶
func (o *MPSState) InitWithDeviceResourceList(device metal.MTLDevice, resourceList *MPSStateResourceList) *MPSState
@abstract Initialize a non-temporary state to hold a number of textures and buffers @discussion The allocation of each resource will be deferred until it is needed. This occurs when -resource or -resourceAtIndex: is called. @param resourceList The list of resources to create.
func (*MPSState) InitWithDeviceTextureDescriptor ¶
func (*MPSState) InitWithResource ¶
func (o *MPSState) InitWithResource(resource metal.MTLResource) *MPSState
@abstract Create a MPSState with a non-temporary MTLResource @param resource A MTLBuffer or MTLTexture. May be nil.
func (*MPSState) InitWithResources ¶
func (o *MPSState) InitWithResources(resources *foundation.NSArray[metal.MTLResource]) *MPSState
@abstract Create a state object with a list of MTLResources @discussion Because MPS prefers deferred allocation of resources your application should use -initWithTextures:bufferSizes:bufferCount: whenever possible. This method is useful for cases when the MTLResources must be initialized by the CPU.
func (*MPSState) IsTemporary ¶
func (*MPSState) Label ¶
func (o *MPSState) Label() *foundation.NSString
@property label @abstract A string to help identify this object.
func (*MPSState) Resource ¶
@abstract Get the private MTLResource underlying the MPSState @discussion When the state is not directly initialized with a MTLResource, the actuall MTLResource creation is deferred. Especially with temporary resources, it is important to delay this creation as late as possible to avoid increasing the memory footprint. The memory is returned for reuse when the readCount = 0. Calling the -resource method will force the resource to be allocated, so you should not use it lightly, for purposes such as finding the MTLPixelFormat of a texture in the state. By convention, except where otherwise documented, the MTLResources held by the MPSState are private to the MPSState object, owned by the MPSState subclass author. If the MPSState subclass author is MPS, then the identity (e.g. texture vs. buffer) and information contained in the resource should be considered implementation dependent. It may change by operating system version or device. If you are the author of the subclass then it is for your own use, and MPS will not look at it, except perhaps so as to pass it to a custom kernel. Otherwise, the method is made available to facilitate debugging and to allow you to write your own state objects.
func (*MPSState) ResourceAtIndexAllocateMemory ¶
func (o *MPSState) ResourceAtIndexAllocateMemory(index uint, allocateMemory bool) metal.MTLResource
@abstract Get the MTLResource at the indicated index @discussion By convention, except where otherwise documented, the MTLResources held by the MPSState are private to the MPSState object, owned by the MPSState subclass author. If the MPSState subclass author is MPS, then the identity (e.g. texture vs. buffer) and information contained in the resource should be considered implementation dependent. It may change by operating system version or device. If you are the author of the subclass then it is for your own use, and MPS will not look at it, except perhaps so as to pass it to a custom kernel. Otherwise, the method is made available to facilitate debugging and to allow you to write your own state objects. Provide accessors to read this information in a defined format. @param index The index of the MTLResource to retrieve @param allocateMemory It is very important to avoid allocating memory to hold MTLResources until it is absolutely necessary, especially when working with temporary MPSStates. When allocateMemory is set to NO and the resource has not yet been allocated, nil will be returned instead. If you just need information about the resource such as buffer size or MTLTexture properties, but not the resource itself, please use -bufferSizeAtIndex: or -textureInfoAtIndex: instead, as these will not force the creation of the MTLResource.
func (*MPSState) ResourceCount ¶
@abstract Return the number of MTLResource objects held by the state
func (*MPSState) ResourceSize ¶
@abstract Get the number of bytes used to allocate underyling MTLResources @discussion This is the size of the backing store of underlying MTLResources. It does not include all storage used by the object, for example the storage used to hold the MPSState instantiation and MTLTexture or MTLBuffer is not included. It only measures the size of the allocation used to hold the texels in the texture or bytes in the buffer. This value is subject to change between different devices and operating systems. Except when -initWithResource: is used, most MPSStates are allocated without a backing store. The backing store is allocated lazily when it is needed, typically when the .texture property is called. Consequently, in most cases, it should be inexpensive to make a MPSImage to see how much memory it will need, and release it if it is too large. This method may fail in certain circumstances, such as when the MPSImage is created with -initWithTexture:featureChannels:, in which case 0 will be returned.
func (*MPSState) ResourceTypeAtIndex ¶
func (o *MPSState) ResourceTypeAtIndex(index uint) MPSStateResourceType
@abstract Return YES if the resource at index is a buffer @discussion Does not force allocation of the MTLResource
func (*MPSState) SetLabel ¶
func (o *MPSState) SetLabel(label *foundation.NSString)
func (*MPSState) SetReadCount ¶
func (*MPSState) SynchronizeOnCommandBuffer ¶
func (o *MPSState) SynchronizeOnCommandBuffer(commandBuffer metal.MTLCommandBuffer)
@abstract Flush any copy of MTLResources held by the state from the device's caches, and invalidate any CPU caches if needed. @discussion This will call [id <MTLBlitEncoder> synchronizeResource: ] on the state's MTLResources. This is necessary for all MTLStorageModeManaged resources. For other resources, including temporary resources (these are all MTLStorageModePrivate), nothing is done. @param commandBuffer The commandbuffer on which to synchronize
func (*MPSState) TextureInfoAtIndex ¶
func (o *MPSState) TextureInfoAtIndex(index uint) MPSStateTextureInfo
@abstract Return the texture size {width,height,depth} or {0,0,0} if it is not a MTLTexture @discussion Does not force allocation of the MTLResource
type MPSStateResourceList ¶
type MPSStateResourceList struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpsstateresourcelist
func MPSStateResourceListFromID ¶
func MPSStateResourceListFromID(id objc.ID) *MPSStateResourceList
func MPSStateResourceListResourceList ¶
func MPSStateResourceListResourceList() *MPSStateResourceList
@abstract Init an empty autoreleased resource list
func (*MPSStateResourceList) AppendBuffer ¶
func (o *MPSStateResourceList) AppendBuffer(size uint)
@abstract append a buffer to the resource list
func (*MPSStateResourceList) AppendTexture ¶
func (o *MPSStateResourceList) AppendTexture(descriptor *metal.MTLTextureDescriptor)
@abstract append a texture to the resource list
func (*MPSStateResourceList) Init ¶
func (o *MPSStateResourceList) Init() *MPSStateResourceList
@abstract Init an empty list
type MPSStateResourceType ¶
type MPSStateResourceType uint64
const ( MPSStateResourceTypeNone MPSStateResourceType = 0 MPSStateResourceTypeBuffer MPSStateResourceType = 1 MPSStateResourceTypeTexture MPSStateResourceType = 2 )
func (MPSStateResourceType) String ¶
func (e MPSStateResourceType) String() string
type MPSStateTextureInfo ¶
type MPSStateTextureInfo struct {
Width uint
Height uint
Depth uint
ArrayLength uint
PixelFormat metal.MTLPixelFormat
TextureType metal.MTLTextureType
Usage metal.MTLTextureUsage
}
type MPSTemporaryImage ¶
type MPSTemporaryImage struct {
MPSImage
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpstemporaryimage
func MPSTemporaryImageFromID ¶
func MPSTemporaryImageFromID(id objc.ID) *MPSTemporaryImage
func MPSTemporaryImageTemporaryImageWithCommandBufferImageDescriptor ¶
func MPSTemporaryImageTemporaryImageWithCommandBufferImageDescriptor(commandBuffer metal.MTLCommandBuffer, imageDescriptor *MPSImageDescriptor) *MPSTemporaryImage
@abstract Initialize a MPSTemporaryImage for use on a MTLCommandBuffer @param commandBuffer The MTLCommandBuffer on which the MPSTemporaryImage will be exclusively used @param imageDescriptor A valid imageDescriptor describing the MPSImage format to create. @return A valid MPSTemporaryImage. The object will be released when the command buffer is committed. The underlying texture will become invalid before this time due to the action of the readCount property.
func MPSTemporaryImageTemporaryImageWithCommandBufferTextureDescriptor ¶
func MPSTemporaryImageTemporaryImageWithCommandBufferTextureDescriptor(commandBuffer metal.MTLCommandBuffer, textureDescriptor *metal.MTLTextureDescriptor) *MPSTemporaryImage
@abstract Low level interface for creating a MPSTemporaryImage using a MTLTextureDescriptor @discussion This function provides access to MTLPixelFormats not typically covered by -initForCommandBuffer:imageDescriptor: The feature channels will be inferred from the MTLPixelFormat without changing the width. The following restrictions apply: MTLTextureType must be MTLTextureType2D or MTLTextureType2DArray MTLTextureUsage must contain at least one of MTLTextureUsageShaderRead, MTLTextureUsageShaderWrite MTLStorageMode must be MTLStorageModePrivate depth must be 1 @param commandBuffer The command buffer on which the MPSTemporaryImage may be used @param textureDescriptor A texture descriptor describing the MPSTemporaryImage texture @return A valid MPSTemporaryImage. The object will be released when the command buffer is committed. The underlying texture will become invalid before this time due to the action of the readCount property.
func MPSTemporaryImageTemporaryImageWithCommandBufferTextureDescriptorFeatureChannels ¶
func MPSTemporaryImageTemporaryImageWithCommandBufferTextureDescriptorFeatureChannels(commandBuffer metal.MTLCommandBuffer, textureDescriptor *metal.MTLTextureDescriptor, featureChannels uint) *MPSTemporaryImage
@abstract Low level interface for creating a MPSTemporaryImage using a MTLTextureDescriptor @discussion This function provides access to MTLPixelFormats not typically covered by -initForCommandBuffer:imageDescriptor: The number of images will be inferred from number of slices in the descriptor.arrayLength and the number of feature channels. The following restrictions apply: MTLTextureType must be MTLTextureType2D or MTLTextureType2DArray MTLTextureUsage must contain at least one of MTLTextureUsageShaderRead, MTLTextureUsageShaderWrite MTLStorageMode must be MTLStorageModePrivate @param commandBuffer The command buffer on which the MPSTemporaryImage may be used @param textureDescriptor A texture descriptor describing the MPSTemporaryImage texture @return A valid MPSTemporaryImage. The object will be released when the command buffer is committed. The underlying texture will become invalid before this time due to the action of the readCount property.
func (*MPSTemporaryImage) ReadCount ¶
func (o *MPSTemporaryImage) ReadCount() uint
func (*MPSTemporaryImage) SetReadCount ¶
func (o *MPSTemporaryImage) SetReadCount(readCount uint)
type MPSTemporaryMatrix ¶
type MPSTemporaryMatrix struct {
MPSMatrix
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpstemporarymatrix
func MPSTemporaryMatrixFromID ¶
func MPSTemporaryMatrixFromID(id objc.ID) *MPSTemporaryMatrix
func MPSTemporaryMatrixTemporaryMatrixWithCommandBufferMatrixDescriptor ¶
func MPSTemporaryMatrixTemporaryMatrixWithCommandBufferMatrixDescriptor(commandBuffer metal.MTLCommandBuffer, matrixDescriptor *MPSMatrixDescriptor) *MPSTemporaryMatrix
@abstract Initialize a MPSTemporaryMatrix for use on a MTLCommandBuffer @param commandBuffer The MTLCommandBuffer on which the MPSTemporaryMatrix will be exclusively used @param matrixDescriptor A valid MPSMatrixDescriptor describing the MPSMatrix format to create @return A valid MPSTemporaryMatrix. The object is not managed by a NSAutoreleasePool. The object will be released when the command buffer is committed. The underlying buffer will become invalid before this time due to the action of the readCount property. Please read and understand the use of the readCount property before using this object.
func (*MPSTemporaryMatrix) ReadCount ¶
func (o *MPSTemporaryMatrix) ReadCount() uint
@abstract The number of times a temporary matrix may be read by a MPSMatrix... kernel before its contents become undefined. @discussion MPSTemporaryMatrices must release their underlying buffers for reuse immediately after last use. So as to facilitate *prompt* convenient memory recycling, each time a MPSTemporaryMatrix is read by a MPSMatrix... -encode... method, its readCount is automatically decremented. When the readCount reaches 0, the underlying buffer is automatically made available for reuse to MPS for its own needs and for other MPSTemporaryMatrices prior to return from the -encode.. function. The contents of the buffer become undefined at this time. By default, the readCount is initialized to 1, indicating a matrix that may be overwritten any number of times, but read only once. You may change the readCount as desired to allow MPSMatrixKernels to read the MPSTemporaryMatrix additional times. However, it is an error to change the readCount once it is zero. It is an error to read or write to a MPSTemporaryMatrix with a zero readCount. You may set the readCount to 0 yourself to cause the underlying buffer to be returned to MPS. Writing to a MPSTemporaryMatrix does not adjust the readCount. The Metal API Validation layer will assert if a MPSTemporaryMatrix is deallocated with non-zero readCount to help identify cases when resources are not returned promptly.
func (*MPSTemporaryMatrix) SetReadCount ¶
func (o *MPSTemporaryMatrix) SetReadCount(readCount uint)
type MPSTemporaryNDArray ¶
type MPSTemporaryNDArray struct {
MPSNDArray
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpstemporaryndarray
func MPSTemporaryNDArrayFromID ¶
func MPSTemporaryNDArrayFromID(id objc.ID) *MPSTemporaryNDArray
func MPSTemporaryNDArrayTemporaryNDArrayWithCommandBufferDescriptor ¶
func MPSTemporaryNDArrayTemporaryNDArrayWithCommandBufferDescriptor(commandBuffer metal.MTLCommandBuffer, descriptor *MPSNDArrayDescriptor) *MPSTemporaryNDArray
@abstract Initialize a MPSTemporaryNDArray for use on a MTLCommandBuffer @param commandBuffer The MTLCommandBuffer on which the MPSTemporaryNDArray will be exclusively used @param descriptor A valid MPSNDArrayDescriptor describing the MPSNDArray format to create @return A valid MPSTemporaryNDArray. The object is not managed by a NSAutoreleasePool. The object will be released when the command buffer is committed. The underlying buffer will become invalid before this time due to the action of the readCount property. Please read and understand the use of the readCount property before using this object.
func (*MPSTemporaryNDArray) ReadCount ¶
func (o *MPSTemporaryNDArray) ReadCount() uint
@abstract The number of times a temporary MPSNDArray may be read by a MPSNDArray... kernel before its contents become undefined. @discussion MPSTemporaryNDArrays must release their underlying buffers for reuse immediately after last use. So as to facilitate *prompt* convenient memory recycling, each time a MPSTemporaryNDArray is read by a MPSNDArray... -encode... method, its readCount is automatically decremented. When the readCount reaches 0, the underlying buffer is automatically made available for reuse to MPS for its own needs and for other MPSTemporaryNDArrays prior to return from the -encode.. function. The contents of the buffer become undefined at this time. By default, the readCount is initialized to 1, indicating a MPSNDArray that may be overwritten any number of times, but read only once. You may change the readCount as desired to allow MPSNDArrayKernels to read the MPSTemporaryNDArray additional times. However, it is an error to change the readCount once it is zero. It is an error to read or write to a MPSTemporaryNDArray with a zero readCount. You may set the readCount to 0 yourself to cause the underlying buffer to be returned to MPS. Writing to a MPSTemporaryNDArray does not adjust the readCount. The Metal API Validation layer will assert if a MPSTemporaryNDArray is deallocated with non-zero readCount to help identify cases when resources are not returned promptly.
func (*MPSTemporaryNDArray) SetReadCount ¶
func (o *MPSTemporaryNDArray) SetReadCount(readCount uint)
type MPSTemporaryVector ¶
type MPSTemporaryVector struct {
MPSVector
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpstemporaryvector
func MPSTemporaryVectorFromID ¶
func MPSTemporaryVectorFromID(id objc.ID) *MPSTemporaryVector
func MPSTemporaryVectorTemporaryVectorWithCommandBufferDescriptor ¶
func MPSTemporaryVectorTemporaryVectorWithCommandBufferDescriptor(commandBuffer metal.MTLCommandBuffer, descriptor *MPSVectorDescriptor) *MPSTemporaryVector
@abstract Initialize a MPSTemporaryVector for use on a MTLCommandBuffer @param commandBuffer The MTLCommandBuffer on which the MPSTemporaryMatrix will be exclusively used @param descriptor A valid MPSVectorDescriptor describing the MPSVector format to create @return A valid MPSTemporaryVector. The object is not managed by a NSAutoreleasePool. The object will be released when the command buffer is committed. The underlying buffer will become invalid before this time due to the action of the readCount property. Please read and understand the use of the readCount property before using this object.
func (*MPSTemporaryVector) ReadCount ¶
func (o *MPSTemporaryVector) ReadCount() uint
@abstract The number of times a temporary vector may be read by a MPSMatrix... kernel before its contents become undefined. @discussion MPSTemporaryVector objects must release their underlying buffers for reuse immediately after last use. So as to facilitate *prompt* convenient memory recycling, each time a MPSTemporaryVector is read by a MPSMatrix... -encode... method, its readCount is automatically decremented. When the readCount reaches 0, the underlying buffer is automatically made available for reuse to MPS for its own needs and for other MPSTemporaryVector objects prior to return from the -encode.. function. The contents of the buffer become undefined at this time. By default, the readCount is initialized to 1, indicating a matrix that may be overwritten any number of times, but read only once. You may change the readCount as desired to allow MPSMatrix kernels to read the MPSTemporaryVector additional times. However, it is an error to change the readCount once it is zero. It is an error to read or write to a MPSTemporaryVector with a zero readCount. You may set the readCount to 0 yourself to cause the underlying buffer to be returned to MPS. Writing to a MPSTemporaryVector does not adjust the readCount. The Metal API Validation layer will assert if a MPSTemporaryVector is deallocated with non-zero readCount to help identify cases when resources are not returned promptly.
func (*MPSTemporaryVector) SetReadCount ¶
func (o *MPSTemporaryVector) SetReadCount(readCount uint)
type MPSVector ¶
type MPSVector struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpsvector
func MPSVectorFromID ¶
func (*MPSVector) DataType ¶
func (o *MPSVector) DataType() MPSDataType
@property dataType @discussion The type of the MPSVector data.
func (*MPSVector) Device ¶
@property device @discussion The device on which the MPSVector will be used.
func (*MPSVector) InitWithBufferDescriptor ¶
func (o *MPSVector) InitWithBufferDescriptor(buffer metal.MTLBuffer, descriptor *MPSVectorDescriptor) *MPSVector
@abstract Initialize a MPSVector object with a MTLBuffer. @param buffer The MTLBuffer object which contains the data to use for the MPSVector. May not be NULL. @param descriptor The MPSVectorDescriptor. May not be NULL. @return A valid MPSVector object or nil, if failure. @discussion This function returns a MPSVector object which uses the supplied MTLBuffer. The length, number of vectors, and stride between vectors are specified by the MPSVectorDescriptor object. The provided MTLBuffer must have enough storage to hold (descriptor.vectors-1) * descriptor.vectorBytes + descriptor.length * (element size) bytes.
func (*MPSVector) InitWithBufferOffsetDescriptor ¶
func (o *MPSVector) InitWithBufferOffsetDescriptor(buffer metal.MTLBuffer, offset uint, descriptor *MPSVectorDescriptor) *MPSVector
@abstract Initialize a MPSVector object with a MTLBuffer and an offset. @param buffer The MTLBuffer containing the data. @param offset The offset, in bytes, into the buffer at which data begins. @param descriptor The MPSVectorDescriptor.
func (*MPSVector) InitWithDeviceDescriptor ¶
func (o *MPSVector) InitWithDeviceDescriptor(device metal.MTLDevice, descriptor *MPSVectorDescriptor) *MPSVector
@abstract Initialize a lazily backed MPSVector object with a descriptor @param device The device with which it will be used @param descriptor The shape and style of the matrix @return A valid MPSVector object or nil @discussion The vector object will be created, but the storage to hold the vector data will only be allocated when it is needed, typically when the data property is invoked. In conjunction with -resourceSize, this will allow you to estimate storage needs without actually creating the backing store for the vector.
func (*MPSVector) Offset ¶
@property offset @discussion Byte-offset to the buffer where the vector data begins - see @ref initWithBuffer: offset: descriptor: .
func (*MPSVector) ResourceSize ¶
@abstract Get the number of bytes used to allocate underyling MTLResources @discussion This is the size of the backing store of underlying MTLResources. It does not include all storage used by the object, for example the storage used to hold the MPSVector instantiation and MTLBuffer is not included. It only measures the size of the allocation used to hold the vector data in the buffer. This value is subject to change between different devices and operating systems. Except when -initWithBuffer:descriptor: is used, most MPSVectors are allocated without a backing store. The backing store is allocated lazily when it is needed, typically when the .texture property is called. Consequently, in most cases, it should be inexpensive to make a MPSMatrix to see how much memory it will need, and release it if it is too large. This method may fail in certain circumstances, such as when the MPSMatrix is created with -initWithBuffer:descriptor:. In such cases, 0 will be returned.
func (*MPSVector) SynchronizeOnCommandBuffer ¶
func (o *MPSVector) SynchronizeOnCommandBuffer(commandBuffer metal.MTLCommandBuffer)
@abstract Flush the underlying MTLBuffer from the device's caches, and invalidate any CPU caches if needed. @discussion This will call [id <MTLBlitEncoder> synchronizeResource: ] on the vector's MTLBuffer, if any. This is necessary for all MTLStorageModeManaged resources. For other resources, including temporary resources (these are all MTLStorageModePrivate), and buffers that have not yet been allocated, nothing is done. It is more efficient to use this method than to attempt to do this yourself with the data property. @param commandBuffer The commandbuffer on which to synchronize
func (*MPSVector) VectorBytes ¶
@property vectorBytes @discussion The stride, in bytes, between corresponding elements of consecutive vectors.
type MPSVectorDescriptor ¶
type MPSVectorDescriptor struct {
foundation.NSObject
}
Apple documentation: https://developer.apple.com/documentation/mpscore/mpsvectordescriptor
func MPSVectorDescriptorFromID ¶
func MPSVectorDescriptorFromID(id objc.ID) *MPSVectorDescriptor
func MPSVectorDescriptorVectorDescriptorWithLengthDataType ¶
func MPSVectorDescriptorVectorDescriptorWithLengthDataType(length uint, dataType MPSDataType) *MPSVectorDescriptor
@abstract Create a MPSVectorDescriptor with the specified length and data type. @param length The number of elements in a single vector. @param dataType The type of the data to be stored in the vector. @discussion Use this function for creating a descriptor of a MPSVector object containing a single vector.
func MPSVectorDescriptorVectorDescriptorWithLengthVectorsVectorBytesDataType ¶
func MPSVectorDescriptorVectorDescriptorWithLengthVectorsVectorBytesDataType(length uint, vectors uint, vectorBytes uint, dataType MPSDataType) *MPSVectorDescriptor
@abstract Create a MPSVectorDescriptor with the specified length and data type. @param length The number of elements in a single vector. @param vectors The number of vectors in the MPSVector object. @param vectorBytes The number of bytes between starting elements of consecutive vectors. @param dataType The type of the data to be stored in the vector. @discussion For performance considerations the optimal stride between vectors may not necessarily be equal to the vector length. The MPSVectorDescriptor class provides a method which may be used to determine this value, see the vectorBytesForLength API.
func (*MPSVectorDescriptor) DataType ¶
func (o *MPSVectorDescriptor) DataType() MPSDataType
@property dataType @discussion The type of the data which makes up the values of the vector.
func (*MPSVectorDescriptor) Length ¶
func (o *MPSVectorDescriptor) Length() uint
@property length @discussion The number of elements in the vector.
func (*MPSVectorDescriptor) SetDataType ¶
func (o *MPSVectorDescriptor) SetDataType(dataType MPSDataType)
func (*MPSVectorDescriptor) SetLength ¶
func (o *MPSVectorDescriptor) SetLength(length uint)
func (*MPSVectorDescriptor) VectorBytes ¶
func (o *MPSVectorDescriptor) VectorBytes() uint
@property vectorBytes @discussion The stride, in bytes, between corresponding elements of consecutive vectors. Must be a multiple of the element size
func (*MPSVectorDescriptor) Vectors ¶
func (o *MPSVectorDescriptor) Vectors() uint
@property vectors @discussion The number of vectors.
type Mach_vm_range_flags_t ¶
type Mach_vm_range_flags_t int64
const (
MACH_VM_RANGE_NONE Mach_vm_range_flags_t = 0
)
func (Mach_vm_range_flags_t) String ¶
func (e Mach_vm_range_flags_t) String() string
type Mach_vm_range_flavor_t ¶
type Mach_vm_range_flavor_t int64
const ( MACH_VM_RANGE_FLAVOR_INVALID Mach_vm_range_flavor_t = 0 MACH_VM_RANGE_FLAVOR_V1 Mach_vm_range_flavor_t = 1 )
func (Mach_vm_range_flavor_t) String ¶
func (e Mach_vm_range_flavor_t) String() string
type Mach_vm_range_tag_t ¶
type Mach_vm_range_tag_t int64
const ( MACH_VM_RANGE_DEFAULT Mach_vm_range_tag_t = 0 MACH_VM_RANGE_DATA Mach_vm_range_tag_t = 1 MACH_VM_RANGE_FIXED Mach_vm_range_tag_t = 2 )
func (Mach_vm_range_tag_t) String ¶
func (e Mach_vm_range_tag_t) String() string
type Mpo_flags_t ¶
type Mpo_flags_t int64
const ( MPO_PORT Mpo_flags_t = 0 MPO_SERVICE_PORT Mpo_flags_t = 1024 MPO_CONNECTION_PORT Mpo_flags_t = 2048 MPO_REPLY_PORT Mpo_flags_t = 4096 MPO_WEAK_REPLY_PORT Mpo_flags_t = 16384 MPO_NOTIFICATION_PORT Mpo_flags_t = 17408 MPO_EXCEPTION_PORT Mpo_flags_t = 32768 MPO_CONNECTION_PORT_WITH_PORT_ARRAY Mpo_flags_t = 65536 )
func (Mpo_flags_t) String ¶
func (e Mpo_flags_t) String() string
type Os_clockid_t ¶
type Os_clockid_t int64
const (
OS_CLOCK_MACH_ABSOLUTE_TIME Os_clockid_t = 32
)
func (Os_clockid_t) String ¶
func (e Os_clockid_t) String() string
type Ptrauth_key ¶
type Ptrauth_key int64
const ( Ptrauth_key_none Ptrauth_key = -1 Ptrauth_key_asia Ptrauth_key = 0 Ptrauth_key_asib Ptrauth_key = 1 Ptrauth_key_asda Ptrauth_key = 2 Ptrauth_key_asdb Ptrauth_key = 3 Ptrauth_key_process_independent_code Ptrauth_key = 0 Ptrauth_key_process_dependent_code Ptrauth_key = 1 Ptrauth_key_process_independent_data Ptrauth_key = 2 Ptrauth_key_process_dependent_data Ptrauth_key = 3 Ptrauth_key_return_address Ptrauth_key = 1 Ptrauth_key_frame_pointer Ptrauth_key = 3 Ptrauth_key_function_pointer Ptrauth_key = 0 Ptrauth_key_block_function Ptrauth_key = 0 Ptrauth_key_cxx_vtable_pointer Ptrauth_key = 2 Ptrauth_key_method_list_pointer Ptrauth_key = 2 Ptrauth_key_objc_isa_pointer Ptrauth_key = 2 Ptrauth_key_objc_super_pointer Ptrauth_key = 2 Ptrauth_key_objc_sel_pointer Ptrauth_key = 3 Ptrauth_key_objc_class_ro_pointer Ptrauth_key = 2 Ptrauth_key_block_descriptor_pointer Ptrauth_key = 2 Ptrauth_key_init_fini_pointer Ptrauth_key = 0 )
func (Ptrauth_key) String ¶
func (e Ptrauth_key) String() string
type Qos_class_t ¶
type Qos_class_t uint32
const ( QOS_CLASS_USER_INTERACTIVE Qos_class_t = 33 QOS_CLASS_USER_INITIATED Qos_class_t = 25 QOS_CLASS_DEFAULT Qos_class_t = 21 QOS_CLASS_UTILITY Qos_class_t = 17 QOS_CLASS_BACKGROUND Qos_class_t = 9 QOS_CLASS_UNSPECIFIED Qos_class_t = 0 )
func (Qos_class_t) String ¶
func (e Qos_class_t) String() string
type Virtual_memory_guard_exception_code_t ¶
type Virtual_memory_guard_exception_code_t int64
const ( KGUARD_EXC_DEALLOC_GAP Virtual_memory_guard_exception_code_t = 1 KGUARD_EXC_RECLAIM_COPYIO_FAILURE Virtual_memory_guard_exception_code_t = 2 KGUARD_EXC_RECLAIM_INDEX_FAILURE Virtual_memory_guard_exception_code_t = 4 KGUARD_EXC_RECLAIM_DEALLOCATE_FAILURE Virtual_memory_guard_exception_code_t = 8 KGUARD_EXC_RECLAIM_ACCOUNTING_FAILURE Virtual_memory_guard_exception_code_t = 9 KGUARD_EXC_SEC_IOPL_ON_EXEC_PAGE Virtual_memory_guard_exception_code_t = 10 KGUARD_EXC_SEC_EXEC_ON_IOPL_PAGE Virtual_memory_guard_exception_code_t = 11 KGUARD_EXC_SEC_UPL_WRITE_ON_EXEC_REGION Virtual_memory_guard_exception_code_t = 12 KGUARD_EXC_LARGE_ALLOCATION_TELEMETRY Virtual_memory_guard_exception_code_t = 13 KGUARD_EXC_SEC_ACCESS_FAULT Virtual_memory_guard_exception_code_t = 98 KGUARD_EXC_SEC_ASYNC_ACCESS_FAULT Virtual_memory_guard_exception_code_t = 99 KGUARD_EXC_SEC_COPY_DENIED Virtual_memory_guard_exception_code_t = 100 KGUARD_EXC_SEC_SHARING_DENIED Virtual_memory_guard_exception_code_t = 101 KGUARD_EXC_MTE_SYNC_FAULT Virtual_memory_guard_exception_code_t = 200 KGUARD_EXC_MTE_ASYNC_USER_FAULT Virtual_memory_guard_exception_code_t = 201 KGUARD_EXC_MTE_ASYNC_KERN_FAULT Virtual_memory_guard_exception_code_t = 202 KGUARD_EXC_GUARD_OBJECT_ASYNC_USER_FAULT Virtual_memory_guard_exception_code_t = 203 KGUARD_EXC_GUARD_OBJECT_ASYNC_KERN_FAULT Virtual_memory_guard_exception_code_t = 204 )
func (Virtual_memory_guard_exception_code_t) String ¶
func (e Virtual_memory_guard_exception_code_t) String() string
type Xpc_listener_create_flags_t ¶
type Xpc_listener_create_flags_t int64
const ( XPC_LISTENER_CREATE_NONE Xpc_listener_create_flags_t = 0 XPC_LISTENER_CREATE_INACTIVE Xpc_listener_create_flags_t = 1 XPC_LISTENER_CREATE_FORCE_MACH Xpc_listener_create_flags_t = 2 XPC_LISTENER_CREATE_FORCE_XPCSERVICE Xpc_listener_create_flags_t = 4 )
func (Xpc_listener_create_flags_t) String ¶
func (e Xpc_listener_create_flags_t) String() string
type Xpc_session_create_flags_t ¶
type Xpc_session_create_flags_t int64
const ( XPC_SESSION_CREATE_NONE Xpc_session_create_flags_t = 0 XPC_SESSION_CREATE_INACTIVE Xpc_session_create_flags_t = 1 XPC_SESSION_CREATE_MACH_PRIVILEGED Xpc_session_create_flags_t = 2 )
func (Xpc_session_create_flags_t) String ¶
func (e Xpc_session_create_flags_t) String() string
Source Files
¶
- MPSCommandBuffer.go
- MPSImage.go
- MPSImageDescriptor.go
- MPSKernel.go
- MPSKeyedUnarchiver.go
- MPSMatrix.go
- MPSMatrixDescriptor.go
- MPSNDArray.go
- MPSNDArrayDescriptor.go
- MPSPredicate.go
- MPSState.go
- MPSStateResourceList.go
- MPSTemporaryImage.go
- MPSTemporaryMatrix.go
- MPSTemporaryNDArray.go
- MPSTemporaryVector.go
- MPSVector.go
- MPSVectorDescriptor.go
- doc.go
- mpscore_enums.go
- mpscore_externs.go
- mpscore_functions.go
- mpscore_protocols.go
- mpscore_runtime.go
- mpscore_structs.go