forked from xamarin/xamarin-macios
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MetalPerformanceShaders] Neural Networks Update to Xcode 11 (xamarin…
…#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]>
- Loading branch information
1 parent
2a81b70
commit 75349d9
Showing
19 changed files
with
781 additions
and
582 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using Metal; | ||
using Foundation; | ||
|
||
namespace MetalPerformanceShaders { | ||
public partial class MPSNDArray { | ||
|
||
public void ExportData (IMTLCommandBuffer cmdBuf, IMTLBuffer buffer, MPSDataType sourceDataType, nuint offset) | ||
{ | ||
ExportData (cmdBuf, buffer, sourceDataType, offset, IntPtr.Zero); | ||
} | ||
public unsafe void ExportData (IMTLCommandBuffer cmdBuf, IMTLBuffer buffer, MPSDataType sourceDataType, nuint offset, nint[] rowStrides) | ||
{ | ||
fixed (nint* p = rowStrides) { | ||
ExportData (cmdBuf, buffer, sourceDataType, offset, (IntPtr)p); | ||
} | ||
} | ||
|
||
public void ImportData (IMTLCommandBuffer cmdBuf, IMTLBuffer buffer, MPSDataType sourceDataType, nuint offset) | ||
{ | ||
ImportData (cmdBuf, buffer, sourceDataType, offset, IntPtr.Zero); | ||
} | ||
public unsafe void ImportData (IMTLCommandBuffer cmdBuf, IMTLBuffer buffer, MPSDataType sourceDataType, nuint offset, nint[] rowStrides) | ||
{ | ||
fixed (nint* p = rowStrides) { | ||
ImportData (cmdBuf, buffer, sourceDataType, offset, (IntPtr)p); | ||
} | ||
} | ||
|
||
public void WriteBytes (IntPtr buffer) | ||
{ | ||
WriteBytes (buffer, IntPtr.Zero); | ||
} | ||
public unsafe void WriteBytes (IntPtr buffer, nint[] strideBytesPerDimension) | ||
{ | ||
fixed (nint* p = strideBytesPerDimension) { | ||
WriteBytes (buffer, (IntPtr)p); | ||
} | ||
} | ||
|
||
public void ReadBytes (IntPtr buffer) | ||
{ | ||
ReadBytes (buffer, IntPtr.Zero); | ||
} | ||
public unsafe void ReadBytes (IntPtr buffer, nint[] strideBytesPerDimension) | ||
{ | ||
fixed (nint* p = strideBytesPerDimension) { | ||
ReadBytes (buffer, (IntPtr)p); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using CoreGraphics; | ||
using Foundation; | ||
using Metal; | ||
using ObjCRuntime; | ||
|
||
namespace MetalPerformanceShaders { | ||
public partial class MPSNNGraph { | ||
[Introduced (PlatformName.MacCatalyst, 13, 0)] | ||
[TV (13,0), Mac (10,15), iOS (13,0)] | ||
public unsafe static MPSNNGraph Create (IMTLDevice device, MPSNNImageNode[] resultImages, bool[] resultsAreNeeded) | ||
{ | ||
fixed (void *resultsAreNeededHandle = resultsAreNeeded) | ||
return Create (device, resultImages, (IntPtr) resultsAreNeededHandle); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.