@@ -182,6 +182,12 @@ public struct OrtApi
182
182
public IntPtr SetGlobalInterOpNumThreads ;
183
183
public IntPtr SetGlobalSpinControl ;
184
184
public IntPtr AddInitializer ;
185
+ public IntPtr CreateEnvWithCustomLoggerAndGlobalThreadPools ;
186
+ public IntPtr SessionOptionsAppendExecutionProvider_CUDA ;
187
+ public IntPtr SessionOptionsAppendExecutionProvider_OpenVINO ;
188
+ public IntPtr SetGlobalDenormalAsZero ;
189
+ public IntPtr CreateArenaCfg ;
190
+ public IntPtr ReleaseArenaCfg ;
185
191
}
186
192
187
193
internal static class NativeMethods
@@ -260,6 +266,9 @@ static NativeMethods()
260
266
OrtRunOptionsSetTerminate = ( DOrtRunOptionsSetTerminate ) Marshal . GetDelegateForFunctionPointer ( api_ . RunOptionsSetTerminate , typeof ( DOrtRunOptionsSetTerminate ) ) ;
261
267
OrtRunOptionsUnsetTerminate = ( DOrtRunOptionsUnsetTerminate ) Marshal . GetDelegateForFunctionPointer ( api_ . RunOptionsUnsetTerminate , typeof ( DOrtRunOptionsUnsetTerminate ) ) ;
262
268
269
+ OrtCreateArenaCfg = ( DOrtCreateArenaCfg ) Marshal . GetDelegateForFunctionPointer ( api_ . CreateArenaCfg , typeof ( DOrtCreateArenaCfg ) ) ;
270
+ OrtReleaseArenaCfg = ( DOrtReleaseArenaCfg ) Marshal . GetDelegateForFunctionPointer ( api_ . ReleaseArenaCfg , typeof ( DOrtReleaseArenaCfg ) ) ;
271
+ OrtReleaseAllocator = ( DOrtReleaseAllocator ) Marshal . GetDelegateForFunctionPointer ( api_ . ReleaseAllocator , typeof ( DOrtReleaseAllocator ) ) ;
263
272
OrtCreateMemoryInfo = ( DOrtCreateMemoryInfo ) Marshal . GetDelegateForFunctionPointer ( api_ . CreateMemoryInfo , typeof ( DOrtCreateMemoryInfo ) ) ;
264
273
OrtCreateCpuMemoryInfo = ( DOrtCreateCpuMemoryInfo ) Marshal . GetDelegateForFunctionPointer ( api_ . CreateCpuMemoryInfo , typeof ( DOrtCreateCpuMemoryInfo ) ) ;
265
274
OrtReleaseMemoryInfo = ( DOrtReleaseMemoryInfo ) Marshal . GetDelegateForFunctionPointer ( api_ . ReleaseMemoryInfo , typeof ( DOrtReleaseMemoryInfo ) ) ;
@@ -311,7 +320,6 @@ static NativeMethods()
311
320
OrtGetTensorShapeElementCount = ( DOrtGetTensorShapeElementCount ) Marshal . GetDelegateForFunctionPointer ( api_ . GetTensorShapeElementCount , typeof ( DOrtGetTensorShapeElementCount ) ) ;
312
321
OrtReleaseValue = ( DOrtReleaseValue ) Marshal . GetDelegateForFunctionPointer ( api_ . ReleaseValue , typeof ( DOrtReleaseValue ) ) ;
313
322
314
-
315
323
OrtSessionGetModelMetadata = ( DOrtSessionGetModelMetadata ) Marshal . GetDelegateForFunctionPointer ( api_ . SessionGetModelMetadata , typeof ( DOrtSessionGetModelMetadata ) ) ;
316
324
OrtModelMetadataGetProducerName = ( DOrtModelMetadataGetProducerName ) Marshal . GetDelegateForFunctionPointer ( api_ . ModelMetadataGetProducerName , typeof ( DOrtModelMetadataGetProducerName ) ) ;
317
325
OrtModelMetadataGetGraphName = ( DOrtModelMetadataGetGraphName ) Marshal . GetDelegateForFunctionPointer ( api_ . ModelMetadataGetGraphName , typeof ( DOrtModelMetadataGetGraphName ) ) ;
@@ -708,6 +716,27 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
708
716
public delegate IntPtr /*(OrtStatus*)*/ DOrtAllocatorGetInfo ( IntPtr /*(const OrtAllocator*)*/ ptr , out IntPtr /*(const struct OrtMemoryInfo**)*/ info ) ;
709
717
public static DOrtAllocatorGetInfo OrtAllocatorGetInfo ;
710
718
719
+ /// <summary>
720
+ /// Create an instance of arena configuration which will be used to create an arena based allocator
721
+ /// See docs/C_API.md for details on what the following parameters mean and how to choose these values
722
+ /// </summary>
723
+ /// <param name="maxMemory">Maximum amount of memory the arena allocates</param>
724
+ /// <param name="arenaExtendStrategy">Strategy for arena expansion</param>
725
+ /// <param name="initialChunkSizeBytes">Size of the region that the arena allocates first</param>
726
+ /// <param name="maxDeadBytesPerChunk">Maximum amount of fragmentation allowed per chunk</param>
727
+ /// <returns>Pointer to a native OrtStatus instance indicating success/failure of config creation</returns>
728
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtCreateArenaCfg ( UIntPtr /*(size_t)*/ maxMemory , int /*(int)*/ arenaExtendStrategy ,
729
+ int /*(int)*/ initialChunkSizeBytes , int /*(int)*/ maxDeadBytesPerChunk ,
730
+ out IntPtr /*(OrtArenaCfg**)*/ arenaCfg ) ;
731
+ public static DOrtCreateArenaCfg OrtCreateArenaCfg ;
732
+
733
+ /// <summary>
734
+ /// Destroy an instance of an arena configuration instance
735
+ /// </summary>
736
+ /// <param name="arenaCfg">arena configuration instance to be destroyed</param>
737
+ public delegate void DOrtReleaseArenaCfg ( IntPtr /*(OrtArenaCfg*)*/ arenaCfg ) ;
738
+ public static DOrtReleaseArenaCfg OrtReleaseArenaCfg ;
739
+
711
740
/// <summary>
712
741
/// Create an instance of allocator according to mem_info
713
742
/// </summary>
@@ -861,13 +890,16 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
861
890
862
891
/// <summary>
863
892
/// Creates an allocator instance and registers it with the env to enable
864
- ///sharing between multiple sessions that use the same env instance.
865
- ///Lifetime of the created allocator will be valid for the duration of the environment.
866
- ///Returns an error if an allocator with the same OrtMemoryInfo is already registered.
867
- /// </summary>
868
- /// <param name="mem_info">must be non-null</param>
869
- /// <param name="arena_cfg">if nullptr defaults will be used</param>
870
- public delegate void DOrtCreateAndRegisterAllocator ( IntPtr /*(OrtIoBinding)*/ io_binding ) ;
893
+ /// sharing between multiple sessions that use the same env instance.
894
+ /// Lifetime of the created allocator will be valid for the duration of the environment.
895
+ /// Returns an error if an allocator with the same OrtMemoryInfo is already registered.
896
+ /// <param name="env">Native OrtEnv instance</param>
897
+ /// <param name="memInfo">Native OrtMemoryInfo instance</param>
898
+ /// <param name="arenaCfg">Native OrtArenaCfg instance</param>
899
+ /// <retruns>A pointer to native ortStatus indicating success/failure</retruns>
900
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtCreateAndRegisterAllocator ( IntPtr /*(OrtEnv*)*/ env ,
901
+ IntPtr /*(const OrtMemoryInfo*)*/ memInfo ,
902
+ IntPtr /*(const OrtArenaCfg*)*/ arenaCfg ) ;
871
903
public static DOrtCreateAndRegisterAllocator OrtCreateAndRegisterAllocator ;
872
904
873
905
/// <summary>
0 commit comments