Class MPSPredicate

  • All Implemented Interfaces:
    NSObject

    public class MPSPredicate
    extends NSObject
    MPSPredicate [@dependency] This depends on Metal.framework A MPSPredicate can be used to run MPS kernels subject to a predicate. The MPSPredicate defines a way to refrain running a kernel on the GPU based on values computed on the GPU. That way one can build control flow operations that do the decisions on the GPU side mitigating the need to synchronize CPU and GPU execution. The predicate is used with the version of encode calls that take a object of type @ref MPSKernelEncodeOptions as a parameter (@see MPSCNNKernel for example). The code associated with the kernel's encode call is executed on the GPU if and only if the predicate is considered to be true. NOTE: It is advisable to release MPSPredicate objects promptly as they take a reference to a MTLBuffer object and therefore can keep the memory allocated for long periods of time.
    • Constructor Detail

      • MPSPredicate

        protected MPSPredicate​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • initWithBufferOffset

        public MPSPredicate initWithBufferOffset​(MTLBuffer buffer,
                                                 long offset)
        Initializes a MPSPredicate object with a buffer and given offset.
        Parameters:
        buffer - The buffer to use as a predicate.
        offset - Byteoffset to the predicate buffer where the predicate is stored.
        Returns:
        A pointer to the newly initialized MPSPredicate object.
      • initWithDevice

        public MPSPredicate initWithDevice​(MTLDevice device)
        Initializes a MPSPredicate object for a given device. NOTE: The metal buffer used by the resulting MPSPredicate object may be shared among many MPSPredicate objects and therefore care must be used when writing to this buffer: writing to any other location in this buffer than the four bytes at the offset @ref predicateOffset results in undefined behavior.
        Parameters:
        device - The device the predicate is used with
        Returns:
        A pointer to the newly initialized MPSPredicate object.
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • predicateBuffer

        public MTLBuffer predicateBuffer()
        [@property] predicateBuffer The buffer that is used as the predicate
      • predicateOffset

        public long predicateOffset()
        [@property] predicateOffset Location of the predicate in bytes, must be multiple of four. If the uint32_t value stored at this location in @ref predicateBuffer is other than zero, then the predicate is considered to be true and the code is executed on the GPU. With this property a single MPSPredicate object can be used with multiple different predication operations. Default = 0;
      • predicateWithBufferOffset

        public static MPSPredicate predicateWithBufferOffset​(MTLBuffer buffer,
                                                             long offset)
        Initializes a MPSPredicate object with a buffer and given offset.
        Parameters:
        buffer - The buffer to use as a predicate.
        offset - Byteoffset to the predicate buffer where the predicate is stored.
        Returns:
        A pointer to the newly initialized MPSPredicate object.
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()