Enable SPM support for Ext and configure pipelines for extensions target testing (#3)

* initial ext files

* add a workable version of spm for extensions

* update

* update pipeline

* update pipelines

* fix dev/release pipelines for extensions pod

* fix dev pipelines for extensions pod

* fix release pipelines for extensions pod

* fix dev  pipelines for extensions pod

* adding empty include folder for configuring extensions target path

* test

* test

* test

* revert pipeline changes

* revert gitignore changes

* add ext pod binary target for release pipeline

* add pipeline for extensions

* update

* update package.swift

* update latest from branch

* update

* fix

* fix

* update

* try dummy empty file

* test

* update package.swift to use fatalerror

* syntax

* try gitignore revert

* update gitignore

* add -list

* onnxruntime-Package

* update using onnxruntime-Package

* update dev pipeline

* fix dev pipelines

* syntax

* pull extensions/

* update pipelines again

* syntax

* variables

* fix

* fix -r

* update Package.swift

* update Package.swift

* minor update

* address pr comments

* minor updates

* fix

* refine messages

* syntax

* syntax again

* address pr comments partial

* address pr comments

* add .h header file and notes

* minor updates

* syncing objc source files and add code to register custom ops using function pointer

* format

* move to the header for function doc

---------

Co-authored-by: rachguo <rachguo@rachguos-Mini.attlocal.net>
Co-authored-by: rachguo <rachguo@rachguos-Mac-mini.local>
This commit is contained in:
Rachel Guo
2023-08-11 10:07:43 -07:00
committed by GitHub
parent 7acc38c99c
commit c76787fd3e
33 changed files with 1424 additions and 62 deletions
+49 -1
View File
@@ -3,6 +3,7 @@
#import <Foundation/Foundation.h>
#import "ort_custom_op_registration.h"
#import "ort_enums.h"
NS_ASSUME_NONNULL_BEGIN
@@ -196,12 +197,19 @@ NS_ASSUME_NONNULL_BEGIN
* Available since 1.14.
*
* The registration function must have the signature:
* OrtStatus* (*fn)(OrtSessionOptions* options, const OrtApiBase* api);
* `OrtStatus* (*fn)(OrtSessionOptions* options, const OrtApiBase* api);`
*
* The signature is defined in the ONNX Runtime C API:
* https://github.com/microsoft/onnxruntime/blob/67f4cd54fab321d83e4a75a40efeee95a6a17079/include/onnxruntime/core/session/onnxruntime_c_api.h#L697
*
* See https://onnxruntime.ai/docs/reference/operators/add-custom-op.html for more information on custom ops.
* See https://github.com/microsoft/onnxruntime/blob/342a5bf2b756d1a1fc6fdc582cfeac15182632fe/onnxruntime/test/testdata/custom_op_library/custom_op_library.cc#L115
* for an example of a custom op library registration function.
*
* @note The caller must ensure that `registrationFuncName` names a valid function that is visible to the native ONNX
* Runtime code and has the correct signature.
* They must ensure that the function does what they expect it to do because this method will just call it.
*
* @param registrationFuncName The name of the registration function to call.
* @param error Optional error information set if an error occurs.
* @return Whether the registration function was successfully called.
@@ -209,6 +217,46 @@ NS_ASSUME_NONNULL_BEGIN
- (BOOL)registerCustomOpsUsingFunction:(NSString*)registrationFuncName
error:(NSError**)error;
/**
* Registers custom ops for use with `ORTSession`s using this SessionOptions by calling the specified function
* pointed to by `registerCustomOpsFn`.
*
* Available since 1.16.
*
* The registration function must have the signature:
* `OrtStatus* (*fn)(OrtSessionOptions* options, const OrtApiBase* api);`
*
* The signature is defined in the ONNX Runtime C API:
* https://github.com/microsoft/onnxruntime/blob/67f4cd54fab321d83e4a75a40efeee95a6a17079/include/onnxruntime/core/session/onnxruntime_c_api.h#L697
*
* See https://onnxruntime.ai/docs/reference/operators/add-custom-op.html for more information on custom ops.
* See https://github.com/microsoft/onnxruntime/blob/342a5bf2b756d1a1fc6fdc582cfeac15182632fe/onnxruntime/test/testdata/custom_op_library/custom_op_library.cc#L115
* for an example of a custom op library registration function.
*
* @note The caller must ensure that `registerCustomOpsFn` is a valid function pointer and has the correct signature.
* They must ensure that the function does what they expect it to do because this method will just call it.
*
* @param registerCustomOpsFn A pointer to the registration function to call.
* @param error Optional error information set if an error occurs.
* @return Whether the registration function was successfully called.
*/
- (BOOL)registerCustomOpsUsingFunctionPointer:(ORTCAPIRegisterCustomOpsFnPtr)registerCustomOpsFn
error:(NSError**)error;
/**
* Registers ONNX Runtime Extensions custom ops that have been built in to ONNX Runtime.
*
* Available since 1.16.
*
* @note ONNX Runtime must have been built with the `--use_extensions` flag for the ONNX Runtime Extensions custom ops
* to be able to be registered with this method. When using a separate ONNX Runtime Extensions library, use
* `registerCustomOpsUsingFunctionPointer:error:` instead.
*
* @param error Optional error information set if an error occurs.
* @return Whether the ONNX Runtime Extensions custom ops were successfully registered.
*/
- (BOOL)enableOrtExtensionsCustomOpsWithError:(NSError**)error;
@end
/**