Documentation
¶
Overview ¶
Package mpscore provides a fluent Go API over the macOS MPSCore framework.
Construction ¶
New… functions create objects; each With… method sets one property and returns its receiver, so configuration calls chain. A <Type>FromID constructor adopts an Objective-C object obtained elsewhere.
Lifecycle ¶
A wrapper releases its Objective-C object automatically once the garbage collector finds it unreachable. Call Release to relinquish the reference deterministically (for objects holding scarce resources); Release is idempotent, and afterwards the wrapper's methods are no-ops returning zero values.
Types ¶
Each base type below lists the concrete types you construct and pass where the base is accepted:
- Image: TemporaryImage
- Matrix: TemporaryMatrix
- NDArray: TemporaryNDArray
- Vector: TemporaryVector
Index ¶
- func BuiltinClz(arg int) int
- func MPSDataTypeBitsCount(t DataType) int
- func MPSGetCustomKernelBatchedDestinationIndex(c MPSCustomKernelArgumentCount) int
- func MPSGetCustomKernelBatchedSourceIndex(c MPSCustomKernelArgumentCount, sourceIndex int, mpsMaxTextures int) int
- func MPSGetCustomKernelBroadcastSourceIndex(c MPSCustomKernelArgumentCount, sourceIndex int, mpsMaxTextures int) int
- func MPSGetCustomKernelMaxBatchSize(c MPSCustomKernelArgumentCount, mpsMaxTextures int) int
- func MPSGetImageType(image *Image) obj.Object
- func MPSImageBatchIncrementReadCount(batch unsafe.Pointer, amount int) int
- func MPSImageBatchIterate(batch unsafe.Pointer, iteratorBlock func(obj.Object, int) int) int
- func MPSImageBatchResourceSize(batch unsafe.Pointer) int
- func MPSImageBatchSynchronize(batch unsafe.Pointer, cmdBuf unsafe.Pointer)
- func MPSRectNoClip() metal.MTLRegion
- func MPSSizeofMPSDataType(t DataType) int
- func MPSStateBatchIncrementReadCount(batch unsafe.Pointer, amount int) int
- func MPSStateBatchResourceSize(batch unsafe.Pointer) int
- func MPSStateBatchSynchronize(batch unsafe.Pointer, cmdBuf unsafe.Pointer)
- func RowBytesForColumnsDataType(columns int, dataType DataType) int
- func RowBytesFromColumnsDataType(columns int, dataType DataType) int
- func VectorBytesForLengthDataType(length int, dataType DataType) int
- type AliasingStrategy
- type Clockid
- type CommandBuffer
- func (cb *CommandBuffer) CommitAndContinue()
- func (cb *CommandBuffer) Description() string
- func (cb *CommandBuffer) IsEqual(other obj.Object) bool
- func (cb *CommandBuffer) IsKind(className string) bool
- func (cb *CommandBuffer) Predicate() *Predicate
- func (cb *CommandBuffer) PrefetchHeapForWorkloadSize(size int)
- func (cb *CommandBuffer) String() string
- func (cb *CommandBuffer) WithPredicate(predicate *Predicate) *CommandBuffer
- type CustomKernelIndex
- type DataLayout
- type DataType
- type DeviceCapsValues
- type DeviceProvider
- type DispatchAutoreleaseFrequency
- type DispatchBlockFlags
- type EntryID
- type FilesecProperty
- type Flag
- type FloatDataTypeBit
- type FloatDataTypeShift
- type HeapProvider
- type Idtype
- type Image
- func (i *Image) BatchRepresentation() unsafe.Pointer
- func (i *Image) BatchRepresentationWithSubRange(subRange foundation.NSRange) unsafe.Pointer
- func (i *Image) Description() string
- func (i *Image) FeatureChannelFormat() ImageFeatureChannelFormat
- func (i *Image) FeatureChannels() int
- func (i *Image) Height() int
- func (i *Image) IsEqual(other obj.Object) bool
- func (i *Image) IsKind(className string) bool
- func (i *Image) Label() string
- func (i *Image) NumberOfImages() int
- func (i *Image) Parent() *Image
- func (i *Image) PixelSize() int
- func (i *Image) Precision() int
- func (i *Image) ReadBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, bytesPerRow int, ...)
- func (i *Image) ReadBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, bytesPerRow int, ...)
- func (i *Image) ReadBytesDataLayoutImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, imageIndex int)
- func (i *Image) ResourceSize() int
- func (i *Image) SetPurgeableState(state PurgeableState) PurgeableState
- func (i *Image) String() string
- func (i *Image) SubImageWithFeatureChannelRange(range_ foundation.NSRange) *Image
- func (i *Image) Width() int
- func (i *Image) WithLabel(label string) *Image
- func (i *Image) WriteBytesDataLayoutBytesPerColumnBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, bytesPerColumn int, ...)
- func (i *Image) WriteBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, bytesPerRow int, ...)
- func (i *Image) WriteBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, bytesPerRow int, ...)
- func (i *Image) WriteBytesDataLayoutImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, imageIndex int)
- type ImageAllocator
- type ImageDescriptor
- func (id_ *ImageDescriptor) ChannelFormat() ImageFeatureChannelFormat
- func (id_ *ImageDescriptor) Description() string
- func (id_ *ImageDescriptor) FeatureChannels() int
- func (id_ *ImageDescriptor) Height() int
- func (id_ *ImageDescriptor) IsEqual(other obj.Object) bool
- func (id_ *ImageDescriptor) IsKind(className string) bool
- func (id_ *ImageDescriptor) NumberOfImages() int
- func (id_ *ImageDescriptor) String() string
- func (id_ *ImageDescriptor) Width() int
- func (id_ *ImageDescriptor) WithChannelFormat(channelFormat ImageFeatureChannelFormat) *ImageDescriptor
- func (id_ *ImageDescriptor) WithFeatureChannels(featureChannels int) *ImageDescriptor
- func (id_ *ImageDescriptor) WithHeight(height int) *ImageDescriptor
- func (id_ *ImageDescriptor) WithNumberOfImages(numberOfImages int) *ImageDescriptor
- func (id_ *ImageDescriptor) WithWidth(width int) *ImageDescriptor
- type ImageEdgeMode
- type ImageFeatureChannelFormat
- type ImageProvider
- type ImageType
- type IpcInfoObjectType
- type Kernel
- func (k *Kernel) Description() string
- func (k *Kernel) IsEqual(other obj.Object) bool
- func (k *Kernel) IsKind(className string) bool
- func (k *Kernel) Label() string
- func (k *Kernel) Options() KernelOptions
- func (k *Kernel) String() string
- func (k *Kernel) WithLabel(label string) *Kernel
- func (k *Kernel) WithOptions(options KernelOptions) *Kernel
- type KernelOptions
- type KeyedUnarchiver
- type LaunchDataType
- type MDLabelDomain
- type MDQueryOptionFlags
- type MDQuerySortOptionFlags
- type MPSCustomKernelArgumentCount
- type MPSCustomKernelInfo
- type MPSCustomKernelSourceInfo
- type MPSDimensionSlice
- type MPSImageCoordinate
- type MPSImageReadWriteParams
- type MPSImageRegion
- type MPSIntegerDivisionParams
- type MPSMatrixOffset
- type MPSOffset
- type MPSOrigin
- type MPSRegion
- type MPSScaleTransform
- type MPSSize
- type MPSStateTextureInfo
- type MachVMRangeFlags
- type MachVMRangeFlavor
- type MachVMRangeTag
- type Matrix
- func (m *Matrix) Columns() int
- func (m *Matrix) DataType() DataType
- func (m *Matrix) Description() string
- func (m *Matrix) IsEqual(other obj.Object) bool
- func (m *Matrix) IsKind(className string) bool
- func (m *Matrix) Matrices() int
- func (m *Matrix) MatrixBytes() int
- func (m *Matrix) Offset() int
- func (m *Matrix) ResourceSize() int
- func (m *Matrix) RowBytes() int
- func (m *Matrix) Rows() int
- func (m *Matrix) String() string
- type MatrixDescriptor
- func MatrixDescriptorFromID(id objc.ID) *MatrixDescriptor
- func MatrixDescriptorWithDimensionsColumnsRowBytesDataType(rows int, columns int, rowBytes int, dataType DataType) *MatrixDescriptor
- func MatrixDescriptorWithRowsColumnsMatricesRowBytesMatrixBytesDataType(rows int, columns int, matrices int, rowBytes int, matrixBytes int, ...) *MatrixDescriptor
- func MatrixDescriptorWithRowsColumnsRowBytesDataType(rows int, columns int, rowBytes int, dataType DataType) *MatrixDescriptor
- func NewMatrixDescriptor() *MatrixDescriptor
- func (md *MatrixDescriptor) Columns() int
- func (md *MatrixDescriptor) DataType() DataType
- func (md *MatrixDescriptor) Description() string
- func (md *MatrixDescriptor) IsEqual(other obj.Object) bool
- func (md *MatrixDescriptor) IsKind(className string) bool
- func (md *MatrixDescriptor) Matrices() int
- func (md *MatrixDescriptor) MatrixBytes() int
- func (md *MatrixDescriptor) RowBytes() int
- func (md *MatrixDescriptor) Rows() int
- func (md *MatrixDescriptor) String() string
- func (md *MatrixDescriptor) WithColumns(columns int) *MatrixDescriptor
- func (md *MatrixDescriptor) WithDataType(dataType DataType) *MatrixDescriptor
- func (md *MatrixDescriptor) WithRowBytes(rowBytes int) *MatrixDescriptor
- func (md *MatrixDescriptor) WithRows(rows int) *MatrixDescriptor
- type MatrixProvider
- type MpoFlags
- type NDArray
- func (na *NDArray) ArrayViewWithDescriptor(descriptor *NDArrayDescriptor) *NDArray
- func (na *NDArray) ArrayViewWithDimensionCountDimensionSizesStrides(numberOfDimensions int) (result *NDArray, dimensionSizes int, dimStrides int)
- func (na *NDArray) ArrayViewWithShapeStrides(shape unsafe.Pointer, strides unsafe.Pointer) *NDArray
- func (na *NDArray) DataType() DataType
- func (na *NDArray) DataTypeSize() int
- func (na *NDArray) Description() string
- func (na *NDArray) Descriptor() *NDArrayDescriptor
- func (na *NDArray) IsEqual(other obj.Object) bool
- func (na *NDArray) IsKind(className string) bool
- func (na *NDArray) Label() string
- func (na *NDArray) LengthOfDimension(dimensionIndex int) int
- func (na *NDArray) NumberOfDimensions() int
- func (na *NDArray) Parent() *NDArray
- func (na *NDArray) ReadBytesStrideBytes(buffer unsafe.Pointer) (strideBytesPerDimension int64)
- func (na *NDArray) ResourceSize() int
- func (na *NDArray) String() string
- func (na *NDArray) WithLabel(label string) *NDArray
- func (na *NDArray) WriteBytesStrideBytes(buffer unsafe.Pointer) (strideBytesPerDimension int64)
- type NDArrayAllocator
- type NDArrayDescriptor
- func DescriptorWithDataTypeDimensionCountDimensionSizes(dataType DataType, numberOfDimensions int) (result *NDArrayDescriptor, dimensionSizes int)
- func DescriptorWithDataTypeShape(dataType DataType, shape []*foundation.Number) *NDArrayDescriptor
- func NDArrayDescriptorFromID(id objc.ID) *NDArrayDescriptor
- func NewNDArrayDescriptor() *NDArrayDescriptor
- func (nad *NDArrayDescriptor) DataType() DataType
- func (nad *NDArrayDescriptor) Description() string
- func (nad *NDArrayDescriptor) DimensionOrder() unsafe.Pointer
- func (nad *NDArrayDescriptor) GetShape() []obj.Object
- func (nad *NDArrayDescriptor) IsEqual(other obj.Object) bool
- func (nad *NDArrayDescriptor) IsKind(className string) bool
- func (nad *NDArrayDescriptor) LengthOfDimension(dimensionIndex int) int
- func (nad *NDArrayDescriptor) NumberOfDimensions() int
- func (nad *NDArrayDescriptor) PermuteWithDimensionOrder() (dimensionOrder int)
- func (nad *NDArrayDescriptor) PreferPackedRows() bool
- func (nad *NDArrayDescriptor) ReshapeWithDimensionCountDimensionSizes(numberOfDimensions int) (dimensionSizes int)
- func (nad *NDArrayDescriptor) ReshapeWithShape(shape []*foundation.Number)
- func (nad *NDArrayDescriptor) SliceDimensionWithSubrange(dimensionIndex int, subRange MPSDimensionSlice)
- func (nad *NDArrayDescriptor) SliceRangeForDimension(dimensionIndex int) MPSDimensionSlice
- func (nad *NDArrayDescriptor) String() string
- func (nad *NDArrayDescriptor) TransposeDimensionWithDimension(dimensionIndex int, dimensionIndex2 int)
- func (nad *NDArrayDescriptor) WithDataType(dataType DataType) *NDArrayDescriptor
- func (nad *NDArrayDescriptor) WithNumberOfDimensions(numberOfDimensions int) *NDArrayDescriptor
- func (nad *NDArrayDescriptor) WithPreferPackedRows(preferPackedRows bool) *NDArrayDescriptor
- type NDArrayProvider
- type OSClockid
- type Perm
- type Predicate
- type PtrauthKey
- type PurgeableState
- type QosClass
- type State
- func (s *State) BufferSizeAtIndex(index int) int
- func (s *State) Description() string
- func (s *State) DestinationImageDescriptorForSourceImagesSourceStatesForKernelSuggestedDescriptor(sourceImages []*Image, sourceStates []*State, kernel *Kernel, ...) *ImageDescriptor
- func (s *State) IsEqual(other obj.Object) bool
- func (s *State) IsKind(className string) bool
- func (s *State) IsTemporary() bool
- func (s *State) Label() string
- func (s *State) ReadCount() int
- func (s *State) Resource() unsafe.Pointer
- func (s *State) ResourceCount() int
- func (s *State) ResourceSize() int
- func (s *State) ResourceTypeAtIndex(index int) StateResourceType
- func (s *State) String() string
- func (s *State) WithLabel(label string) *State
- func (s *State) WithReadCount(readCount int) *State
- type StateResourceList
- func (srl *StateResourceList) AppendBuffer(size int)
- func (srl *StateResourceList) AppendTexture(descriptor obj.Object)
- func (srl *StateResourceList) Description() string
- func (srl *StateResourceList) IsEqual(other obj.Object) bool
- func (srl *StateResourceList) IsKind(className string) bool
- func (srl *StateResourceList) String() string
- type StateResourceType
- type Tag
- type TemporaryImage
- type TemporaryMatrix
- type TemporaryNDArray
- type TemporaryVector
- type Type
- type Vector
- func (v_ *Vector) DataType() DataType
- func (v_ *Vector) Description() string
- func (v_ *Vector) IsEqual(other obj.Object) bool
- func (v_ *Vector) IsKind(className string) bool
- func (v_ *Vector) Length() int
- func (v_ *Vector) Offset() int
- func (v_ *Vector) ResourceSize() int
- func (v_ *Vector) String() string
- func (v_ *Vector) VectorBytes() int
- func (v_ *Vector) Vectors() int
- type VectorDescriptor
- func NewVectorDescriptor() *VectorDescriptor
- func VectorDescriptorFromID(id objc.ID) *VectorDescriptor
- func VectorDescriptorWithLengthDataType(length int, dataType DataType) *VectorDescriptor
- func VectorDescriptorWithLengthVectorsVectorBytesDataType(length int, vectors int, vectorBytes int, dataType DataType) *VectorDescriptor
- func (vd *VectorDescriptor) DataType() DataType
- func (vd *VectorDescriptor) Description() string
- func (vd *VectorDescriptor) IsEqual(other obj.Object) bool
- func (vd *VectorDescriptor) IsKind(className string) bool
- func (vd *VectorDescriptor) Length() int
- func (vd *VectorDescriptor) String() string
- func (vd *VectorDescriptor) VectorBytes() int
- func (vd *VectorDescriptor) Vectors() int
- func (vd *VectorDescriptor) WithDataType(dataType DataType) *VectorDescriptor
- func (vd *VectorDescriptor) WithLength(length int) *VectorDescriptor
- type VectorProvider
- type VirtualMemoryGuardExceptionCode
- type XpcListenerCreateFlags
- type XpcSessionCreateFlags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuiltinClz ¶
BuiltinClz calls the MPSCore framework function __builtin_clz.
func MPSDataTypeBitsCount ¶
MPSDataTypeBitsCount calls the MPSCore framework function MPSDataTypeBitsCount.
func MPSGetCustomKernelBatchedDestinationIndex ¶
func MPSGetCustomKernelBatchedDestinationIndex(c MPSCustomKernelArgumentCount) int
MPSGetCustomKernelBatchedDestinationIndex calls the MPSCore framework function MPSGetCustomKernelBatchedDestinationIndex.
func MPSGetCustomKernelBatchedSourceIndex ¶
func MPSGetCustomKernelBatchedSourceIndex(c MPSCustomKernelArgumentCount, sourceIndex int, mpsMaxTextures int) int
MPSGetCustomKernelBatchedSourceIndex calls the MPSCore framework function MPSGetCustomKernelBatchedSourceIndex.
func MPSGetCustomKernelBroadcastSourceIndex ¶
func MPSGetCustomKernelBroadcastSourceIndex(c MPSCustomKernelArgumentCount, sourceIndex int, mpsMaxTextures int) int
MPSGetCustomKernelBroadcastSourceIndex calls the MPSCore framework function MPSGetCustomKernelBroadcastSourceIndex.
func MPSGetCustomKernelMaxBatchSize ¶
func MPSGetCustomKernelMaxBatchSize(c MPSCustomKernelArgumentCount, mpsMaxTextures int) int
MPSGetCustomKernelMaxBatchSize calls the MPSCore framework function MPSGetCustomKernelMaxBatchSize.
func MPSGetImageType ¶
MPSGetImageType calls the MPSCore framework function MPSGetImageType.
func MPSImageBatchIncrementReadCount ¶
MPSImageBatchIncrementReadCount calls the MPSCore framework function MPSImageBatchIncrementReadCount.
func MPSImageBatchIterate ¶
MPSImageBatchIterate calls the MPSCore framework function MPSImageBatchIterate.
func MPSImageBatchResourceSize ¶
MPSImageBatchResourceSize calls the MPSCore framework function MPSImageBatchResourceSize.
func MPSImageBatchSynchronize ¶
MPSImageBatchSynchronize calls the MPSCore framework function MPSImageBatchSynchronize.
func MPSRectNoClip ¶
MPSRectNoClip returns the value of the constant MPSRectNoClip.
func MPSSizeofMPSDataType ¶
MPSSizeofMPSDataType calls the MPSCore framework function MPSSizeofMPSDataType.
func MPSStateBatchIncrementReadCount ¶
MPSStateBatchIncrementReadCount calls the MPSCore framework function MPSStateBatchIncrementReadCount.
func MPSStateBatchResourceSize ¶
MPSStateBatchResourceSize calls the MPSCore framework function MPSStateBatchResourceSize.
func MPSStateBatchSynchronize ¶
MPSStateBatchSynchronize calls the MPSCore framework function MPSStateBatchSynchronize.
func RowBytesForColumnsDataType ¶ added in v0.17.0
RowBytesForColumnsDataType wraps the corresponding Objective-C method.
func RowBytesFromColumnsDataType ¶ added in v0.17.0
RowBytesFromColumnsDataType return the recommended row stride, in bytes, for a given number of columns. 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 VectorBytesForLengthDataType ¶ added in v0.17.0
VectorBytesForLengthDataType return the recommended stride, in bytes, to be used for an array of vectors of a given length. 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).
Types ¶
type AliasingStrategy ¶ added in v0.17.0
type AliasingStrategy uint64
Bitmask — values may be combined with |.
const ( AliasingStrategyDefault AliasingStrategy = 0 AliasingStrategyDontCare AliasingStrategy = 0 AliasingStrategyShallAlias AliasingStrategy = 1 AliasingStrategyShallNotAlias AliasingStrategy = 2 AliasingStrategyAliasingReserved AliasingStrategy = 3 AliasingStrategyPreferTemporaryMemory AliasingStrategy = 4 AliasingStrategyPreferNonTemporaryMemory AliasingStrategy = 8 )
func (AliasingStrategy) String ¶ added in v0.17.0
func (e AliasingStrategy) String() string
String returns the AliasingStrategy constant's name, or its numeric form when the value is not a known constant.
type CommandBuffer ¶ added in v0.17.0
CommandBuffer is an idiomatic wrapper over the Objective-C class MPSCommandBuffer.
func CommandBufferFromID ¶ added in v0.17.0
func CommandBufferFromID(id objc.ID) *CommandBuffer
CommandBufferFromID adopts an existing Objective-C object as a CommandBuffer (nil for 0), retaining it and registering a release finalizer.
func NewCommandBuffer ¶ added in v0.17.0
func NewCommandBuffer() *CommandBuffer
NewCommandBuffer creates a new CommandBuffer.
func (*CommandBuffer) CommitAndContinue ¶ added in v0.17.0
func (cb *CommandBuffer) CommitAndContinue()
CommitAndContinue commit work encoded so far and continue with a new underlying command buffer 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 (*CommandBuffer) Description ¶ added in v0.17.0
func (cb *CommandBuffer) Description() string
Description returns the object's -description text.
func (*CommandBuffer) IsEqual ¶ added in v0.17.0
func (cb *CommandBuffer) IsEqual(other obj.Object) bool
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*CommandBuffer) IsKind ¶ added in v0.17.0
func (cb *CommandBuffer) IsKind(className string) bool
IsKind reports whether the object is an instance of the named class or a subclass.
func (*CommandBuffer) Predicate ¶ added in v0.17.0
func (cb *CommandBuffer) Predicate() *Predicate
Predicate returns a GPU predicate object. Default: nil.
func (*CommandBuffer) PrefetchHeapForWorkloadSize ¶ added in v0.17.0
func (cb *CommandBuffer) PrefetchHeapForWorkloadSize(size int)
PrefetchHeapForWorkloadSize prefetch heap into the MPS command buffer heap cache. 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.
func (*CommandBuffer) String ¶ added in v0.17.0
func (cb *CommandBuffer) String() string
String returns the object's -description text, so a wrapper prints usefully under fmt.
func (*CommandBuffer) WithPredicate ¶ added in v0.17.0
func (cb *CommandBuffer) WithPredicate(predicate *Predicate) *CommandBuffer
WithPredicate sets a GPU predicate object. Default: nil.
type CustomKernelIndex ¶ added in v0.17.0
type CustomKernelIndex int32
const ( CustomKernelIndexDestIndex CustomKernelIndex = 0 CustomKernelIndexSrc0Index CustomKernelIndex = 0 CustomKernelIndexSrc1Index CustomKernelIndex = 1 CustomKernelIndexSrc2Index CustomKernelIndex = 2 CustomKernelIndexSrc3Index CustomKernelIndex = 3 CustomKernelIndexSrc4Index CustomKernelIndex = 4 CustomKernelIndexUserDataIndex CustomKernelIndex = 30 )
func (CustomKernelIndex) String ¶ added in v0.17.0
func (e CustomKernelIndex) String() string
String returns the CustomKernelIndex constant's name, or its numeric form when the value is not a known constant.
type DataLayout ¶ added in v0.17.0
type DataLayout uint64
const ( DataLayoutHeightxWidthxFeatureChannels DataLayout = 0 DataLayoutFeatureChannelsxHeightxWidth DataLayout = 1 )
func (DataLayout) String ¶ added in v0.17.0
func (e DataLayout) String() string
String returns the DataLayout constant's name, or its numeric form when the value is not a known constant.
type DataType ¶ added in v0.17.0
type DataType uint32
const ( DataTypeInvalid DataType = 0 DataTypeFloatBit DataType = 268435456 DataTypeFloat32 DataType = 268435488 DataTypeFloat16 DataType = 268435472 DataTypeComplexBit DataType = 16777216 DataTypeComplexFloat32 DataType = 285212736 DataTypeComplexFloat16 DataType = 285212704 DataTypeSignedBit DataType = 536870912 DataTypeIntBit DataType = 536870912 DataTypeInt2 DataType = 536870914 DataTypeInt4 DataType = 536870916 DataTypeInt8 DataType = 536870920 DataTypeInt16 DataType = 536870928 DataTypeInt32 DataType = 536870944 DataTypeInt64 DataType = 536870976 DataTypeUInt2 DataType = 2 DataTypeUInt4 DataType = 4 DataTypeUInt8 DataType = 8 DataTypeUInt16 DataType = 16 DataTypeUInt32 DataType = 32 DataTypeUInt64 DataType = 64 DataTypeAlternateEncodingBit DataType = 2147483648 DataTypeBool DataType = 2147483656 DataTypeBFloat16 DataType = 2415919120 DataTypeComplexBFloat16 DataType = 2432696352 DataTypeNormalizedBit DataType = 1073741824 DataTypeUnorm1 DataType = 1073741825 DataTypeUnorm8 DataType = 1073741832 )
type DeviceCapsValues ¶ added in v0.17.0
type DeviceCapsValues uint32
const ( DeviceCapsNull DeviceCapsValues = 0 DeviceSupportsReadableArrayOfTextures DeviceCapsValues = 1 DeviceSupportsWritableArrayOfTextures DeviceCapsValues = 2 DeviceSupportsReadWriteTextures DeviceCapsValues = 4 DeviceSupportsSimdgroupBarrier DeviceCapsValues = 8 DeviceSupportsQuadShuffle DeviceCapsValues = 16 DeviceSupportsSimdShuffle DeviceCapsValues = 32 DeviceSupportsSimdReduction DeviceCapsValues = 64 DeviceSupportsFloat32Filtering DeviceCapsValues = 128 DeviceSupportsNorm16BicubicFiltering DeviceCapsValues = 256 DeviceSupportsFloat16BicubicFiltering DeviceCapsValues = 512 DeviceIsAppleDevice DeviceCapsValues = 1024 DeviceSupportsSimdShuffleAndFill DeviceCapsValues = 2048 DeviceSupportsBFloat16Arithmetic DeviceCapsValues = 4096 DeviceCapsLast DeviceCapsValues = 8192 )
func (DeviceCapsValues) String ¶ added in v0.17.0
func (e DeviceCapsValues) String() string
String returns the DeviceCapsValues constant's name, or its numeric form when the value is not a known constant.
type DeviceProvider ¶ added in v0.17.0
DeviceProvider is the Go form of the Objective-C protocol MPSDeviceProvider.
type DispatchAutoreleaseFrequency ¶ added in v0.17.0
type DispatchAutoreleaseFrequency uint64
const ( DispatchAutoreleaseFrequencyInherit DispatchAutoreleaseFrequency = 0 DispatchAutoreleaseFrequencyWorkItem DispatchAutoreleaseFrequency = 1 DispatchAutoreleaseFrequencyNever DispatchAutoreleaseFrequency = 2 )
func (DispatchAutoreleaseFrequency) String ¶ added in v0.17.0
func (e DispatchAutoreleaseFrequency) String() string
String returns the DispatchAutoreleaseFrequency constant's name, or its numeric form when the value is not a known constant.
type DispatchBlockFlags ¶ added in v0.17.0
type DispatchBlockFlags uint64
Bitmask — values may be combined with |.
const ( DispatchBlockFlagsBarrier DispatchBlockFlags = 1 DispatchBlockFlagsDetached DispatchBlockFlags = 2 DispatchBlockFlagsAssignCurrent DispatchBlockFlags = 4 DispatchBlockFlagsNoQosClass DispatchBlockFlags = 8 DispatchBlockFlagsInheritQosClass DispatchBlockFlags = 16 DispatchBlockFlagsEnforceQosClass DispatchBlockFlags = 32 )
func (DispatchBlockFlags) String ¶ added in v0.17.0
func (e DispatchBlockFlags) String() string
String returns the DispatchBlockFlags constant's name, or its numeric form when the value is not a known constant.
type FilesecProperty ¶ added in v0.17.0
type FilesecProperty int32
const ( FilesecPropertyOwner FilesecProperty = 1 FilesecPropertyGroup FilesecProperty = 2 FilesecPropertyUUID FilesecProperty = 3 FilesecPropertyMode FilesecProperty = 4 FilesecPropertyACL FilesecProperty = 5 FilesecPropertyGrpuuid FilesecProperty = 6 FilesecPropertyACLRaw FilesecProperty = 100 FilesecPropertyACLAllocsize FilesecProperty = 101 )
func (FilesecProperty) String ¶ added in v0.17.0
func (e FilesecProperty) String() string
String returns the FilesecProperty constant's name, or its numeric form when the value is not a known constant.
type FloatDataTypeBit ¶ added in v0.17.0
type FloatDataTypeBit uint32
const ( FloatDataTypeSignBit FloatDataTypeBit = 8388608 FloatDataTypeExponentBit FloatDataTypeBit = 8126464 FloatDataTypeMantissaBit FloatDataTypeBit = 261120 )
func (FloatDataTypeBit) String ¶ added in v0.17.0
func (e FloatDataTypeBit) String() string
String returns the FloatDataTypeBit constant's name, or its numeric form when the value is not a known constant.
type FloatDataTypeShift ¶ added in v0.17.0
type FloatDataTypeShift uint32
const ( FloatDataTypeSignShift FloatDataTypeShift = 23 FloatDataTypeExponentShift FloatDataTypeShift = 18 FloatDataTypeMantissaShift FloatDataTypeShift = 10 )
func (FloatDataTypeShift) String ¶ added in v0.17.0
func (e FloatDataTypeShift) String() string
String returns the FloatDataTypeShift constant's name, or its numeric form when the value is not a known constant.
type HeapProvider ¶ added in v0.17.0
HeapProvider is the Go form of the Objective-C protocol MPSHeapProvider.
type Image ¶ added in v0.17.0
Image is an idiomatic wrapper over the Objective-C class MPSImage.
Image is an abstract base — you do not construct it directly. Construct one of TemporaryImage and pass it where a Image is accepted.
func ImageFromID ¶ added in v0.17.0
ImageFromID adopts an existing Objective-C object as a Image (nil for 0), retaining it and registering a release finalizer.
func NewImageWithParentImageSliceRangeFeatureChannels ¶ added in v0.17.0
func NewImageWithParentImageSliceRangeFeatureChannels(parent *Image, sliceRange foundation.NSRange, featureChannels int) *Image
NewImageWithParentImageSliceRangeFeatureChannels use -batchRepresentation or -subImageWithFeatureChannelRange instead 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.
func (*Image) BatchRepresentation ¶ added in v0.18.0
BatchRepresentation returns make a MPSImageBatch that points to the individual images in the MPSImage 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.
func (*Image) BatchRepresentationWithSubRange ¶ added in v0.18.0
func (i *Image) BatchRepresentationWithSubRange(subRange foundation.NSRange) unsafe.Pointer
BatchRepresentationWithSubRange make a representation of a MPSImage (batch) as a MPSImageBatch 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.
func (*Image) Description ¶ added in v0.17.0
Description returns the object's -description text.
func (*Image) FeatureChannelFormat ¶ added in v0.17.0
func (i *Image) FeatureChannelFormat() ImageFeatureChannelFormat
FeatureChannelFormat returns the true encoding of the feature channels
func (*Image) FeatureChannels ¶ added in v0.17.0
FeatureChannels returns the number of feature channels per pixel.
func (*Image) IsEqual ¶ added in v0.17.0
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*Image) IsKind ¶ added in v0.17.0
IsKind reports whether the object is an instance of the named class or a subclass.
func (*Image) NumberOfImages ¶ added in v0.17.0
NumberOfImages returns numberOfImages for batch processing
func (*Image) Parent ¶ added in v0.17.0
Parent returns the MPSImage from which this MPSImage was derived. Otherwise nil. This will point to the original image if this image was created using -batchRepresentation, -batchRepresentationWithRange: or -subImageWithFeatureChannelRange:.
func (*Image) PixelSize ¶ added in v0.17.0
PixelSize returns number of bytes from the first byte of one pixel to the first byte of the next pixel in storage order. (Includes padding.)
func (*Image) Precision ¶ added in v0.17.0
Precision returns the number of bits of numeric precision available for each feature channel. 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 (*Image) ReadBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex ¶ added in v0.18.1
func (i *Image) ReadBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, bytesPerRow int, bytesPerImage int, region metal.MTLRegion, featureChannelInfo MPSImageReadWriteParams, imageIndex int)
ReadBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex get the values inside MPSImage and put them in the Buffer passed in. 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 (*Image) ReadBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex ¶ added in v0.18.1
func (i *Image) ReadBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, bytesPerRow int, region metal.MTLRegion, featureChannelInfo MPSImageReadWriteParams, imageIndex int)
ReadBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex get the values inside MPSImage and put them in the Buffer passed in. 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 (*Image) ReadBytesDataLayoutImageIndex ¶ added in v0.17.0
func (i *Image) ReadBytesDataLayoutImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, imageIndex int)
ReadBytesDataLayoutImageIndex get the values inside MPSImage and put them in the Buffer passed in. 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 (*Image) ResourceSize ¶ added in v0.17.0
ResourceSize get the number of bytes used to allocate underyling MTLResources 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 (*Image) SetPurgeableState ¶ added in v0.17.0
func (i *Image) SetPurgeableState(state PurgeableState) PurgeableState
SetPurgeableState set (or query) the purgeability state of a MPSImage 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 (*Image) String ¶ added in v0.17.0
String returns the object's -description text, so a wrapper prints usefully under fmt.
func (*Image) SubImageWithFeatureChannelRange ¶ added in v0.17.0
func (i *Image) SubImageWithFeatureChannelRange(range_ foundation.NSRange) *Image
SubImageWithFeatureChannelRange wraps the corresponding Objective-C method.
func (*Image) WriteBytesDataLayoutBytesPerColumnBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex ¶ added in v0.18.1
func (i *Image) WriteBytesDataLayoutBytesPerColumnBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, bytesPerColumn int, bytesPerRow int, bytesPerImage int, region metal.MTLRegion, featureChannelInfo MPSImageReadWriteParams, imageIndex int)
WriteBytesDataLayoutBytesPerColumnBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex set the values inside MPSImage with the Buffer passed in. 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 (*Image) WriteBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex ¶ added in v0.18.1
func (i *Image) WriteBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, bytesPerRow int, bytesPerImage int, region metal.MTLRegion, featureChannelInfo MPSImageReadWriteParams, imageIndex int)
WriteBytesDataLayoutBytesPerRowBytesPerImageRegionFeatureChannelInfoImageIndex set the values inside MPSImage with the Buffer passed in. 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 (*Image) WriteBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex ¶ added in v0.18.1
func (i *Image) WriteBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, bytesPerRow int, region metal.MTLRegion, featureChannelInfo MPSImageReadWriteParams, imageIndex int)
WriteBytesDataLayoutBytesPerRowRegionFeatureChannelInfoImageIndex set the values inside MPSImage with the Buffer passed in. 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 (*Image) WriteBytesDataLayoutImageIndex ¶ added in v0.17.0
func (i *Image) WriteBytesDataLayoutImageIndex(dataBytes unsafe.Pointer, dataLayout DataLayout, imageIndex int)
WriteBytesDataLayoutImageIndex set the values inside MPSImage with the Buffer passed in. 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 ImageAllocator ¶ added in v0.17.0
type ImageAllocator interface {
ImageForCommandBufferImageDescriptorKernel(cmdBuf obj.Object, descriptor *ImageDescriptor, kernel *Kernel) *Image
}
ImageAllocator is the Go form of the Objective-C protocol MPSImageAllocator.
type ImageDescriptor ¶ added in v0.17.0
ImageDescriptor is an idiomatic wrapper over the Objective-C class MPSImageDescriptor.
func ImageDescriptorFromID ¶ added in v0.17.0
func ImageDescriptorFromID(id objc.ID) *ImageDescriptor
ImageDescriptorFromID adopts an existing Objective-C object as a ImageDescriptor (nil for 0), retaining it and registering a release finalizer.
func ImageDescriptorWithChannelFormatWidthHeightFeatureChannels ¶ added in v0.17.0
func ImageDescriptorWithChannelFormatWidthHeightFeatureChannels(channelFormat ImageFeatureChannelFormat, width int, height int, featureChannels int) *ImageDescriptor
ImageDescriptorWithChannelFormatWidthHeightFeatureChannels create a MPSImageDescriptor for a single read/write cnn image.
func NewImageDescriptor ¶ added in v0.17.0
func NewImageDescriptor() *ImageDescriptor
NewImageDescriptor creates a new ImageDescriptor.
func (*ImageDescriptor) ChannelFormat ¶ added in v0.17.0
func (id_ *ImageDescriptor) ChannelFormat() ImageFeatureChannelFormat
ChannelFormat returns the storage format to use for each channel in the image.
func (*ImageDescriptor) Description ¶ added in v0.17.0
func (id_ *ImageDescriptor) Description() string
Description returns the object's -description text.
func (*ImageDescriptor) FeatureChannels ¶ added in v0.17.0
func (id_ *ImageDescriptor) FeatureChannels() int
FeatureChannels returns the number of feature channels per pixel. Default = 1.
func (*ImageDescriptor) Height ¶ added in v0.17.0
func (id_ *ImageDescriptor) Height() int
Height returns the height of the CNN image. The formal height of the CNN image in pixels. Default = 1.
func (*ImageDescriptor) IsEqual ¶ added in v0.17.0
func (id_ *ImageDescriptor) IsEqual(other obj.Object) bool
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*ImageDescriptor) IsKind ¶ added in v0.17.0
func (id_ *ImageDescriptor) IsKind(className string) bool
IsKind reports whether the object is an instance of the named class or a subclass.
func (*ImageDescriptor) NumberOfImages ¶ added in v0.17.0
func (id_ *ImageDescriptor) NumberOfImages() int
NumberOfImages returns the number of images for batch processing. Default = 1.
func (*ImageDescriptor) String ¶ added in v0.17.0
func (id_ *ImageDescriptor) String() string
String returns the object's -description text, so a wrapper prints usefully under fmt.
func (*ImageDescriptor) Width ¶ added in v0.17.0
func (id_ *ImageDescriptor) Width() int
Width returns the width of the CNN image. The formal width of the CNN image in pixels. Default = 1.
func (*ImageDescriptor) WithChannelFormat ¶ added in v0.17.0
func (id_ *ImageDescriptor) WithChannelFormat(channelFormat ImageFeatureChannelFormat) *ImageDescriptor
WithChannelFormat sets the storage format to use for each channel in the image.
func (*ImageDescriptor) WithFeatureChannels ¶ added in v0.17.0
func (id_ *ImageDescriptor) WithFeatureChannels(featureChannels int) *ImageDescriptor
WithFeatureChannels sets the number of feature channels per pixel. Default = 1.
func (*ImageDescriptor) WithHeight ¶ added in v0.17.0
func (id_ *ImageDescriptor) WithHeight(height int) *ImageDescriptor
WithHeight sets the height of the CNN image. The formal height of the CNN image in pixels. Default = 1.
func (*ImageDescriptor) WithNumberOfImages ¶ added in v0.17.0
func (id_ *ImageDescriptor) WithNumberOfImages(numberOfImages int) *ImageDescriptor
WithNumberOfImages sets the number of images for batch processing. Default = 1.
func (*ImageDescriptor) WithWidth ¶ added in v0.17.0
func (id_ *ImageDescriptor) WithWidth(width int) *ImageDescriptor
WithWidth sets the width of the CNN image. The formal width of the CNN image in pixels. Default = 1.
type ImageEdgeMode ¶ added in v0.17.0
type ImageEdgeMode 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 ImageEdgeModeZero ImageEdgeMode = 0 // Out of bound pixels are clamped to nearest edge pixel ImageEdgeModeClamp ImageEdgeMode = 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 ImageEdgeModeMirror ImageEdgeMode = 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 ImageEdgeModeMirrorWithEdge ImageEdgeMode = 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 ImageEdgeModeConstant ImageEdgeMode = 4 )
func (ImageEdgeMode) String ¶ added in v0.17.0
func (e ImageEdgeMode) String() string
String returns the ImageEdgeMode constant's name, or its numeric form when the value is not a known constant.
type ImageFeatureChannelFormat ¶ added in v0.17.0
type ImageFeatureChannelFormat 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. ImageFeatureChannelFormatNone ImageFeatureChannelFormat = 0 // uint8_t with value [0,255] encoding [0,1.0] ImageFeatureChannelFormatUnorm8 ImageFeatureChannelFormat = 1 // uint16_t with value [0,65535] encoding [0,1.0] ImageFeatureChannelFormatUnorm16 ImageFeatureChannelFormat = 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. ImageFeatureChannelFormatFloat16 ImageFeatureChannelFormat = 3 // IEEE-754 32-bit floating-point value. "single precision" (standard float type in C) 24 bits of precision + exponent ImageFeatureChannelFormatFloat32 ImageFeatureChannelFormat = 4 // Reserved for later expansion ImageFeatureChannelFormat_reserved0 ImageFeatureChannelFormat = 5 ImageFeatureChannelFormatCount ImageFeatureChannelFormat = 6 )
func (ImageFeatureChannelFormat) String ¶ added in v0.17.0
func (e ImageFeatureChannelFormat) String() string
String returns the ImageFeatureChannelFormat constant's name, or its numeric form when the value is not a known constant.
type ImageProvider ¶ added in v0.17.0
ImageProvider is accepted wherever a MPSImage (or one of its subclasses) is expected.
type ImageType ¶ added in v0.17.0
type ImageType uint32
const ( ImageType2d ImageType = 0 ImageType2d_array ImageType = 1 ImageTypeArray2d ImageType = 2 ImageTypeArray2d_array ImageType = 3 ImageType_ArrayMask ImageType = 1 ImageType_BatchMask ImageType = 2 ImageType_typeMask ImageType = 3 ImageType_noAlpha ImageType = 4 ImageType_texelFormatMask ImageType = 56 ImageType_texelFormatShift ImageType = 3 ImageType_texelFormatStandard ImageType = 0 ImageType_texelFormatUnorm8 ImageType = 8 ImageType_texelFormatFloat16 ImageType = 16 ImageType_texelFormatBFloat16 ImageType = 24 ImageType_bitCount ImageType = 6 ImageType_mask ImageType = 63 ImageType2d_noAlpha ImageType = 4 ImageType2d_array_noAlpha ImageType = 5 ImageTypeArray2d_noAlpha ImageType = 6 ImageTypeArray2d_array_noAlpha ImageType = 7 )
type IpcInfoObjectType ¶ added in v0.17.0
type IpcInfoObjectType uint32
const ( IpcInfoObjectTypeNone IpcInfoObjectType = 0 IpcInfoObjectTypeThreadControl IpcInfoObjectType = 1 IpcInfoObjectTypeTaskControl IpcInfoObjectType = 2 IpcInfoObjectTypeHost IpcInfoObjectType = 3 IpcInfoObjectTypeHostPriv IpcInfoObjectType = 4 IpcInfoObjectTypeProcessor IpcInfoObjectType = 5 IpcInfoObjectTypeProcessorSet IpcInfoObjectType = 6 IpcInfoObjectTypeProcessorSetName IpcInfoObjectType = 7 IpcInfoObjectTypeTimer IpcInfoObjectType = 8 IpcInfoObjectTypePortSubstOnce IpcInfoObjectType = 9 IpcInfoObjectTypeMig IpcInfoObjectType = 10 IpcInfoObjectTypeMemoryObject IpcInfoObjectType = 11 IpcInfoObjectTypeXmmPager IpcInfoObjectType = 12 IpcInfoObjectTypeXmmKernel IpcInfoObjectType = 13 IpcInfoObjectTypeXmmReply IpcInfoObjectType = 14 IpcInfoObjectTypeUndReply IpcInfoObjectType = 15 IpcInfoObjectTypeHostNotify IpcInfoObjectType = 16 IpcInfoObjectTypeHostSecurity IpcInfoObjectType = 17 IpcInfoObjectTypeLedger IpcInfoObjectType = 18 IpcInfoObjectTypeMainDevice IpcInfoObjectType = 19 IpcInfoObjectTypeTaskName IpcInfoObjectType = 20 IpcInfoObjectTypeSubsystem IpcInfoObjectType = 21 IpcInfoObjectTypeIODoneQueue IpcInfoObjectType = 22 IpcInfoObjectTypeSemaphore IpcInfoObjectType = 23 IpcInfoObjectTypeLockSet IpcInfoObjectType = 24 IpcInfoObjectTypeClock IpcInfoObjectType = 25 IpcInfoObjectTypeClockCtrl IpcInfoObjectType = 26 IpcInfoObjectTypeIokitIdent IpcInfoObjectType = 27 IpcInfoObjectTypeNamedEntry IpcInfoObjectType = 28 IpcInfoObjectTypeIokitConnect IpcInfoObjectType = 29 IpcInfoObjectTypeIokitObject IpcInfoObjectType = 30 IpcInfoObjectTypeUpl IpcInfoObjectType = 31 IpcInfoObjectTypeMemObjControl IpcInfoObjectType = 32 IpcInfoObjectTypeAuSessionport IpcInfoObjectType = 33 IpcInfoObjectTypeFileport IpcInfoObjectType = 34 IpcInfoObjectTypeLabelh IpcInfoObjectType = 35 IpcInfoObjectTypeTaskResume IpcInfoObjectType = 36 IpcInfoObjectTypeVoucher IpcInfoObjectType = 37 IpcInfoObjectTypeVoucherAttrControl IpcInfoObjectType = 38 IpcInfoObjectTypeWorkInterval IpcInfoObjectType = 39 IpcInfoObjectTypeUxHandler IpcInfoObjectType = 40 IpcInfoObjectTypeUextObject IpcInfoObjectType = 41 IpcInfoObjectTypeArcadeReg IpcInfoObjectType = 42 IpcInfoObjectTypeEventlink IpcInfoObjectType = 43 IpcInfoObjectTypeTaskInspect IpcInfoObjectType = 44 IpcInfoObjectTypeTaskRead IpcInfoObjectType = 45 IpcInfoObjectTypeThreadInspect IpcInfoObjectType = 46 IpcInfoObjectTypeThreadRead IpcInfoObjectType = 47 IpcInfoObjectTypeSuidCred IpcInfoObjectType = 48 IpcInfoObjectTypeHypervisor IpcInfoObjectType = 49 IpcInfoObjectTypeTaskIDToken IpcInfoObjectType = 50 IpcInfoObjectTypeTaskFatal IpcInfoObjectType = 51 IpcInfoObjectTypeKcdata IpcInfoObjectType = 52 IpcInfoObjectTypeExclavesResource IpcInfoObjectType = 53 IpcInfoObjectTypeThreadResume IpcInfoObjectType = 54 IpcInfoObjectTypeUnknown IpcInfoObjectType = 4294967295 )
func (IpcInfoObjectType) String ¶ added in v0.17.0
func (e IpcInfoObjectType) String() string
String returns the IpcInfoObjectType constant's name, or its numeric form when the value is not a known constant.
type Kernel ¶ added in v0.17.0
Kernel is an idiomatic wrapper over the Objective-C class MPSKernel.
func KernelFromID ¶ added in v0.17.0
KernelFromID adopts an existing Objective-C object as a Kernel (nil for 0), retaining it and registering a release finalizer.
func NewKernelWithCoder ¶ added in v0.17.0
NewKernelWithCoder called by NSCoder to decode MPSKernels 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 (*Kernel) Description ¶ added in v0.17.0
Description returns the object's -description text.
func (*Kernel) IsEqual ¶ added in v0.17.0
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*Kernel) IsKind ¶ added in v0.17.0
IsKind reports whether the object is an instance of the named class or a subclass.
func (*Kernel) Options ¶ added in v0.17.0
func (k *Kernel) Options() KernelOptions
Options returns the set of options used to run the kernel.
func (*Kernel) String ¶ added in v0.17.0
String returns the object's -description text, so a wrapper prints usefully under fmt.
func (*Kernel) WithOptions ¶ added in v0.17.0
func (k *Kernel) WithOptions(options KernelOptions) *Kernel
WithOptions sets the set of options used to run the kernel.
type KernelOptions ¶ added in v0.17.0
type KernelOptions uint64
Bitmask — values may be combined with |.
const ( // Use default options KernelOptionsNone KernelOptions = 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. KernelOptionsSkipAPIValidation KernelOptions = 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. KernelOptionsAllowReducedPrecision KernelOptions = 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. KernelOptionsDisableInternalTiling KernelOptions = 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. KernelOptionsInsertDebugGroups KernelOptions = 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: KernelOptionsVerbose KernelOptions = 16 )
func (KernelOptions) String ¶ added in v0.17.0
func (e KernelOptions) String() string
String returns the KernelOptions constant's name, or its numeric form when the value is not a known constant.
type KeyedUnarchiver ¶ added in v0.17.0
KeyedUnarchiver is an idiomatic wrapper over the Objective-C class MPSKeyedUnarchiver.
func KeyedUnarchiverFromID ¶ added in v0.17.0
func KeyedUnarchiverFromID(id objc.ID) *KeyedUnarchiver
KeyedUnarchiverFromID adopts an existing Objective-C object as a KeyedUnarchiver (nil for 0), retaining it and registering a release finalizer.
func NewKeyedUnarchiver ¶ added in v0.17.0
func NewKeyedUnarchiver() *KeyedUnarchiver
NewKeyedUnarchiver creates a new KeyedUnarchiver.
func (*KeyedUnarchiver) Description ¶ added in v0.17.0
func (ku *KeyedUnarchiver) Description() string
Description returns the object's -description text.
func (*KeyedUnarchiver) IsEqual ¶ added in v0.17.0
func (ku *KeyedUnarchiver) IsEqual(other obj.Object) bool
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*KeyedUnarchiver) IsKind ¶ added in v0.17.0
func (ku *KeyedUnarchiver) IsKind(className string) bool
IsKind reports whether the object is an instance of the named class or a subclass.
func (*KeyedUnarchiver) String ¶ added in v0.17.0
func (ku *KeyedUnarchiver) String() string
String returns the object's -description text, so a wrapper prints usefully under fmt.
type LaunchDataType ¶ added in v0.17.0
type LaunchDataType int32
const ( LaunchDataTypeDictionary LaunchDataType = 1 LaunchDataTypeArray LaunchDataType = 2 LaunchDataTypeFd LaunchDataType = 3 LaunchDataTypeInteger LaunchDataType = 4 LaunchDataTypeReal LaunchDataType = 5 LaunchDataTypeBool LaunchDataType = 6 LaunchDataTypeString LaunchDataType = 7 LaunchDataTypeOpaque LaunchDataType = 8 LaunchDataTypeErrno LaunchDataType = 9 LaunchDataTypeMachport LaunchDataType = 10 )
func (LaunchDataType) String ¶ added in v0.17.0
func (e LaunchDataType) String() string
String returns the LaunchDataType constant's name, or its numeric form when the value is not a known constant.
type MDLabelDomain ¶
type MDLabelDomain int32
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
String returns the MDLabelDomain constant's name, or its numeric form when the value is not a known constant.
type MDQueryOptionFlags ¶
type MDQueryOptionFlags int32
const ( KMDQuerySynchronous MDQueryOptionFlags = 1 KMDQueryWantsUpdates MDQueryOptionFlags = 4 KMDQueryAllowFSTranslation MDQueryOptionFlags = 8 )
func (MDQueryOptionFlags) String ¶
func (e MDQueryOptionFlags) String() string
String returns the MDQueryOptionFlags constant's name, or its numeric form when the value is not a known constant.
type MDQuerySortOptionFlags ¶
type MDQuerySortOptionFlags int32
const (
KMDQueryReverseSortOrderFlag MDQuerySortOptionFlags = 1
)
func (MDQuerySortOptionFlags) String ¶
func (e MDQuerySortOptionFlags) String() string
String returns the MDQuerySortOptionFlags constant's name, or its numeric form when the value is not a known constant.
type MPSCustomKernelInfo ¶
type MPSDimensionSlice ¶
Describes a sub-region of an array dimension
type MPSImageCoordinate ¶
A unsigned coordinate with x, y and channel components
type MPSImageReadWriteParams ¶
type MPSImageReadWriteParams struct {
FeatureChannelOffset uint
NumberOfFeatureChannelsToReadWrite uint
}
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
}
A rectangular subregion of a MPSImage
type MPSIntegerDivisionParams ¶
func MPSFindIntegerDivisionParams ¶
func MPSFindIntegerDivisionParams(divisor uint16) MPSIntegerDivisionParams
MPSFindIntegerDivisionParams calls the MPSCore framework function MPSFindIntegerDivisionParams.
type MPSMatrixOffset ¶
Specifies a row and column offset into an MPSMatrix.
type MPSScaleTransform ¶
type MPSScaleTransform struct {
ScaleX float64
ScaleY float64
TranslateX float64
TranslateY float64
}
Transform matrix for explict control over resampling in MPSImageScale. The MPSScaleTransform is equivalent to:
type MPSStateTextureInfo ¶
type MachVMRangeFlags ¶ added in v0.17.0
type MachVMRangeFlags uint64
Bitmask — values may be combined with |.
const (
MachVMRangeFlagsNone MachVMRangeFlags = 0
)
func (MachVMRangeFlags) String ¶ added in v0.17.0
func (e MachVMRangeFlags) String() string
String returns the MachVMRangeFlags constant's name, or its numeric form when the value is not a known constant.
type MachVMRangeFlavor ¶ added in v0.17.0
type MachVMRangeFlavor uint32
const ( MachVMRangeFlavorInvalid MachVMRangeFlavor = 0 MachVMRangeFlavorV1 MachVMRangeFlavor = 1 )
func (MachVMRangeFlavor) String ¶ added in v0.17.0
func (e MachVMRangeFlavor) String() string
String returns the MachVMRangeFlavor constant's name, or its numeric form when the value is not a known constant.
type MachVMRangeTag ¶ added in v0.17.0
type MachVMRangeTag uint16
const ( MachVMRangeTagDefault MachVMRangeTag = 0 MachVMRangeTagData MachVMRangeTag = 1 MachVMRangeTagFixed MachVMRangeTag = 2 )
func (MachVMRangeTag) String ¶ added in v0.17.0
func (e MachVMRangeTag) String() string
String returns the MachVMRangeTag constant's name, or its numeric form when the value is not a known constant.
type Matrix ¶ added in v0.17.0
Matrix is an idiomatic wrapper over the Objective-C class MPSMatrix.
Matrix is an abstract base — you do not construct it directly. Construct one of TemporaryMatrix and pass it where a Matrix is accepted.
func MatrixFromID ¶ added in v0.17.0
MatrixFromID adopts an existing Objective-C object as a Matrix (nil for 0), retaining it and registering a release finalizer.
func (*Matrix) Columns ¶ added in v0.17.0
Columns returns the number of columns in a matrix in the MPSMatrix.
func (*Matrix) Description ¶ added in v0.17.0
Description returns the object's -description text.
func (*Matrix) IsEqual ¶ added in v0.17.0
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*Matrix) IsKind ¶ added in v0.17.0
IsKind reports whether the object is an instance of the named class or a subclass.
func (*Matrix) Matrices ¶ added in v0.17.0
Matrices returns the number of matrices in the MPSMatrix.
func (*Matrix) MatrixBytes ¶ added in v0.17.0
MatrixBytes returns the stride, in bytes, between corresponding elements of consecutive matrices.
func (*Matrix) Offset ¶ added in v0.17.0
Offset returns byte-offset to the buffer where the matrix data begins - see
func (*Matrix) ResourceSize ¶ added in v0.17.0
ResourceSize get the number of bytes used to allocate underyling MTLResources 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 (*Matrix) RowBytes ¶ added in v0.17.0
RowBytes returns the stride, in bytes, between corresponding elements of consecutive rows.
type MatrixDescriptor ¶ added in v0.17.0
MatrixDescriptor is an idiomatic wrapper over the Objective-C class MPSMatrixDescriptor.
func MatrixDescriptorFromID ¶ added in v0.17.0
func MatrixDescriptorFromID(id objc.ID) *MatrixDescriptor
MatrixDescriptorFromID adopts an existing Objective-C object as a MatrixDescriptor (nil for 0), retaining it and registering a release finalizer.
func MatrixDescriptorWithDimensionsColumnsRowBytesDataType ¶ added in v0.17.0
func MatrixDescriptorWithDimensionsColumnsRowBytesDataType(rows int, columns int, rowBytes int, dataType DataType) *MatrixDescriptor
MatrixDescriptorWithDimensionsColumnsRowBytesDataType create a MPSMatrixDescriptor with the specified dimensions and data type. 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 MatrixDescriptorWithRowsColumnsMatricesRowBytesMatrixBytesDataType ¶ added in v0.17.0
func MatrixDescriptorWithRowsColumnsMatricesRowBytesMatrixBytesDataType(rows int, columns int, matrices int, rowBytes int, matrixBytes int, dataType DataType) *MatrixDescriptor
MatrixDescriptorWithRowsColumnsMatricesRowBytesMatrixBytesDataType create a MPSMatrixDescriptor with the specified dimensions and data type. 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 MatrixDescriptorWithRowsColumnsRowBytesDataType ¶ added in v0.17.0
func MatrixDescriptorWithRowsColumnsRowBytesDataType(rows int, columns int, rowBytes int, dataType DataType) *MatrixDescriptor
MatrixDescriptorWithRowsColumnsRowBytesDataType wraps the corresponding Objective-C method.
func NewMatrixDescriptor ¶ added in v0.17.0
func NewMatrixDescriptor() *MatrixDescriptor
NewMatrixDescriptor creates a new MatrixDescriptor.
func (*MatrixDescriptor) Columns ¶ added in v0.17.0
func (md *MatrixDescriptor) Columns() int
Columns returns the number of columns in a matrix.
func (*MatrixDescriptor) DataType ¶ added in v0.17.0
func (md *MatrixDescriptor) DataType() DataType
DataType returns the type of the data which makes up the values of the matrix.
func (*MatrixDescriptor) Description ¶ added in v0.17.0
func (md *MatrixDescriptor) Description() string
Description returns the object's -description text.
func (*MatrixDescriptor) IsEqual ¶ added in v0.17.0
func (md *MatrixDescriptor) IsEqual(other obj.Object) bool
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*MatrixDescriptor) IsKind ¶ added in v0.17.0
func (md *MatrixDescriptor) IsKind(className string) bool
IsKind reports whether the object is an instance of the named class or a subclass.
func (*MatrixDescriptor) Matrices ¶ added in v0.17.0
func (md *MatrixDescriptor) Matrices() int
Matrices returns the number of matrices.
func (*MatrixDescriptor) MatrixBytes ¶ added in v0.17.0
func (md *MatrixDescriptor) MatrixBytes() int
MatrixBytes returns the stride, in bytes, between corresponding elements of consecutive matrices. Must be a multiple of rowBytes.
func (*MatrixDescriptor) RowBytes ¶ added in v0.17.0
func (md *MatrixDescriptor) RowBytes() int
RowBytes returns the stride, in bytes, between corresponding elements of consecutive rows. Must be a multiple of the element size.
func (*MatrixDescriptor) Rows ¶ added in v0.17.0
func (md *MatrixDescriptor) Rows() int
Rows returns the number of rows in a matrix.
func (*MatrixDescriptor) String ¶ added in v0.17.0
func (md *MatrixDescriptor) String() string
String returns the object's -description text, so a wrapper prints usefully under fmt.
func (*MatrixDescriptor) WithColumns ¶ added in v0.17.0
func (md *MatrixDescriptor) WithColumns(columns int) *MatrixDescriptor
WithColumns sets the number of columns in a matrix.
func (*MatrixDescriptor) WithDataType ¶ added in v0.17.0
func (md *MatrixDescriptor) WithDataType(dataType DataType) *MatrixDescriptor
WithDataType sets the type of the data which makes up the values of the matrix.
func (*MatrixDescriptor) WithRowBytes ¶ added in v0.17.0
func (md *MatrixDescriptor) WithRowBytes(rowBytes int) *MatrixDescriptor
WithRowBytes sets the stride, in bytes, between corresponding elements of consecutive rows. Must be a multiple of the element size.
func (*MatrixDescriptor) WithRows ¶ added in v0.17.0
func (md *MatrixDescriptor) WithRows(rows int) *MatrixDescriptor
WithRows sets the number of rows in a matrix.
type MatrixProvider ¶ added in v0.17.0
MatrixProvider is accepted wherever a MPSMatrix (or one of its subclasses) is expected.
type MpoFlags ¶ added in v0.17.0
type MpoFlags uint32
Bitmask — values may be combined with |.
const ( MpoFlagsPort MpoFlags = 0 MpoFlagsServicePort MpoFlags = 1024 MpoFlagsConnectionPort MpoFlags = 2048 MpoFlagsReplyPort MpoFlags = 4096 MpoFlagsWeakReplyPort MpoFlags = 16384 MpoFlagsNotificationPort MpoFlags = 17408 MpoFlagsExceptionPort MpoFlags = 32768 MpoFlagsConnectionPortWithPortArray MpoFlags = 65536 )
type NDArray ¶ added in v0.17.0
NDArray is an idiomatic wrapper over the Objective-C class MPSNDArray.
NDArray is an abstract base — you do not construct it directly. Construct one of TemporaryNDArray and pass it where a NDArray is accepted.
func NDArrayFromID ¶ added in v0.17.0
NDArrayFromID adopts an existing Objective-C object as a NDArray (nil for 0), retaining it and registering a release finalizer.
func (*NDArray) ArrayViewWithDescriptor ¶ added in v0.17.0
func (na *NDArray) ArrayViewWithDescriptor(descriptor *NDArrayDescriptor) *NDArray
ArrayViewWithDescriptor make a new representation of a MPSNDArray with a slice, transpose or other change in property, trying to alias to result. 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.
func (*NDArray) ArrayViewWithDimensionCountDimensionSizesStrides ¶ added in v0.17.0
func (na *NDArray) ArrayViewWithDimensionCountDimensionSizesStrides(numberOfDimensions int) (result *NDArray, dimensionSizes int, dimStrides int)
ArrayViewWithDimensionCountDimensionSizesStrides make a new representation of a MPSNDArray with given strides and a new shape. This operation always returns a new view of the same underlying MTLBuffer, but works only with contiguous buffers.
func (*NDArray) ArrayViewWithShapeStrides ¶ added in v0.17.0
ArrayViewWithShapeStrides make a new representation of a MPSNDArray with given strides and a new shape. This operation always returns a new view of the same underlying MTLBuffer, but works only with contiguous buffers.
func (*NDArray) DataType ¶ added in v0.17.0
DataType returns the type of data stored by each element in the array
func (*NDArray) DataTypeSize ¶ added in v0.17.0
DataTypeSize returns the size of one element in the MPSNDArray
func (*NDArray) Description ¶ added in v0.17.0
Description returns the object's -description text.
func (*NDArray) Descriptor ¶ added in v0.17.0
func (na *NDArray) Descriptor() *NDArrayDescriptor
Descriptor create a MPSNDArrayDescriptor that describes this MPSNDArray 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.
func (*NDArray) IsEqual ¶ added in v0.17.0
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*NDArray) IsKind ¶ added in v0.17.0
IsKind reports whether the object is an instance of the named class or a subclass.
func (*NDArray) Label ¶ added in v0.17.0
Label returns a used specified string to help identify the array during debugging. May be externally visible to tools like Instruments
func (*NDArray) LengthOfDimension ¶ added in v0.17.0
LengthOfDimension the number of elements in the dimension at dimensionIndex The dimension length is at least as large as the existing slice length. Views of this MPSNDArray may have differing dimension lengths.
func (*NDArray) NumberOfDimensions ¶ added in v0.17.0
NumberOfDimensions returns number of dimensions in the NDArray
func (*NDArray) Parent ¶ added in v0.17.0
Parent returns the parent MPSNDArray that this object aliases 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 (*NDArray) ReadBytesStrideBytes ¶ added in v0.17.0
ReadBytesStrideBytes copy bytes from MPSNDArray into buffer The dimensionality and size of the copy region is given by the size of the MPSNDArray For subregions, use a MPSNDArray view.
func (*NDArray) ResourceSize ¶ added in v0.17.0
ResourceSize get the number of bytes used to allocate underyling MTLResources 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 (*NDArray) String ¶ added in v0.17.0
String returns the object's -description text, so a wrapper prints usefully under fmt.
func (*NDArray) WithLabel ¶ added in v0.17.0
WithLabel sets a used specified string to help identify the array during debugging. May be externally visible to tools like Instruments
func (*NDArray) WriteBytesStrideBytes ¶ added in v0.17.0
WriteBytesStrideBytes copy bytes from a buffer into the MPSNDArray The dimensionality and size of the copy region is given by the size of the MPSNDArray For subregions, use a MPSNDArray view.
type NDArrayAllocator ¶ added in v0.17.0
type NDArrayAllocator interface {
ArrayForCommandBufferArrayDescriptorKernel(cmdBuf obj.Object, descriptor *NDArrayDescriptor, kernel *Kernel) *NDArray
}
NDArrayAllocator is the Go form of the Objective-C protocol MPSNDArrayAllocator.
type NDArrayDescriptor ¶ added in v0.17.0
NDArrayDescriptor is an idiomatic wrapper over the Objective-C class MPSNDArrayDescriptor.
func DescriptorWithDataTypeDimensionCountDimensionSizes ¶ added in v0.17.0
func DescriptorWithDataTypeDimensionCountDimensionSizes(dataType DataType, numberOfDimensions int) (result *NDArrayDescriptor, dimensionSizes int)
DescriptorWithDataTypeDimensionCountDimensionSizes create an MPSNDArrayDescriptor object for a given size of dimensions. Sample code:
func DescriptorWithDataTypeShape ¶ added in v0.17.0
func DescriptorWithDataTypeShape(dataType DataType, shape []*foundation.Number) *NDArrayDescriptor
DescriptorWithDataTypeShape a convenience function to create an MPSNDArrayDescriptor object for a given size of dimensions. Sample code:
func NDArrayDescriptorFromID ¶ added in v0.17.0
func NDArrayDescriptorFromID(id objc.ID) *NDArrayDescriptor
NDArrayDescriptorFromID adopts an existing Objective-C object as a NDArrayDescriptor (nil for 0), retaining it and registering a release finalizer.
func NewNDArrayDescriptor ¶ added in v0.17.0
func NewNDArrayDescriptor() *NDArrayDescriptor
NewNDArrayDescriptor creates a new NDArrayDescriptor.
func (*NDArrayDescriptor) DataType ¶ added in v0.17.0
func (nad *NDArrayDescriptor) DataType() DataType
DataType returns data Type of the MPSNDArray elements
func (*NDArrayDescriptor) Description ¶ added in v0.17.0
func (nad *NDArrayDescriptor) Description() string
Description returns the object's -description text.
func (*NDArrayDescriptor) DimensionOrder ¶ added in v0.18.0
func (nad *NDArrayDescriptor) DimensionOrder() unsafe.Pointer
DimensionOrder returns the new ordering of dimensions 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 (*NDArrayDescriptor) GetShape ¶ added in v0.17.0
func (nad *NDArrayDescriptor) GetShape() []obj.Object
GetShape returns the shape of the NDArray as MPSShape 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.
GetShape returns the collection as a Go slice.
func (*NDArrayDescriptor) IsEqual ¶ added in v0.17.0
func (nad *NDArrayDescriptor) IsEqual(other obj.Object) bool
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*NDArrayDescriptor) IsKind ¶ added in v0.17.0
func (nad *NDArrayDescriptor) IsKind(className string) bool
IsKind reports whether the object is an instance of the named class or a subclass.
func (*NDArrayDescriptor) LengthOfDimension ¶ added in v0.17.0
func (nad *NDArrayDescriptor) LengthOfDimension(dimensionIndex int) int
LengthOfDimension the number of elements of type dataType in the indicated dimension. If dimensionIndex >= numberOfDimensions, 1 will be returned.
func (*NDArrayDescriptor) NumberOfDimensions ¶ added in v0.17.0
func (nad *NDArrayDescriptor) NumberOfDimensions() int
NumberOfDimensions returns the number of dimensions in the NDArray. May not exceed 16. A 0-diumension MPSNDArray is a single scalar value. Undefined dimensions are implicitly length 1.
func (*NDArrayDescriptor) PermuteWithDimensionOrder ¶ added in v0.17.0
func (nad *NDArrayDescriptor) PermuteWithDimensionOrder() (dimensionOrder int)
PermuteWithDimensionOrder permutes the dimensions of the current descriptor This permutation is applied on top of whatever transpostions/permutations that may have been performed on the descriptor before.
func (*NDArrayDescriptor) PreferPackedRows ¶ added in v0.17.0
func (nad *NDArrayDescriptor) PreferPackedRows() bool
PreferPackedRows reports whether if true, then new NDArrays created with this descriptor will pack the rows. Default: false.
func (*NDArrayDescriptor) ReshapeWithDimensionCountDimensionSizes ¶ added in v0.17.0
func (nad *NDArrayDescriptor) ReshapeWithDimensionCountDimensionSizes(numberOfDimensions int) (dimensionSizes int)
ReshapeWithDimensionCountDimensionSizes changes dimension sizes and number of dimensions on the current descriptor
func (*NDArrayDescriptor) ReshapeWithShape ¶ added in v0.17.0
func (nad *NDArrayDescriptor) ReshapeWithShape(shape []*foundation.Number)
ReshapeWithShape changes dimension sizes and number of dimensions on the current descriptor
func (*NDArrayDescriptor) SliceDimensionWithSubrange ¶ added in v0.18.1
func (nad *NDArrayDescriptor) SliceDimensionWithSubrange(dimensionIndex int, subRange MPSDimensionSlice)
SliceDimensionWithSubrange the slice dimensions for each dimension
func (*NDArrayDescriptor) SliceRangeForDimension ¶ added in v0.18.1
func (nad *NDArrayDescriptor) SliceRangeForDimension(dimensionIndex int) MPSDimensionSlice
SliceRangeForDimension the slice dimensions for each dimension
func (*NDArrayDescriptor) String ¶ added in v0.17.0
func (nad *NDArrayDescriptor) String() string
String returns the object's -description text, so a wrapper prints usefully under fmt.
func (*NDArrayDescriptor) TransposeDimensionWithDimension ¶ added in v0.17.0
func (nad *NDArrayDescriptor) TransposeDimensionWithDimension(dimensionIndex int, dimensionIndex2 int)
TransposeDimensionWithDimension transpose two dimensions
func (*NDArrayDescriptor) WithDataType ¶ added in v0.17.0
func (nad *NDArrayDescriptor) WithDataType(dataType DataType) *NDArrayDescriptor
WithDataType sets data Type of the MPSNDArray elements
func (*NDArrayDescriptor) WithNumberOfDimensions ¶ added in v0.17.0
func (nad *NDArrayDescriptor) WithNumberOfDimensions(numberOfDimensions int) *NDArrayDescriptor
WithNumberOfDimensions sets the number of dimensions in the NDArray. May not exceed 16. A 0-diumension MPSNDArray is a single scalar value. Undefined dimensions are implicitly length 1.
func (*NDArrayDescriptor) WithPreferPackedRows ¶ added in v0.17.0
func (nad *NDArrayDescriptor) WithPreferPackedRows(preferPackedRows bool) *NDArrayDescriptor
WithPreferPackedRows sets if YES, then new NDArrays created with this descriptor will pack the rows. Default: NO.
type NDArrayProvider ¶ added in v0.17.0
NDArrayProvider is accepted wherever a MPSNDArray (or one of its subclasses) is expected.
type Perm ¶ added in v0.17.0
type Perm int32
const ( PermReadData Perm = 2 PermListDirectory Perm = 2 PermWriteData Perm = 4 PermAddFile Perm = 4 PermExecute Perm = 8 PermSearch Perm = 8 PermDelete Perm = 16 PermAppendData Perm = 32 PermAddSubdirectory Perm = 32 PermDeleteChild Perm = 64 PermReadAttributes Perm = 128 PermWriteAttributes Perm = 256 PermReadExtattributes Perm = 512 PermWriteExtattributes Perm = 1024 PermReadSecurity Perm = 2048 PermWriteSecurity Perm = 4096 PermChangeOwner Perm = 8192 PermSynchronize Perm = 1048576 )
type Predicate ¶ added in v0.17.0
Predicate is an idiomatic wrapper over the Objective-C class MPSPredicate.
func NewPredicate ¶ added in v0.17.0
func NewPredicate() *Predicate
NewPredicate creates a new Predicate.
func PredicateFromID ¶ added in v0.17.0
PredicateFromID adopts an existing Objective-C object as a Predicate (nil for 0), retaining it and registering a release finalizer.
func (*Predicate) Description ¶ added in v0.17.0
Description returns the object's -description text.
func (*Predicate) IsEqual ¶ added in v0.17.0
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*Predicate) IsKind ¶ added in v0.17.0
IsKind reports whether the object is an instance of the named class or a subclass.
func (*Predicate) PredicateOffset ¶ added in v0.17.0
PredicateOffset returns location of the predicate in bytes, must be multiple of four. If the uint32_t value stored at this location in
type PtrauthKey ¶ added in v0.17.0
type PtrauthKey int32
const ( Ptrauth_key_none PtrauthKey = -1 Ptrauth_key_asia PtrauthKey = 0 Ptrauth_key_asib PtrauthKey = 1 Ptrauth_key_asda PtrauthKey = 2 Ptrauth_key_asdb PtrauthKey = 3 Ptrauth_key_process_independent_code PtrauthKey = 0 Ptrauth_key_process_dependent_code PtrauthKey = 1 Ptrauth_key_process_independent_data PtrauthKey = 2 Ptrauth_key_process_dependent_data PtrauthKey = 3 Ptrauth_key_return_address PtrauthKey = 1 Ptrauth_key_frame_pointer PtrauthKey = 3 Ptrauth_key_function_pointer PtrauthKey = 0 Ptrauth_key_block_function PtrauthKey = 0 Ptrauth_key_cxx_vtable_pointer PtrauthKey = 2 Ptrauth_key_method_list_pointer PtrauthKey = 2 Ptrauth_key_objc_isa_pointer PtrauthKey = 2 Ptrauth_key_objc_super_pointer PtrauthKey = 2 Ptrauth_key_objc_sel_pointer PtrauthKey = 3 Ptrauth_key_objc_class_ro_pointer PtrauthKey = 2 Ptrauth_key_block_descriptor_pointer PtrauthKey = 2 Ptrauth_key_init_fini_pointer PtrauthKey = 0 )
func (PtrauthKey) String ¶ added in v0.17.0
func (e PtrauthKey) String() string
String returns the PtrauthKey constant's name, or its numeric form when the value is not a known constant.
type PurgeableState ¶ added in v0.17.0
type PurgeableState uint64
const ( PurgeableStateAllocationDeferred PurgeableState = 0 PurgeableStateKeepCurrent PurgeableState = 1 PurgeableStateNonVolatile PurgeableState = 2 PurgeableStateVolatile PurgeableState = 3 PurgeableStateEmpty PurgeableState = 4 )
func (PurgeableState) String ¶ added in v0.17.0
func (e PurgeableState) String() string
String returns the PurgeableState constant's name, or its numeric form when the value is not a known constant.
type State ¶ added in v0.17.0
State is an idiomatic wrapper over the Objective-C class MPSState.
func NewStateWithResources ¶ added in v0.17.0
NewStateWithResources create a state object with a list of MTLResources 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 StateFromID ¶ added in v0.17.0
StateFromID adopts an existing Objective-C object as a State (nil for 0), retaining it and registering a release finalizer.
func (*State) BufferSizeAtIndex ¶ added in v0.17.0
BufferSizeAtIndex return the buffer size of the MTLBuffer at index or 0 if it is not a MTLBuffer Does not force allocation of the MTLResource
func (*State) Description ¶ added in v0.17.0
Description returns the object's -description text.
func (*State) DestinationImageDescriptorForSourceImagesSourceStatesForKernelSuggestedDescriptor ¶ added in v0.17.0
func (s *State) DestinationImageDescriptorForSourceImagesSourceStatesForKernelSuggestedDescriptor(sourceImages []*Image, sourceStates []*State, kernel *Kernel, inDescriptor *ImageDescriptor) *ImageDescriptor
DestinationImageDescriptorForSourceImagesSourceStatesForKernelSuggestedDescriptor determine padding and sizing of result images 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:
func (*State) IsEqual ¶ added in v0.17.0
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*State) IsKind ¶ added in v0.17.0
IsKind reports whether the object is an instance of the named class or a subclass.
func (*State) IsTemporary ¶ added in v0.17.0
IsTemporary reports whether the object is temporary.
func (*State) Resource ¶ added in v0.18.0
Resource get the private MTLResource underlying the MPSState 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 (*State) ResourceCount ¶ added in v0.17.0
ResourceCount returns the number of MTLResource objects held by the state
func (*State) ResourceSize ¶ added in v0.17.0
ResourceSize get the number of bytes used to allocate underyling MTLResources 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 (*State) ResourceTypeAtIndex ¶ added in v0.17.0
func (s *State) ResourceTypeAtIndex(index int) StateResourceType
ResourceTypeAtIndex return YES if the resource at index is a buffer Does not force allocation of the MTLResource
func (*State) String ¶ added in v0.17.0
String returns the object's -description text, so a wrapper prints usefully under fmt.
func (*State) WithReadCount ¶ added in v0.17.0
WithReadCount sets the read count.
type StateResourceList ¶ added in v0.17.0
StateResourceList is an idiomatic wrapper over the Objective-C class MPSStateResourceList.
func NewStateResourceList ¶ added in v0.17.0
func NewStateResourceList() *StateResourceList
NewStateResourceList creates a new StateResourceList.
func ResourceList ¶ added in v0.17.0
func ResourceList() *StateResourceList
ResourceList returns init an empty autoreleased resource list
func StateResourceListFromID ¶ added in v0.17.0
func StateResourceListFromID(id objc.ID) *StateResourceList
StateResourceListFromID adopts an existing Objective-C object as a StateResourceList (nil for 0), retaining it and registering a release finalizer.
func (*StateResourceList) AppendBuffer ¶ added in v0.17.0
func (srl *StateResourceList) AppendBuffer(size int)
AppendBuffer append a buffer to the resource list
func (*StateResourceList) AppendTexture ¶ added in v0.17.0
func (srl *StateResourceList) AppendTexture(descriptor obj.Object)
AppendTexture append a texture to the resource list
func (*StateResourceList) Description ¶ added in v0.17.0
func (srl *StateResourceList) Description() string
Description returns the object's -description text.
func (*StateResourceList) IsEqual ¶ added in v0.17.0
func (srl *StateResourceList) IsEqual(other obj.Object) bool
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*StateResourceList) IsKind ¶ added in v0.17.0
func (srl *StateResourceList) IsKind(className string) bool
IsKind reports whether the object is an instance of the named class or a subclass.
func (*StateResourceList) String ¶ added in v0.17.0
func (srl *StateResourceList) String() string
String returns the object's -description text, so a wrapper prints usefully under fmt.
type StateResourceType ¶ added in v0.17.0
type StateResourceType uint64
const ( StateResourceTypeNone StateResourceType = 0 StateResourceTypeBuffer StateResourceType = 1 StateResourceTypeTexture StateResourceType = 2 )
func (StateResourceType) String ¶ added in v0.17.0
func (e StateResourceType) String() string
String returns the StateResourceType constant's name, or its numeric form when the value is not a known constant.
type TemporaryImage ¶ added in v0.17.0
type TemporaryImage struct {
Image
}
TemporaryImage is an idiomatic wrapper over the Objective-C class MPSTemporaryImage.
It embeds Image, promoting that type's methods.
func NewTemporaryImage ¶ added in v0.17.0
func NewTemporaryImage() *TemporaryImage
NewTemporaryImage creates a new TemporaryImage.
func TemporaryImageFromID ¶ added in v0.17.0
func TemporaryImageFromID(id objc.ID) *TemporaryImage
TemporaryImageFromID adopts an existing Objective-C object as a TemporaryImage (nil for 0), retaining it and registering a release finalizer.
func (*TemporaryImage) ReadCount ¶ added in v0.17.0
func (ti *TemporaryImage) ReadCount() int
ReadCount returns the read count.
func (*TemporaryImage) WithLabel ¶ added in v0.17.0
func (ti *TemporaryImage) WithLabel(label string) *TemporaryImage
WithLabel sets a string to help identify this object.
func (*TemporaryImage) WithReadCount ¶ added in v0.17.0
func (ti *TemporaryImage) WithReadCount(readCount int) *TemporaryImage
WithReadCount sets the read count.
type TemporaryMatrix ¶ added in v0.17.0
type TemporaryMatrix struct {
Matrix
}
TemporaryMatrix is an idiomatic wrapper over the Objective-C class MPSTemporaryMatrix.
It embeds Matrix, promoting that type's methods.
func NewTemporaryMatrix ¶ added in v0.17.0
func NewTemporaryMatrix() *TemporaryMatrix
NewTemporaryMatrix creates a new TemporaryMatrix.
func TemporaryMatrixFromID ¶ added in v0.17.0
func TemporaryMatrixFromID(id objc.ID) *TemporaryMatrix
TemporaryMatrixFromID adopts an existing Objective-C object as a TemporaryMatrix (nil for 0), retaining it and registering a release finalizer.
func (*TemporaryMatrix) ReadCount ¶ added in v0.17.0
func (tm *TemporaryMatrix) ReadCount() int
ReadCount returns the number of times a temporary matrix may be read by a MPSMatrix... kernel before its contents become undefined. 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 (*TemporaryMatrix) WithReadCount ¶ added in v0.17.0
func (tm *TemporaryMatrix) WithReadCount(readCount int) *TemporaryMatrix
WithReadCount sets the number of times a temporary matrix may be read by a MPSMatrix... kernel before its contents become undefined. 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.
type TemporaryNDArray ¶ added in v0.17.0
type TemporaryNDArray struct {
NDArray
}
TemporaryNDArray is an idiomatic wrapper over the Objective-C class MPSTemporaryNDArray.
It embeds NDArray, promoting that type's methods.
func NewTemporaryNDArray ¶ added in v0.17.0
func NewTemporaryNDArray() *TemporaryNDArray
NewTemporaryNDArray creates a new TemporaryNDArray.
func TemporaryNDArrayFromID ¶ added in v0.17.0
func TemporaryNDArrayFromID(id objc.ID) *TemporaryNDArray
TemporaryNDArrayFromID adopts an existing Objective-C object as a TemporaryNDArray (nil for 0), retaining it and registering a release finalizer.
func (*TemporaryNDArray) ReadCount ¶ added in v0.17.0
func (tna *TemporaryNDArray) ReadCount() int
ReadCount returns the number of times a temporary MPSNDArray may be read by a MPSNDArray... kernel before its contents become undefined. 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 (*TemporaryNDArray) WithLabel ¶ added in v0.17.0
func (tna *TemporaryNDArray) WithLabel(label string) *TemporaryNDArray
WithLabel sets a used specified string to help identify the array during debugging. May be externally visible to tools like Instruments
func (*TemporaryNDArray) WithReadCount ¶ added in v0.17.0
func (tna *TemporaryNDArray) WithReadCount(readCount int) *TemporaryNDArray
WithReadCount sets the number of times a temporary MPSNDArray may be read by a MPSNDArray... kernel before its contents become undefined. 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.
type TemporaryVector ¶ added in v0.17.0
type TemporaryVector struct {
Vector
}
TemporaryVector is an idiomatic wrapper over the Objective-C class MPSTemporaryVector.
It embeds Vector, promoting that type's methods.
func NewTemporaryVector ¶ added in v0.17.0
func NewTemporaryVector() *TemporaryVector
NewTemporaryVector creates a new TemporaryVector.
func TemporaryVectorFromID ¶ added in v0.17.0
func TemporaryVectorFromID(id objc.ID) *TemporaryVector
TemporaryVectorFromID adopts an existing Objective-C object as a TemporaryVector (nil for 0), retaining it and registering a release finalizer.
func (*TemporaryVector) ReadCount ¶ added in v0.17.0
func (tv *TemporaryVector) ReadCount() int
ReadCount returns the number of times a temporary vector may be read by a MPSMatrix... kernel before its contents become undefined. 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 (*TemporaryVector) WithReadCount ¶ added in v0.17.0
func (tv *TemporaryVector) WithReadCount(readCount int) *TemporaryVector
WithReadCount sets the number of times a temporary vector may be read by a MPSMatrix... kernel before its contents become undefined. 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.
type Vector ¶ added in v0.17.0
Vector is an idiomatic wrapper over the Objective-C class MPSVector.
Vector is an abstract base — you do not construct it directly. Construct one of TemporaryVector and pass it where a Vector is accepted.
func VectorFromID ¶ added in v0.17.0
VectorFromID adopts an existing Objective-C object as a Vector (nil for 0), retaining it and registering a release finalizer.
func (*Vector) Description ¶ added in v0.17.0
Description returns the object's -description text.
func (*Vector) IsEqual ¶ added in v0.17.0
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*Vector) IsKind ¶ added in v0.17.0
IsKind reports whether the object is an instance of the named class or a subclass.
func (*Vector) Offset ¶ added in v0.17.0
Offset returns byte-offset to the buffer where the vector data begins - see
func (*Vector) ResourceSize ¶ added in v0.17.0
ResourceSize get the number of bytes used to allocate underyling MTLResources 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 (*Vector) String ¶ added in v0.17.0
String returns the object's -description text, so a wrapper prints usefully under fmt.
func (*Vector) VectorBytes ¶ added in v0.17.0
VectorBytes returns the stride, in bytes, between corresponding elements of consecutive vectors.
type VectorDescriptor ¶ added in v0.17.0
VectorDescriptor is an idiomatic wrapper over the Objective-C class MPSVectorDescriptor.
func NewVectorDescriptor ¶ added in v0.17.0
func NewVectorDescriptor() *VectorDescriptor
NewVectorDescriptor creates a new VectorDescriptor.
func VectorDescriptorFromID ¶ added in v0.17.0
func VectorDescriptorFromID(id objc.ID) *VectorDescriptor
VectorDescriptorFromID adopts an existing Objective-C object as a VectorDescriptor (nil for 0), retaining it and registering a release finalizer.
func VectorDescriptorWithLengthDataType ¶ added in v0.17.0
func VectorDescriptorWithLengthDataType(length int, dataType DataType) *VectorDescriptor
VectorDescriptorWithLengthDataType create a MPSVectorDescriptor with the specified length and data type. Use this function for creating a descriptor of a MPSVector object containing a single vector.
func VectorDescriptorWithLengthVectorsVectorBytesDataType ¶ added in v0.17.0
func VectorDescriptorWithLengthVectorsVectorBytesDataType(length int, vectors int, vectorBytes int, dataType DataType) *VectorDescriptor
VectorDescriptorWithLengthVectorsVectorBytesDataType create a MPSVectorDescriptor with the specified length and data type. 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 (*VectorDescriptor) DataType ¶ added in v0.17.0
func (vd *VectorDescriptor) DataType() DataType
DataType returns the type of the data which makes up the values of the vector.
func (*VectorDescriptor) Description ¶ added in v0.17.0
func (vd *VectorDescriptor) Description() string
Description returns the object's -description text.
func (*VectorDescriptor) IsEqual ¶ added in v0.17.0
func (vd *VectorDescriptor) IsEqual(other obj.Object) bool
IsEqual reports Objective-C equality (isEqual:) with another object.
func (*VectorDescriptor) IsKind ¶ added in v0.17.0
func (vd *VectorDescriptor) IsKind(className string) bool
IsKind reports whether the object is an instance of the named class or a subclass.
func (*VectorDescriptor) Length ¶ added in v0.17.0
func (vd *VectorDescriptor) Length() int
Length returns the number of elements in the vector.
func (*VectorDescriptor) String ¶ added in v0.17.0
func (vd *VectorDescriptor) String() string
String returns the object's -description text, so a wrapper prints usefully under fmt.
func (*VectorDescriptor) VectorBytes ¶ added in v0.17.0
func (vd *VectorDescriptor) VectorBytes() int
VectorBytes returns the stride, in bytes, between corresponding elements of consecutive vectors. Must be a multiple of the element size
func (*VectorDescriptor) Vectors ¶ added in v0.17.0
func (vd *VectorDescriptor) Vectors() int
Vectors returns the number of vectors.
func (*VectorDescriptor) WithDataType ¶ added in v0.17.0
func (vd *VectorDescriptor) WithDataType(dataType DataType) *VectorDescriptor
WithDataType sets the type of the data which makes up the values of the vector.
func (*VectorDescriptor) WithLength ¶ added in v0.17.0
func (vd *VectorDescriptor) WithLength(length int) *VectorDescriptor
WithLength sets the number of elements in the vector.
type VectorProvider ¶ added in v0.17.0
VectorProvider is accepted wherever a MPSVector (or one of its subclasses) is expected.
type VirtualMemoryGuardExceptionCode ¶ added in v0.17.0
type VirtualMemoryGuardExceptionCode uint32
const ( KGUARD_EXC_DEALLOC_GAP VirtualMemoryGuardExceptionCode = 1 KGUARD_EXC_RECLAIM_COPYIO_FAILURE VirtualMemoryGuardExceptionCode = 2 KGUARD_EXC_RECLAIM_INDEX_FAILURE VirtualMemoryGuardExceptionCode = 4 KGUARD_EXC_RECLAIM_DEALLOCATE_FAILURE VirtualMemoryGuardExceptionCode = 8 KGUARD_EXC_RECLAIM_ACCOUNTING_FAILURE VirtualMemoryGuardExceptionCode = 9 KGUARD_EXC_SEC_IOPL_ON_EXEC_PAGE VirtualMemoryGuardExceptionCode = 10 KGUARD_EXC_SEC_EXEC_ON_IOPL_PAGE VirtualMemoryGuardExceptionCode = 11 KGUARD_EXC_SEC_UPL_WRITE_ON_EXEC_REGION VirtualMemoryGuardExceptionCode = 12 KGUARD_EXC_LARGE_ALLOCATION_TELEMETRY VirtualMemoryGuardExceptionCode = 13 KGUARD_EXC_SEC_ACCESS_FAULT VirtualMemoryGuardExceptionCode = 98 KGUARD_EXC_SEC_ASYNC_ACCESS_FAULT VirtualMemoryGuardExceptionCode = 99 KGUARD_EXC_SEC_COPY_DENIED VirtualMemoryGuardExceptionCode = 100 KGUARD_EXC_SEC_SHARING_DENIED VirtualMemoryGuardExceptionCode = 101 KGUARD_EXC_MTE_SYNC_FAULT VirtualMemoryGuardExceptionCode = 200 KGUARD_EXC_MTE_ASYNC_USER_FAULT VirtualMemoryGuardExceptionCode = 201 KGUARD_EXC_MTE_ASYNC_KERN_FAULT VirtualMemoryGuardExceptionCode = 202 KGUARD_EXC_GUARD_OBJECT_ASYNC_USER_FAULT VirtualMemoryGuardExceptionCode = 203 KGUARD_EXC_GUARD_OBJECT_ASYNC_KERN_FAULT VirtualMemoryGuardExceptionCode = 204 )
func (VirtualMemoryGuardExceptionCode) String ¶ added in v0.17.0
func (e VirtualMemoryGuardExceptionCode) String() string
String returns the VirtualMemoryGuardExceptionCode constant's name, or its numeric form when the value is not a known constant.
type XpcListenerCreateFlags ¶ added in v0.17.0
type XpcListenerCreateFlags uint64
Bitmask — values may be combined with |.
const ( XpcListenerCreateFlagsNone XpcListenerCreateFlags = 0 XpcListenerCreateFlagsInactive XpcListenerCreateFlags = 1 XpcListenerCreateFlagsForceMach XpcListenerCreateFlags = 2 XpcListenerCreateFlagsForceXpcservice XpcListenerCreateFlags = 4 )
func (XpcListenerCreateFlags) String ¶ added in v0.17.0
func (e XpcListenerCreateFlags) String() string
String returns the XpcListenerCreateFlags constant's name, or its numeric form when the value is not a known constant.
type XpcSessionCreateFlags ¶ added in v0.17.0
type XpcSessionCreateFlags uint64
Bitmask — values may be combined with |.
const ( XpcSessionCreateFlagsNone XpcSessionCreateFlags = 0 XpcSessionCreateFlagsInactive XpcSessionCreateFlags = 1 XpcSessionCreateFlagsMachPrivileged XpcSessionCreateFlags = 2 )
func (XpcSessionCreateFlags) String ¶ added in v0.17.0
func (e XpcSessionCreateFlags) String() string
String returns the XpcSessionCreateFlags constant's name, or its numeric form when the value is not a known constant.
Source Files
¶
- MPSCommandBuffer_generated.go
- MPSImageDescriptor_generated.go
- MPSImage_generated.go
- MPSKernel_generated.go
- MPSKeyedUnarchiver_generated.go
- MPSMatrixDescriptor_generated.go
- MPSMatrix_generated.go
- MPSNDArrayDescriptor_generated.go
- MPSNDArray_generated.go
- MPSPredicate_generated.go
- MPSStateResourceList_generated.go
- MPSState_generated.go
- MPSTemporaryImage_generated.go
- MPSTemporaryMatrix_generated.go
- MPSTemporaryNDArray_generated.go
- MPSTemporaryVector_generated.go
- MPSVectorDescriptor_generated.go
- MPSVector_generated.go
- doc.go
- mpscore_cfunctions_generated.go
- mpscore_classmethods_generated.go
- mpscore_constants_generated.go
- mpscore_enums_generated.go
- mpscore_protocols_generated.go
- mpscore_providers_generated.go
- mpscore_runtime_generated.go
- mpscore_structs_generated.go