-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MPSCore] Update for Xcode 11 beta 1 to 7 #6935
Conversation
This also removes the hardcoded MetalPerformanceShaders library from Dlfcn as it conflicted with Libraries.g.cs
Build failure Test results8 tests failed, 83 tests passed.Failed tests
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good ❤️
static extern MPSImageType MPSGetImageType (IntPtr image); | ||
|
||
[iOS (13,0), TV (12,0), Mac (10,15)][Introduced (PlatformName.MacCatalyst, 13, 0)] | ||
public MPSImageType ImageType => MPSGetImageType (Handle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm this reminds me a little of #6530 (Which I still need to fix heh).
Will the property it be safe for the debugger?
what happens if Handle is invalid (IntPtr.Zero
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair :-)
Yes it's safe because, ImageType is just an integer. I think that this is good info to have when you're in the debugger, that's why I made it a property.
The argument is marked nonnull so I assume bad things if null is passed. FWIW, I don't know if any NSObject properties are protected from Zero Handles.
I think this is fine, but I also don't think this function will be used a lot in real code, so I won't push the property.
void Reshape (nuint numberOfDimensions, IntPtr dimensionSizes); | ||
|
||
[Export ("reshapeWithShape:")] | ||
void Reshape (NSNumber[] shape); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this be a more concrete type? do you happen to know? if you do then you can do something like this
void Reshape ([BindAs (typeof (nint []))] NSNumber[] shape);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, no I didn't know that, thanks!
Thing is, I really want params
for these puppies and that's why I provided the params
version in manual code. Is there an attribute to get params
?
Co-Authored-By: Alex Soto <[email protected]>
Co-Authored-By: Alex Soto <[email protected]>
Co-Authored-By: Alex Soto <[email protected]>
Build failure |
Build failure |
Co-Authored-By: Alex Soto <[email protected]>
Build failure |
Build failure Test results8 tests failed, 83 tests passed.Failed tests
|
@@ -0,0 +1,90 @@ | |||
#if (XAMCORE_2_0 && !MONOMAC) && !XAMCORE_4_0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This #if condition looks a bit weird, !XAMCORE_4_0
is used for API we'll want to remove in the future.
Exactly which are the circumstances you wanted to include/exclude?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll be honest I have no idea what any of these defines mean. I stole them from MPSMatrixDescriptor.cs.
MPS files use a combination of:
#if (XAMCORE_2_0 && !MONOMAC) && !XAMCORE_4_0
and
#if XAMCORE_2_0 || !MONOMAC
I would like to include every platform. So I'm guessing XAMCORE_2_0 || !MONOMAC
is the one I want? Are those just guarding against the old APIs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just remove the entire #if ...
condition, as far as I can tell it should be fine.
public unsafe static MPSNDArrayDescriptor Create (MPSDataType dataType, params nuint[] dimensionSizes) | ||
{ | ||
fixed (nuint* p = dimensionSizes) { | ||
return Create (dataType, (nuint)dimensionSizes.Length, (IntPtr)p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NullReferenceException if dimensionSizes
is null. This method needs an argument check that throws an ArgumentNullException.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep!
public unsafe void Reshape (params nuint[] dimensionSizes) | ||
{ | ||
fixed (nuint* p = dimensionSizes) { | ||
Reshape ((nuint)dimensionSizes.Length, (IntPtr)p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NullReferenceException if dimensionSizes
is null. This method needs an argument check that throws an ArgumentNullException.
@rolfbjarne @dalexsoto Can you recommend how to proceed with this PR given that this branch has been released? Should I rebase to master and force push? Or start a new PR? |
@praeclarum I think it's best to rebase on the master branch and creating a new PR is the best way to go (alternatively rebase on the xcode11.3 branch, which will get the PR in a stable release faster, but the down side is that the code will get less tested before it's released). |
OK, will open a new PR against xcode11.3 |
This includes updates from PRs xamarin#6932 and xamarin#6935 It adds new functionality to the neural network components. This is still not the complete API for 11.3
Co-Authored-By: Frank A. Krueger <[email protected]> This includes updates from PRs xamarin#6932, xamarin#6935 and xamarin#7461 It adds new functionality to the neural network components. This is still not the complete API for 11.3 * Update src/metalperformanceshaders.cs Co-Authored-By: Rolf Bjarne Kvinge <[email protected]> * Make changes requested by @rolfbjarne * Fix binding of default random distribution creation The parameterless function creates new default distributions and is not a property. It is a counterpart of CreateUniform. * Expose public APIs for MPSCnnConvolutionTransposeNode These APIs are public and documented at: https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposenode/2942641-initwithsource?language=objc I have also tested that they work. * Reintroduce compat API. * Fix acronym casing. * Fix introspection tests. * Fix xtro. * One last xtro issue. * Fix more xtro. * Another introspection fix. Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
This includes updates from PRs xamarin#6932, xamarin#6935 and xamarin#7461 It adds new functionality to the neural network components. This is still not the complete API for 11.3 * Update src/metalperformanceshaders.cs Co-Authored-By: Rolf Bjarne Kvinge <[email protected]> * Make changes requested by @rolfbjarne * Fix binding of default random distribution creation The parameterless function creates new default distributions and is not a property. It is a counterpart of CreateUniform. * Expose public APIs for MPSCnnConvolutionTransposeNode These APIs are public and documented at: https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposenode/2942641-initwithsource?language=objc I have also tested that they work. * Reintroduce compat API. * Fix acronym casing. * Fix introspection tests. * Fix xtro. * One last xtro issue. * Fix more xtro. * Another introspection fix. Co-authored-By: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
* [MetalPerformanceShaders] Neural Networks Update to Xcode 11 This includes updates from PRs #6932, #6935 and #7461 It adds new functionality to the neural network components. This is still not the complete API for 11.3 * Update src/metalperformanceshaders.cs Co-Authored-By: Rolf Bjarne Kvinge <[email protected]> * Make changes requested by @rolfbjarne * Fix binding of default random distribution creation The parameterless function creates new default distributions and is not a property. It is a counterpart of CreateUniform. * Expose public APIs for MPSCnnConvolutionTransposeNode These APIs are public and documented at: https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposenode/2942641-initwithsource?language=objc I have also tested that they work. * Reintroduce compat API. * Fix acronym casing. * Fix introspection tests. * Fix xtro. * One last xtro issue. * Fix more xtro. * Another introspection fix. Co-authored-By: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply suggestions from code review Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply feedback * Please the typo guardians Co-authored-by: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
…#8844) * [MetalPerformanceShaders] Neural Networks Update to Xcode 11 This includes updates from PRs xamarin#6932, xamarin#6935 and xamarin#7461 It adds new functionality to the neural network components. This is still not the complete API for 11.3 * Update src/metalperformanceshaders.cs Co-Authored-By: Rolf Bjarne Kvinge <[email protected]> * Make changes requested by @rolfbjarne * Fix binding of default random distribution creation The parameterless function creates new default distributions and is not a property. It is a counterpart of CreateUniform. * Expose public APIs for MPSCnnConvolutionTransposeNode These APIs are public and documented at: https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposenode/2942641-initwithsource?language=objc I have also tested that they work. * Reintroduce compat API. * Fix acronym casing. * Fix introspection tests. * Fix xtro. * One last xtro issue. * Fix more xtro. * Another introspection fix. Co-authored-By: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply suggestions from code review Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply feedback * Please the typo guardians Co-authored-by: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
…#8844) * [MetalPerformanceShaders] Neural Networks Update to Xcode 11 This includes updates from PRs xamarin#6932, xamarin#6935 and xamarin#7461 It adds new functionality to the neural network components. This is still not the complete API for 11.3 * Update src/metalperformanceshaders.cs Co-Authored-By: Rolf Bjarne Kvinge <[email protected]> * Make changes requested by @rolfbjarne * Fix binding of default random distribution creation The parameterless function creates new default distributions and is not a property. It is a counterpart of CreateUniform. * Expose public APIs for MPSCnnConvolutionTransposeNode These APIs are public and documented at: https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposenode/2942641-initwithsource?language=objc I have also tested that they work. * Reintroduce compat API. * Fix acronym casing. * Fix introspection tests. * Fix xtro. * One last xtro issue. * Fix more xtro. * Another introspection fix. Co-authored-By: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply suggestions from code review Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply feedback * Please the typo guardians Co-authored-by: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
…#8844) * [MetalPerformanceShaders] Neural Networks Update to Xcode 11 This includes updates from PRs xamarin#6932, xamarin#6935 and xamarin#7461 It adds new functionality to the neural network components. This is still not the complete API for 11.3 * Update src/metalperformanceshaders.cs Co-Authored-By: Rolf Bjarne Kvinge <[email protected]> * Make changes requested by @rolfbjarne * Fix binding of default random distribution creation The parameterless function creates new default distributions and is not a property. It is a counterpart of CreateUniform. * Expose public APIs for MPSCnnConvolutionTransposeNode These APIs are public and documented at: https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposenode/2942641-initwithsource?language=objc I have also tested that they work. * Reintroduce compat API. * Fix acronym casing. * Fix introspection tests. * Fix xtro. * One last xtro issue. * Fix more xtro. * Another introspection fix. Co-authored-By: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply suggestions from code review Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply feedback * Please the typo guardians Co-authored-by: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
* [MetalPerformanceShaders] Neural Networks Update to Xcode 11 This includes updates from PRs #6932, #6935 and #7461 It adds new functionality to the neural network components. This is still not the complete API for 11.3 * Update src/metalperformanceshaders.cs Co-Authored-By: Rolf Bjarne Kvinge <[email protected]> * Make changes requested by @rolfbjarne * Fix binding of default random distribution creation The parameterless function creates new default distributions and is not a property. It is a counterpart of CreateUniform. * Expose public APIs for MPSCnnConvolutionTransposeNode These APIs are public and documented at: https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposenode/2942641-initwithsource?language=objc I have also tested that they work. * Reintroduce compat API. * Fix acronym casing. * Fix introspection tests. * Fix xtro. * One last xtro issue. * Fix more xtro. * Another introspection fix. Co-authored-By: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply suggestions from code review Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply feedback * Please the typo guardians Co-authored-by: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
* [MetalPerformanceShaders] Neural Networks Update to Xcode 11 This includes updates from PRs #6932, #6935 and #7461 It adds new functionality to the neural network components. This is still not the complete API for 11.3 * Update src/metalperformanceshaders.cs Co-Authored-By: Rolf Bjarne Kvinge <[email protected]> * Make changes requested by @rolfbjarne * Fix binding of default random distribution creation The parameterless function creates new default distributions and is not a property. It is a counterpart of CreateUniform. * Expose public APIs for MPSCnnConvolutionTransposeNode These APIs are public and documented at: https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposenode/2942641-initwithsource?language=objc I have also tested that they work. * Reintroduce compat API. * Fix acronym casing. * Fix introspection tests. * Fix xtro. * One last xtro issue. * Fix more xtro. * Another introspection fix. Co-authored-By: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply suggestions from code review Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply feedback * Please the typo guardians Co-authored-by: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
* [MetalPerformanceShaders] Neural Networks Update to Xcode 11 This includes updates from PRs #6932, #6935 and #7461 It adds new functionality to the neural network components. This is still not the complete API for 11.3 * Update src/metalperformanceshaders.cs Co-Authored-By: Rolf Bjarne Kvinge <[email protected]> * Make changes requested by @rolfbjarne * Fix binding of default random distribution creation The parameterless function creates new default distributions and is not a property. It is a counterpart of CreateUniform. * Expose public APIs for MPSCnnConvolutionTransposeNode These APIs are public and documented at: https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposenode/2942641-initwithsource?language=objc I have also tested that they work. * Reintroduce compat API. * Fix acronym casing. * Fix introspection tests. * Fix xtro. * One last xtro issue. * Fix more xtro. * Another introspection fix. Co-authored-By: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply suggestions from code review Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply feedback * Please the typo guardians Co-authored-by: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
…#8844) * [MetalPerformanceShaders] Neural Networks Update to Xcode 11 This includes updates from PRs xamarin#6932, xamarin#6935 and xamarin#7461 It adds new functionality to the neural network components. This is still not the complete API for 11.3 * Update src/metalperformanceshaders.cs Co-Authored-By: Rolf Bjarne Kvinge <[email protected]> * Make changes requested by @rolfbjarne * Fix binding of default random distribution creation The parameterless function creates new default distributions and is not a property. It is a counterpart of CreateUniform. * Expose public APIs for MPSCnnConvolutionTransposeNode These APIs are public and documented at: https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposenode/2942641-initwithsource?language=objc I have also tested that they work. * Reintroduce compat API. * Fix acronym casing. * Fix introspection tests. * Fix xtro. * One last xtro issue. * Fix more xtro. * Another introspection fix. Co-authored-By: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply suggestions from code review Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply feedback * Please the typo guardians Co-authored-by: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
* [MetalPerformanceShaders] Neural Networks Update to Xcode 11 This includes updates from PRs #6932, #6935 and #7461 It adds new functionality to the neural network components. This is still not the complete API for 11.3 * Update src/metalperformanceshaders.cs Co-Authored-By: Rolf Bjarne Kvinge <[email protected]> * Make changes requested by @rolfbjarne * Fix binding of default random distribution creation The parameterless function creates new default distributions and is not a property. It is a counterpart of CreateUniform. * Expose public APIs for MPSCnnConvolutionTransposeNode These APIs are public and documented at: https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposenode/2942641-initwithsource?language=objc I have also tested that they work. * Reintroduce compat API. * Fix acronym casing. * Fix introspection tests. * Fix xtro. * One last xtro issue. * Fix more xtro. * Another introspection fix. Co-authored-By: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply suggestions from code review Co-authored-by: Rolf Bjarne Kvinge <[email protected]> * Apply feedback * Please the typo guardians Co-authored-by: Frank A. Krueger <[email protected]> Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
This updates all the APIs to beta7.
Notes:
MPSCommandBuffer
wraps anIMTLCommandBuffer
- I think I got it right but please check (it's important).MPSNDArray
is the big new data type that is similar toMPSMatrix
andMPSImage
.MPSNDArray
has some methods that optionally return strides. I offer 3 versions of those functions: parameterless, IntPtr, and nint[].MPSNDArray.WriteBytes
buffer is an IntPtr which isn't ideal. But NDArrays can be anydata type so the alternative is to write primitive type overloads. I'm putting the burden on the app developer to
fixed
their data.MPSNDArrayAllocators
aren't really user definable but I wasn't able to getNSCopying
and friends working without the[Model]
MetalPerformanceShaders
fromDlfcn
as it was conflicting with the one defined in Libraries.g.cs