-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from reflectronic/winml
Add Windows ML native APIs
- Loading branch information
Showing
64 changed files
with
2,806 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@../../settings.rsp | ||
@../../remap.rsp | ||
--exclude | ||
MLOperatorEdgeTypeConstrant | ||
--file | ||
um-MLOperatorAuthor.h | ||
--output | ||
../../../sources/Interop/Windows/um/MLOperatorAuthor | ||
--test-output | ||
../../../tests/Interop/Windows/um/MLOperatorAuthor | ||
--traverse | ||
C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/um/MLOperatorAuthor.h | ||
--with-attribute | ||
MLOperatorKernelOptions=Flags | ||
MLOperatorParameterOptions=Flags | ||
--with-librarypath | ||
*=Windows.AI.MachineLearning.dll |
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,4 @@ | ||
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. | ||
|
||
// Ported from um/MLOperatorAuthor.h in the Windows SDK for Windows 10.0.19041.0 | ||
// Original source is Copyright © Microsoft. All rights reserved. |
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,2 @@ | ||
#include <Windows.h> | ||
#include <MLOperatorAuthor.h> |
10 changes: 10 additions & 0 deletions
10
generation/um/windows.ai.machinelearning.native/generate.rsp
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,10 @@ | ||
@../../settings.rsp | ||
@../../remap.rsp | ||
--file | ||
um-windows.ai.machinelearning.native.h | ||
--output | ||
../../../sources/Interop/Windows/um/windows.ai.machinelearning.native | ||
--test-output | ||
../../../tests/Interop/Windows/um/windows.ai.machinelearning.native | ||
--traverse | ||
C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/um/windows.ai.machinelearning.native.h |
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,4 @@ | ||
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. | ||
|
||
// Ported from um/windows.ai.machinelearning.native.h in the Windows SDK for Windows 10.0.19041.0 | ||
// Original source is Copyright © Microsoft. All rights reserved. |
2 changes: 2 additions & 0 deletions
2
generation/um/windows.ai.machinelearning.native/um-windows.ai.machinelearning.native.h
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,2 @@ | ||
#include <Windows.h> | ||
#include <windows.ai.machinelearning.native.h> |
67 changes: 67 additions & 0 deletions
67
sources/Interop/Windows/um/MLOperatorAuthor/IMLOperatorAttributes.cs
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,67 @@ | ||
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. | ||
|
||
// Ported from um/MLOperatorAuthor.h in the Windows SDK for Windows 10.0.19041.0 | ||
// Original source is Copyright © Microsoft. All rights reserved. | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace TerraFX.Interop | ||
{ | ||
[Guid("4B1B1759-EC40-466C-AAB4-BEB5347FD24C")] | ||
[NativeTypeName("struct IMLOperatorAttributes : IUnknown")] | ||
public unsafe partial struct IMLOperatorAttributes | ||
{ | ||
public void** lpVtbl; | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("HRESULT")] | ||
public int QueryInterface([NativeTypeName("const IID &")] Guid* riid, [NativeTypeName("void **")] void** ppvObject) | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorAttributes*, Guid*, void**, int>)(lpVtbl[0]))((IMLOperatorAttributes*)Unsafe.AsPointer(ref this), riid, ppvObject); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("ULONG")] | ||
public uint AddRef() | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorAttributes*, uint>)(lpVtbl[1]))((IMLOperatorAttributes*)Unsafe.AsPointer(ref this)); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("ULONG")] | ||
public uint Release() | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorAttributes*, uint>)(lpVtbl[2]))((IMLOperatorAttributes*)Unsafe.AsPointer(ref this)); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("HRESULT")] | ||
public int GetAttributeElementCount([NativeTypeName("const char *")] sbyte* name, MLOperatorAttributeType type, [NativeTypeName("uint32_t *")] uint* elementCount) | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorAttributes*, sbyte*, MLOperatorAttributeType, uint*, int>)(lpVtbl[3]))((IMLOperatorAttributes*)Unsafe.AsPointer(ref this), name, type, elementCount); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("HRESULT")] | ||
public int GetAttribute([NativeTypeName("const char *")] sbyte* name, MLOperatorAttributeType type, [NativeTypeName("uint32_t")] uint elementCount, [NativeTypeName("size_t")] nuint elementByteSize, [NativeTypeName("void *")] void* value) | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorAttributes*, sbyte*, MLOperatorAttributeType, uint, nuint, void*, int>)(lpVtbl[4]))((IMLOperatorAttributes*)Unsafe.AsPointer(ref this), name, type, elementCount, elementByteSize, value); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("HRESULT")] | ||
public int GetStringAttributeElementLength([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("uint32_t")] uint elementIndex, [NativeTypeName("uint32_t *")] uint* attributeElementByteSize) | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorAttributes*, sbyte*, uint, uint*, int>)(lpVtbl[5]))((IMLOperatorAttributes*)Unsafe.AsPointer(ref this), name, elementIndex, attributeElementByteSize); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("HRESULT")] | ||
public int GetStringAttributeElement([NativeTypeName("const char *")] sbyte* name, [NativeTypeName("uint32_t")] uint elementIndex, [NativeTypeName("uint32_t")] uint attributeElementByteSize, [NativeTypeName("char *")] sbyte* attributeElement) | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorAttributes*, sbyte*, uint, uint, sbyte*, int>)(lpVtbl[6]))((IMLOperatorAttributes*)Unsafe.AsPointer(ref this), name, elementIndex, attributeElementByteSize, attributeElement); | ||
} | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
sources/Interop/Windows/um/MLOperatorAuthor/IMLOperatorKernel.cs
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,46 @@ | ||
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. | ||
|
||
// Ported from um/MLOperatorAuthor.h in the Windows SDK for Windows 10.0.19041.0 | ||
// Original source is Copyright © Microsoft. All rights reserved. | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace TerraFX.Interop | ||
{ | ||
[Guid("11C4B4A0-B467-4EAA-A1A6-B961D8D0ED79")] | ||
[NativeTypeName("struct IMLOperatorKernel : IUnknown")] | ||
public unsafe partial struct IMLOperatorKernel | ||
{ | ||
public void** lpVtbl; | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("HRESULT")] | ||
public int QueryInterface([NativeTypeName("const IID &")] Guid* riid, [NativeTypeName("void **")] void** ppvObject) | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorKernel*, Guid*, void**, int>)(lpVtbl[0]))((IMLOperatorKernel*)Unsafe.AsPointer(ref this), riid, ppvObject); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("ULONG")] | ||
public uint AddRef() | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorKernel*, uint>)(lpVtbl[1]))((IMLOperatorKernel*)Unsafe.AsPointer(ref this)); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("ULONG")] | ||
public uint Release() | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorKernel*, uint>)(lpVtbl[2]))((IMLOperatorKernel*)Unsafe.AsPointer(ref this)); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("HRESULT")] | ||
public int Compute([NativeTypeName("IMLOperatorKernelContext *")] IMLOperatorKernelContext* context) | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorKernel*, IMLOperatorKernelContext*, int>)(lpVtbl[3]))((IMLOperatorKernel*)Unsafe.AsPointer(ref this), context); | ||
} | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
sources/Interop/Windows/um/MLOperatorAuthor/IMLOperatorKernelContext.cs
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,73 @@ | ||
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. | ||
|
||
// Ported from um/MLOperatorAuthor.h in the Windows SDK for Windows 10.0.19041.0 | ||
// Original source is Copyright © Microsoft. All rights reserved. | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace TerraFX.Interop | ||
{ | ||
[Guid("82536A28-F022-4769-9D3F-8B278F84C0C3")] | ||
[NativeTypeName("struct IMLOperatorKernelContext : IUnknown")] | ||
public unsafe partial struct IMLOperatorKernelContext | ||
{ | ||
public void** lpVtbl; | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("HRESULT")] | ||
public int QueryInterface([NativeTypeName("const IID &")] Guid* riid, [NativeTypeName("void **")] void** ppvObject) | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorKernelContext*, Guid*, void**, int>)(lpVtbl[0]))((IMLOperatorKernelContext*)Unsafe.AsPointer(ref this), riid, ppvObject); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("ULONG")] | ||
public uint AddRef() | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorKernelContext*, uint>)(lpVtbl[1]))((IMLOperatorKernelContext*)Unsafe.AsPointer(ref this)); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("ULONG")] | ||
public uint Release() | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorKernelContext*, uint>)(lpVtbl[2]))((IMLOperatorKernelContext*)Unsafe.AsPointer(ref this)); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("HRESULT")] | ||
public int GetInputTensor([NativeTypeName("uint32_t")] uint inputIndex, [NativeTypeName("IMLOperatorTensor **")] IMLOperatorTensor** tensor) | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorKernelContext*, uint, IMLOperatorTensor**, int>)(lpVtbl[3]))((IMLOperatorKernelContext*)Unsafe.AsPointer(ref this), inputIndex, tensor); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("HRESULT")] | ||
public int GetOutputTensor([NativeTypeName("uint32_t")] uint outputIndex, [NativeTypeName("IMLOperatorTensor **")] IMLOperatorTensor** tensor) | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorKernelContext*, uint, IMLOperatorTensor**, int>)(lpVtbl[4]))((IMLOperatorKernelContext*)Unsafe.AsPointer(ref this), outputIndex, tensor); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("HRESULT")] | ||
public int GetOutputTensor([NativeTypeName("uint32_t")] uint outputIndex, [NativeTypeName("uint32_t")] uint dimensionCount, [NativeTypeName("const uint32_t *")] uint* dimensionSizes, [NativeTypeName("IMLOperatorTensor **")] IMLOperatorTensor** tensor) | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorKernelContext*, uint, uint, uint*, IMLOperatorTensor**, int>)(lpVtbl[5]))((IMLOperatorKernelContext*)Unsafe.AsPointer(ref this), outputIndex, dimensionCount, dimensionSizes, tensor); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[return: NativeTypeName("HRESULT")] | ||
public int AllocateTemporaryData([NativeTypeName("size_t")] nuint size, [NativeTypeName("IUnknown **")] IUnknown** data) | ||
{ | ||
return ((delegate* unmanaged<IMLOperatorKernelContext*, nuint, IUnknown**, int>)(lpVtbl[6]))((IMLOperatorKernelContext*)Unsafe.AsPointer(ref this), size, data); | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public void GetExecutionInterface([NativeTypeName("IUnknown **")] IUnknown** executionObject) | ||
{ | ||
((delegate* unmanaged<IMLOperatorKernelContext*, IUnknown**, void>)(lpVtbl[7]))((IMLOperatorKernelContext*)Unsafe.AsPointer(ref this), executionObject); | ||
} | ||
} | ||
} |
Oops, something went wrong.