MPSState(3) MetalPerformanceShaders.framework MPSState(3)
NAME
MPSState
SYNOPSIS
#import <MPSState.h>
Inherits NSObject.
Inherited by MPSCNNConvolutionState, MPSRNNRecurrentImageState, and
MPSRNNRecurrentMatrixState.
Instance Methods
(nullable instancetype) - init
Properties
NSUInteger readCount
BOOL isTemporary
NSString * label
Detailed Description
This depends on Metal Framework An opaque data container for large
storage in MPS CNN filters Some MPS CNN kernels produce additional
information beyond a MPSImage. These may be pooling indices where the
result came from, convolution weights, or other information not
contained in the usual MPSImage result from a MPSCNNKernel. A MPSState
object typically contains one or more expensive MTLResources such as
textures or buffers to store this information. It provides a base class
with interfaces for managing this storage. Child classes may add
additional functionality specific to their contents.
Some MPSState objects are temporary. Temporary state objects, like
MPSTemporaryImages and Matrices, are for very short lived storage,
perhaps just a few lines of code within the scope of a single
MTLCommandBuffer. They are very efficient for storage, as several
temporary objects can share the same memory over the course of a
MTLCommandBuffer. This can improve both memory usage and time spent in
the kernel wiring down memory and such. You may find that some large
CNN tasks can not be computed without them, as non-temporary storage
would simply take up too much memory.
In exchange, the lifetime of the underlying storage in temporary
MPSState objects needs to be carefully managed. ARC often waits until
the end of scope to release objects. Temporary storage often needs to
be released sooner than that. Consequently the lifetime of the data in
the underlying MTLResources is managed by a readCount property. Each
time a MPSCNNKernel reads a temporary MPSState object the readCount is
automatically decremented. When it reaches zero, the underlying storage
is recycled for use by other MPS temporary objects, and the data is
becomes undefined. If you need to consume the data multiple times, you
should set the readCount to a larger number to prevent the data from
becomming undefined. You may set the readCount to 0 yourself to return
the storage to MPS, if for any reason, you realize that the MPSState
object will no longer be used.
The contents of a temporary MPSState object are only valid from
creation to the time the readCount reaches 0. The data is only valid
for the MTLCommandBuffer on which it was created. Non-temporary
MPSState objects are valid on any MTLCommandBuffer on the same device
until they are released.
Method Documentation
- (nullable instancetype) init
Property Documentation
- (BOOL) isTemporary [read], [nonatomic], [assign]
- label [read], [write], [atomic], [copy]
A string to help identify this object.
- (NSUInteger) readCount [read], [write], [nonatomic], [assign]
Author
Generated automatically by Doxygen for
MetalPerformanceShaders.framework from the source code.
Version MetalPerformanceShaders-Thu2Jul 13 2017 MPSState(3)
Mac OS X 10.12.6 - Generated Tue Oct 31 19:57:06 CDT 2017