objc2_metal_performance_shaders/generated/MPSNDArray/
MPSNDArrayQuantizedMatrixMultiplication.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7use objc2_metal::*;
8
9use crate::*;
10
11extern_class!(
12    /// Dependencies: This depends on Metal.framework.
13    ///
14    /// A quantized matrix multiplication kernel: C = AB, where each input A and B can be quantized.
15    ///
16    /// The kernel works with 2-8 inputs, order of inputs: First all LHS inputs, then all RHS inputs.
17    /// The order of inputs for LUT based LHS or RHS: 1) quantized input 2) Lookup Table.
18    /// The order of inputs for affine LHS or RHS: 1) quantized input 2) scale 3) zeropoint 4) minValue.
19    /// The full order of inputs for the encode methods is:
20    /// `[LHS, RHS,
21    /// <LHS
22    /// quantization inputs>,
23    /// <RHS
24    /// quantization inputs>]`,
25    /// where `LHS` is the left input (quantized or float) `RHS` is the right input (quantized or float) and
26    /// `
27    /// <LHS
28    /// quantization inputs>` are the auxiliary quantization inputs for the LHS array (scales, zeropoints etc).
29    /// and `
30    /// <RHS
31    /// quantization inputs>` are the auxiliary quantization input for the RHS array.
32    /// The inputs are provided as a compacted `NSArray
33    /// <MPSNDArray
34    /// *>`, for example for computing
35    /// `C = A * B^T` where `A` is quantized with a LUT and `B` is quantized with affine quantization that
36    /// uses scale and minValue the array of inputs is:
37    /// ` [ Aq, Bq^T, ALUT, BScale^T, BMin^T ] `.
38    /// NOTE: For affine scale, zeropoint and minValue must have same transposes as quantized input.
39    ///
40    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsndarrayquantizedmatrixmultiplication?language=objc)
41    #[unsafe(super(
42        MPSNDArrayMatrixMultiplication,
43        MPSNDArrayMultiaryKernel,
44        MPSNDArrayMultiaryBase,
45        MPSKernel,
46        NSObject
47    ))]
48    #[derive(Debug, PartialEq, Eq, Hash)]
49    #[cfg(all(
50        feature = "MPSCore",
51        feature = "MPSKernel",
52        feature = "MPSNDArrayKernel",
53        feature = "MPSNDArrayMatrixMultiplication"
54    ))]
55    pub struct MPSNDArrayQuantizedMatrixMultiplication;
56);
57
58#[cfg(all(
59    feature = "MPSCore",
60    feature = "MPSKernel",
61    feature = "MPSNDArrayKernel",
62    feature = "MPSNDArrayMatrixMultiplication"
63))]
64extern_conformance!(
65    unsafe impl NSCoding for MPSNDArrayQuantizedMatrixMultiplication {}
66);
67
68#[cfg(all(
69    feature = "MPSCore",
70    feature = "MPSKernel",
71    feature = "MPSNDArrayKernel",
72    feature = "MPSNDArrayMatrixMultiplication"
73))]
74extern_conformance!(
75    unsafe impl NSCopying for MPSNDArrayQuantizedMatrixMultiplication {}
76);
77
78#[cfg(all(
79    feature = "MPSCore",
80    feature = "MPSKernel",
81    feature = "MPSNDArrayKernel",
82    feature = "MPSNDArrayMatrixMultiplication"
83))]
84unsafe impl CopyingHelper for MPSNDArrayQuantizedMatrixMultiplication {
85    type Result = Self;
86}
87
88#[cfg(all(
89    feature = "MPSCore",
90    feature = "MPSKernel",
91    feature = "MPSNDArrayKernel",
92    feature = "MPSNDArrayMatrixMultiplication"
93))]
94extern_conformance!(
95    unsafe impl NSObjectProtocol for MPSNDArrayQuantizedMatrixMultiplication {}
96);
97
98#[cfg(all(
99    feature = "MPSCore",
100    feature = "MPSKernel",
101    feature = "MPSNDArrayKernel",
102    feature = "MPSNDArrayMatrixMultiplication"
103))]
104extern_conformance!(
105    unsafe impl NSSecureCoding for MPSNDArrayQuantizedMatrixMultiplication {}
106);
107
108#[cfg(all(
109    feature = "MPSCore",
110    feature = "MPSKernel",
111    feature = "MPSNDArrayKernel",
112    feature = "MPSNDArrayMatrixMultiplication"
113))]
114impl MPSNDArrayQuantizedMatrixMultiplication {
115    extern_methods!(
116        #[unsafe(method(initWithDevice:sourceCount:))]
117        #[unsafe(method_family = init)]
118        pub unsafe fn initWithDevice_sourceCount(
119            this: Allocated<Self>,
120            device: &ProtocolObject<dyn MTLDevice>,
121            source_count: NSUInteger,
122        ) -> Retained<Self>;
123
124        #[cfg(feature = "MPSNDArrayQuantization")]
125        /// Initializes a quantized matrix multiplication kernel.
126        ///
127        /// Parameter `leftQuantizationDescriptor`: The quantization definition for the LHS input.
128        ///
129        /// Parameter `rightQuantizationDescriptor`: The quantization definition for the RHS input.
130        ///
131        /// Returns: A new valid quantized matrix multiplication kernel.
132        #[unsafe(method(initWithDevice:leftQuantizationDescriptor:rightQuantizationDescriptor:))]
133        #[unsafe(method_family = init)]
134        pub unsafe fn initWithDevice_leftQuantizationDescriptor_rightQuantizationDescriptor(
135            this: Allocated<Self>,
136            device: &ProtocolObject<dyn MTLDevice>,
137            left_quantization_descriptor: Option<&MPSNDArrayQuantizationDescriptor>,
138            right_quantization_descriptor: Option<&MPSNDArrayQuantizationDescriptor>,
139        ) -> Retained<Self>;
140    );
141}
142
143/// Methods declared on superclass `MPSNDArrayMultiaryKernel`.
144#[cfg(all(
145    feature = "MPSCore",
146    feature = "MPSKernel",
147    feature = "MPSNDArrayKernel",
148    feature = "MPSNDArrayMatrixMultiplication"
149))]
150impl MPSNDArrayQuantizedMatrixMultiplication {
151    extern_methods!(
152        /// # Safety
153        ///
154        /// `coder` possibly has further requirements.
155        #[unsafe(method(initWithCoder:device:))]
156        #[unsafe(method_family = init)]
157        pub unsafe fn initWithCoder_device(
158            this: Allocated<Self>,
159            coder: &NSCoder,
160            device: &ProtocolObject<dyn MTLDevice>,
161        ) -> Retained<Self>;
162    );
163}
164
165/// Methods declared on superclass `MPSNDArrayMultiaryBase`.
166#[cfg(all(
167    feature = "MPSCore",
168    feature = "MPSKernel",
169    feature = "MPSNDArrayKernel",
170    feature = "MPSNDArrayMatrixMultiplication"
171))]
172impl MPSNDArrayQuantizedMatrixMultiplication {
173    extern_methods!(
174        #[unsafe(method(initWithDevice:))]
175        #[unsafe(method_family = init)]
176        pub unsafe fn initWithDevice(
177            this: Allocated<Self>,
178            device: &ProtocolObject<dyn MTLDevice>,
179        ) -> Retained<Self>;
180    );
181}
182
183/// Methods declared on superclass `MPSKernel`.
184#[cfg(all(
185    feature = "MPSCore",
186    feature = "MPSKernel",
187    feature = "MPSNDArrayKernel",
188    feature = "MPSNDArrayMatrixMultiplication"
189))]
190impl MPSNDArrayQuantizedMatrixMultiplication {
191    extern_methods!(
192        /// Called by NSCoder to decode MPSKernels
193        ///
194        /// This isn't the right interface to decode a MPSKernel, but
195        /// it is the one that NSCoder uses. To enable your NSCoder
196        /// (e.g. NSKeyedUnarchiver) to set which device to use
197        /// extend the object to adopt the MPSDeviceProvider
198        /// protocol. Otherwise, the Metal system default device
199        /// will be used.
200        ///
201        /// # Safety
202        ///
203        /// `a_decoder` possibly has further requirements.
204        #[unsafe(method(initWithCoder:))]
205        #[unsafe(method_family = init)]
206        pub unsafe fn initWithCoder(
207            this: Allocated<Self>,
208            a_decoder: &NSCoder,
209        ) -> Option<Retained<Self>>;
210    );
211}
212
213/// Methods declared on superclass `NSObject`.
214#[cfg(all(
215    feature = "MPSCore",
216    feature = "MPSKernel",
217    feature = "MPSNDArrayKernel",
218    feature = "MPSNDArrayMatrixMultiplication"
219))]
220impl MPSNDArrayQuantizedMatrixMultiplication {
221    extern_methods!(
222        #[unsafe(method(init))]
223        #[unsafe(method_family = init)]
224        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
225
226        #[unsafe(method(new))]
227        #[unsafe(method_family = new)]
228        pub unsafe fn new() -> Retained<Self>;
229    );
230}
231
232extern_class!(
233    /// Dependencies: This depends on Metal.framework.
234    ///
235    /// A kernel which dequantizes a lookup-table based NDArray.
236    ///
237    /// The kernel works with 2 inputs: 1) The quantized input, 2) The LookUp table array.
238    ///
239    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsndarraylutdequantize?language=objc)
240    #[unsafe(super(MPSNDArrayMultiaryKernel, MPSNDArrayMultiaryBase, MPSKernel, NSObject))]
241    #[derive(Debug, PartialEq, Eq, Hash)]
242    #[cfg(all(
243        feature = "MPSCore",
244        feature = "MPSKernel",
245        feature = "MPSNDArrayKernel"
246    ))]
247    pub struct MPSNDArrayLUTDequantize;
248);
249
250#[cfg(all(
251    feature = "MPSCore",
252    feature = "MPSKernel",
253    feature = "MPSNDArrayKernel"
254))]
255extern_conformance!(
256    unsafe impl NSCoding for MPSNDArrayLUTDequantize {}
257);
258
259#[cfg(all(
260    feature = "MPSCore",
261    feature = "MPSKernel",
262    feature = "MPSNDArrayKernel"
263))]
264extern_conformance!(
265    unsafe impl NSCopying for MPSNDArrayLUTDequantize {}
266);
267
268#[cfg(all(
269    feature = "MPSCore",
270    feature = "MPSKernel",
271    feature = "MPSNDArrayKernel"
272))]
273unsafe impl CopyingHelper for MPSNDArrayLUTDequantize {
274    type Result = Self;
275}
276
277#[cfg(all(
278    feature = "MPSCore",
279    feature = "MPSKernel",
280    feature = "MPSNDArrayKernel"
281))]
282extern_conformance!(
283    unsafe impl NSObjectProtocol for MPSNDArrayLUTDequantize {}
284);
285
286#[cfg(all(
287    feature = "MPSCore",
288    feature = "MPSKernel",
289    feature = "MPSNDArrayKernel"
290))]
291extern_conformance!(
292    unsafe impl NSSecureCoding for MPSNDArrayLUTDequantize {}
293);
294
295#[cfg(all(
296    feature = "MPSCore",
297    feature = "MPSKernel",
298    feature = "MPSNDArrayKernel"
299))]
300impl MPSNDArrayLUTDequantize {
301    extern_methods!(
302        #[unsafe(method(initWithDevice:))]
303        #[unsafe(method_family = init)]
304        pub unsafe fn initWithDevice(
305            this: Allocated<Self>,
306            device: &ProtocolObject<dyn MTLDevice>,
307        ) -> Retained<Self>;
308
309        #[unsafe(method(initWithDevice:sourceCount:))]
310        #[unsafe(method_family = init)]
311        pub unsafe fn initWithDevice_sourceCount(
312            this: Allocated<Self>,
313            device: &ProtocolObject<dyn MTLDevice>,
314            source_count: NSUInteger,
315        ) -> Retained<Self>;
316    );
317}
318
319/// Methods declared on superclass `MPSNDArrayMultiaryKernel`.
320#[cfg(all(
321    feature = "MPSCore",
322    feature = "MPSKernel",
323    feature = "MPSNDArrayKernel"
324))]
325impl MPSNDArrayLUTDequantize {
326    extern_methods!(
327        /// # Safety
328        ///
329        /// `coder` possibly has further requirements.
330        #[unsafe(method(initWithCoder:device:))]
331        #[unsafe(method_family = init)]
332        pub unsafe fn initWithCoder_device(
333            this: Allocated<Self>,
334            coder: &NSCoder,
335            device: &ProtocolObject<dyn MTLDevice>,
336        ) -> Retained<Self>;
337    );
338}
339
340/// Methods declared on superclass `MPSKernel`.
341#[cfg(all(
342    feature = "MPSCore",
343    feature = "MPSKernel",
344    feature = "MPSNDArrayKernel"
345))]
346impl MPSNDArrayLUTDequantize {
347    extern_methods!(
348        /// Called by NSCoder to decode MPSKernels
349        ///
350        /// This isn't the right interface to decode a MPSKernel, but
351        /// it is the one that NSCoder uses. To enable your NSCoder
352        /// (e.g. NSKeyedUnarchiver) to set which device to use
353        /// extend the object to adopt the MPSDeviceProvider
354        /// protocol. Otherwise, the Metal system default device
355        /// will be used.
356        ///
357        /// # Safety
358        ///
359        /// `a_decoder` possibly has further requirements.
360        #[unsafe(method(initWithCoder:))]
361        #[unsafe(method_family = init)]
362        pub unsafe fn initWithCoder(
363            this: Allocated<Self>,
364            a_decoder: &NSCoder,
365        ) -> Option<Retained<Self>>;
366    );
367}
368
369/// Methods declared on superclass `NSObject`.
370#[cfg(all(
371    feature = "MPSCore",
372    feature = "MPSKernel",
373    feature = "MPSNDArrayKernel"
374))]
375impl MPSNDArrayLUTDequantize {
376    extern_methods!(
377        #[unsafe(method(init))]
378        #[unsafe(method_family = init)]
379        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
380
381        #[unsafe(method(new))]
382        #[unsafe(method_family = new)]
383        pub unsafe fn new() -> Retained<Self>;
384    );
385}
386
387extern_class!(
388    /// Dependencies: This depends on Metal.framework.
389    ///
390    /// A kernel which dequantizes a lookup-table based NDArray with vector LUT support.
391    ///
392    /// The kernel works with 2 inputs: 1) The quantized input, 2) The LookUp table array.
393    ///
394    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsndarrayvectorlutdequantize?language=objc)
395    #[unsafe(super(MPSNDArrayMultiaryKernel, MPSNDArrayMultiaryBase, MPSKernel, NSObject))]
396    #[derive(Debug, PartialEq, Eq, Hash)]
397    #[cfg(all(
398        feature = "MPSCore",
399        feature = "MPSKernel",
400        feature = "MPSNDArrayKernel"
401    ))]
402    pub struct MPSNDArrayVectorLUTDequantize;
403);
404
405#[cfg(all(
406    feature = "MPSCore",
407    feature = "MPSKernel",
408    feature = "MPSNDArrayKernel"
409))]
410extern_conformance!(
411    unsafe impl NSCoding for MPSNDArrayVectorLUTDequantize {}
412);
413
414#[cfg(all(
415    feature = "MPSCore",
416    feature = "MPSKernel",
417    feature = "MPSNDArrayKernel"
418))]
419extern_conformance!(
420    unsafe impl NSCopying for MPSNDArrayVectorLUTDequantize {}
421);
422
423#[cfg(all(
424    feature = "MPSCore",
425    feature = "MPSKernel",
426    feature = "MPSNDArrayKernel"
427))]
428unsafe impl CopyingHelper for MPSNDArrayVectorLUTDequantize {
429    type Result = Self;
430}
431
432#[cfg(all(
433    feature = "MPSCore",
434    feature = "MPSKernel",
435    feature = "MPSNDArrayKernel"
436))]
437extern_conformance!(
438    unsafe impl NSObjectProtocol for MPSNDArrayVectorLUTDequantize {}
439);
440
441#[cfg(all(
442    feature = "MPSCore",
443    feature = "MPSKernel",
444    feature = "MPSNDArrayKernel"
445))]
446extern_conformance!(
447    unsafe impl NSSecureCoding for MPSNDArrayVectorLUTDequantize {}
448);
449
450#[cfg(all(
451    feature = "MPSCore",
452    feature = "MPSKernel",
453    feature = "MPSNDArrayKernel"
454))]
455impl MPSNDArrayVectorLUTDequantize {
456    extern_methods!(
457        /// Which axis in the destination will receive the vector component, must be less than 4.
458        #[unsafe(method(vectorAxis))]
459        #[unsafe(method_family = none)]
460        pub unsafe fn vectorAxis(&self) -> NSUInteger;
461
462        /// Setter for [`vectorAxis`][Self::vectorAxis].
463        #[unsafe(method(setVectorAxis:))]
464        #[unsafe(method_family = none)]
465        pub unsafe fn setVectorAxis(&self, vector_axis: NSUInteger);
466
467        /// Initializes a kernel for vector-based LUT dequantization.
468        ///
469        /// Parameter `device`: The Metal device to be used with this kernel.
470        ///
471        /// Parameter `axis`: The vector axis in the output.
472        ///
473        /// Returns: A new vector LUT dequantization kernel.
474        #[unsafe(method(initWithDevice:axis:))]
475        #[unsafe(method_family = init)]
476        pub unsafe fn initWithDevice_axis(
477            this: Allocated<Self>,
478            device: &ProtocolObject<dyn MTLDevice>,
479            axis: NSUInteger,
480        ) -> Retained<Self>;
481
482        #[unsafe(method(initWithDevice:sourceCount:))]
483        #[unsafe(method_family = init)]
484        pub unsafe fn initWithDevice_sourceCount(
485            this: Allocated<Self>,
486            device: &ProtocolObject<dyn MTLDevice>,
487            source_count: NSUInteger,
488        ) -> Retained<Self>;
489    );
490}
491
492/// Methods declared on superclass `MPSNDArrayMultiaryKernel`.
493#[cfg(all(
494    feature = "MPSCore",
495    feature = "MPSKernel",
496    feature = "MPSNDArrayKernel"
497))]
498impl MPSNDArrayVectorLUTDequantize {
499    extern_methods!(
500        /// # Safety
501        ///
502        /// `coder` possibly has further requirements.
503        #[unsafe(method(initWithCoder:device:))]
504        #[unsafe(method_family = init)]
505        pub unsafe fn initWithCoder_device(
506            this: Allocated<Self>,
507            coder: &NSCoder,
508            device: &ProtocolObject<dyn MTLDevice>,
509        ) -> Retained<Self>;
510    );
511}
512
513/// Methods declared on superclass `MPSNDArrayMultiaryBase`.
514#[cfg(all(
515    feature = "MPSCore",
516    feature = "MPSKernel",
517    feature = "MPSNDArrayKernel"
518))]
519impl MPSNDArrayVectorLUTDequantize {
520    extern_methods!(
521        #[unsafe(method(initWithDevice:))]
522        #[unsafe(method_family = init)]
523        pub unsafe fn initWithDevice(
524            this: Allocated<Self>,
525            device: &ProtocolObject<dyn MTLDevice>,
526        ) -> Retained<Self>;
527    );
528}
529
530/// Methods declared on superclass `MPSKernel`.
531#[cfg(all(
532    feature = "MPSCore",
533    feature = "MPSKernel",
534    feature = "MPSNDArrayKernel"
535))]
536impl MPSNDArrayVectorLUTDequantize {
537    extern_methods!(
538        /// Called by NSCoder to decode MPSKernels
539        ///
540        /// This isn't the right interface to decode a MPSKernel, but
541        /// it is the one that NSCoder uses. To enable your NSCoder
542        /// (e.g. NSKeyedUnarchiver) to set which device to use
543        /// extend the object to adopt the MPSDeviceProvider
544        /// protocol. Otherwise, the Metal system default device
545        /// will be used.
546        ///
547        /// # Safety
548        ///
549        /// `a_decoder` possibly has further requirements.
550        #[unsafe(method(initWithCoder:))]
551        #[unsafe(method_family = init)]
552        pub unsafe fn initWithCoder(
553            this: Allocated<Self>,
554            a_decoder: &NSCoder,
555        ) -> Option<Retained<Self>>;
556    );
557}
558
559/// Methods declared on superclass `NSObject`.
560#[cfg(all(
561    feature = "MPSCore",
562    feature = "MPSKernel",
563    feature = "MPSNDArrayKernel"
564))]
565impl MPSNDArrayVectorLUTDequantize {
566    extern_methods!(
567        #[unsafe(method(init))]
568        #[unsafe(method_family = init)]
569        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
570
571        #[unsafe(method(new))]
572        #[unsafe(method_family = new)]
573        pub unsafe fn new() -> Retained<Self>;
574    );
575}
576
577extern_class!(
578    /// Dependencies: This depends on Metal.framework.
579    ///
580    /// A kernel which dequantizes an input with affine quantization scheme.
581    ///
582    /// The kernel works with 2-4 inputs, order of inputs: 1) quantized input, 2) scale, 3) zeropoint, 4) minValue
583    ///
584    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsndarrayaffineint4dequantize?language=objc)
585    #[unsafe(super(MPSNDArrayMultiaryKernel, MPSNDArrayMultiaryBase, MPSKernel, NSObject))]
586    #[derive(Debug, PartialEq, Eq, Hash)]
587    #[cfg(all(
588        feature = "MPSCore",
589        feature = "MPSKernel",
590        feature = "MPSNDArrayKernel"
591    ))]
592    pub struct MPSNDArrayAffineInt4Dequantize;
593);
594
595#[cfg(all(
596    feature = "MPSCore",
597    feature = "MPSKernel",
598    feature = "MPSNDArrayKernel"
599))]
600extern_conformance!(
601    unsafe impl NSCoding for MPSNDArrayAffineInt4Dequantize {}
602);
603
604#[cfg(all(
605    feature = "MPSCore",
606    feature = "MPSKernel",
607    feature = "MPSNDArrayKernel"
608))]
609extern_conformance!(
610    unsafe impl NSCopying for MPSNDArrayAffineInt4Dequantize {}
611);
612
613#[cfg(all(
614    feature = "MPSCore",
615    feature = "MPSKernel",
616    feature = "MPSNDArrayKernel"
617))]
618unsafe impl CopyingHelper for MPSNDArrayAffineInt4Dequantize {
619    type Result = Self;
620}
621
622#[cfg(all(
623    feature = "MPSCore",
624    feature = "MPSKernel",
625    feature = "MPSNDArrayKernel"
626))]
627extern_conformance!(
628    unsafe impl NSObjectProtocol for MPSNDArrayAffineInt4Dequantize {}
629);
630
631#[cfg(all(
632    feature = "MPSCore",
633    feature = "MPSKernel",
634    feature = "MPSNDArrayKernel"
635))]
636extern_conformance!(
637    unsafe impl NSSecureCoding for MPSNDArrayAffineInt4Dequantize {}
638);
639
640#[cfg(all(
641    feature = "MPSCore",
642    feature = "MPSKernel",
643    feature = "MPSNDArrayKernel"
644))]
645impl MPSNDArrayAffineInt4Dequantize {
646    extern_methods!(
647        #[unsafe(method(initWithDevice:))]
648        #[unsafe(method_family = init)]
649        pub unsafe fn initWithDevice(
650            this: Allocated<Self>,
651            device: &ProtocolObject<dyn MTLDevice>,
652        ) -> Retained<Self>;
653
654        #[cfg(feature = "MPSNDArrayQuantization")]
655        /// Initializes a kernel for 4-bit affine dequantization.
656        ///
657        /// Parameter `device`: The Metal device to be used with this kernel.
658        ///
659        /// Parameter `quantizationDescriptor`: Describes the quantization scheme.
660        ///
661        /// Returns: A new vector LUT dequantization kernel.
662        #[unsafe(method(initWithDevice:quantizationDescriptor:))]
663        #[unsafe(method_family = init)]
664        pub unsafe fn initWithDevice_quantizationDescriptor(
665            this: Allocated<Self>,
666            device: &ProtocolObject<dyn MTLDevice>,
667            quantization_descriptor: &MPSNDArrayAffineQuantizationDescriptor,
668        ) -> Retained<Self>;
669
670        #[unsafe(method(initWithDevice:sourceCount:))]
671        #[unsafe(method_family = init)]
672        pub unsafe fn initWithDevice_sourceCount(
673            this: Allocated<Self>,
674            device: &ProtocolObject<dyn MTLDevice>,
675            source_count: NSUInteger,
676        ) -> Retained<Self>;
677    );
678}
679
680/// Methods declared on superclass `MPSNDArrayMultiaryKernel`.
681#[cfg(all(
682    feature = "MPSCore",
683    feature = "MPSKernel",
684    feature = "MPSNDArrayKernel"
685))]
686impl MPSNDArrayAffineInt4Dequantize {
687    extern_methods!(
688        /// # Safety
689        ///
690        /// `coder` possibly has further requirements.
691        #[unsafe(method(initWithCoder:device:))]
692        #[unsafe(method_family = init)]
693        pub unsafe fn initWithCoder_device(
694            this: Allocated<Self>,
695            coder: &NSCoder,
696            device: &ProtocolObject<dyn MTLDevice>,
697        ) -> Retained<Self>;
698    );
699}
700
701/// Methods declared on superclass `MPSKernel`.
702#[cfg(all(
703    feature = "MPSCore",
704    feature = "MPSKernel",
705    feature = "MPSNDArrayKernel"
706))]
707impl MPSNDArrayAffineInt4Dequantize {
708    extern_methods!(
709        /// Called by NSCoder to decode MPSKernels
710        ///
711        /// This isn't the right interface to decode a MPSKernel, but
712        /// it is the one that NSCoder uses. To enable your NSCoder
713        /// (e.g. NSKeyedUnarchiver) to set which device to use
714        /// extend the object to adopt the MPSDeviceProvider
715        /// protocol. Otherwise, the Metal system default device
716        /// will be used.
717        ///
718        /// # Safety
719        ///
720        /// `a_decoder` possibly has further requirements.
721        #[unsafe(method(initWithCoder:))]
722        #[unsafe(method_family = init)]
723        pub unsafe fn initWithCoder(
724            this: Allocated<Self>,
725            a_decoder: &NSCoder,
726        ) -> Option<Retained<Self>>;
727    );
728}
729
730/// Methods declared on superclass `NSObject`.
731#[cfg(all(
732    feature = "MPSCore",
733    feature = "MPSKernel",
734    feature = "MPSNDArrayKernel"
735))]
736impl MPSNDArrayAffineInt4Dequantize {
737    extern_methods!(
738        #[unsafe(method(init))]
739        #[unsafe(method_family = init)]
740        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
741
742        #[unsafe(method(new))]
743        #[unsafe(method_family = new)]
744        pub unsafe fn new() -> Retained<Self>;
745    );
746}