chore: prepare for ONNX Runtime v1.20

This commit is contained in:
Carson M.
2024-10-26 14:29:49 -05:00
parent a7dd89e773
commit 486034cff6
3 changed files with 49 additions and 3 deletions

View File

@@ -281,6 +281,11 @@ pub struct OrtLogger {
pub struct OrtShapeInferContext {
_unused: [u8; 0]
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct OrtLoraAdapter {
_unused: [u8; 0]
}
pub type OrtStatusPtr = *mut OrtStatus;
#[doc = " \\brief Memory allocation interface\n\n Structure of function pointers that defines a memory allocator. This can be created and filled in by the user for custom allocators.\n\n When an allocator is passed to any function, be sure that the allocator object is not destroyed until the last allocated object using it is freed."]
#[repr(C)]
@@ -721,7 +726,8 @@ pub struct OrtMIGraphXProviderOptions {
pub migraphx_save_compiled_model: ::std::os::raw::c_int,
pub migraphx_save_model_path: *const ::std::os::raw::c_char,
pub migraphx_load_compiled_model: ::std::os::raw::c_int,
pub migraphx_load_model_path: *const ::std::os::raw::c_char
pub migraphx_load_model_path: *const ::std::os::raw::c_char,
pub migraphx_exhaustive_tune: bool
}
#[test]
fn bindgen_test_layout_OrtMIGraphXProviderOptions() {
@@ -1973,6 +1979,26 @@ pub struct OrtApi {
num_external_initializer_files: usize
) -> OrtStatusPtr
)
>,
pub CreateLoraAdapter: ::std::option::Option<
_system!(unsafe fn(adapter_file_path: *const ortchar, allocator: *mut OrtAllocator, out: *mut *mut OrtLoraAdapter) -> OrtStatusPtr)
>,
pub CreateLoraAdapterFromArray: ::std::option::Option<
_system!(
unsafe fn(bytes: *const ::std::os::raw::c_void, num_bytes: usize, allocator: *mut OrtAllocator, out: *mut *mut OrtLoraAdapter) -> OrtStatusPtr
)
>,
pub ReleaseLoraAdapter: ::std::option::Option<_system!(unsafe fn(input: *mut OrtLoraAdapter))>,
pub RunOptionsAddActiveLoraAdapter: ::std::option::Option<_system!(unsafe fn(options: *mut OrtRunOptions, adapter: *const OrtLoraAdapter) -> OrtStatusPtr)>,
pub SetEpDynamicOptions: ::std::option::Option<
_system!(
unsafe fn(
sess: *mut OrtSession,
keys: *const *const ::std::os::raw::c_char,
values: *const *const ::std::os::raw::c_char,
kv_len: usize
) -> OrtStatusPtr
)
>
}
#[test]

View File

@@ -14,7 +14,8 @@ pub struct MIGraphXExecutionProvider {
use_native_calibration_table: bool,
int8_calibration_table_name: Option<CString>,
save_model_path: Option<CString>,
load_model_path: Option<CString>
load_model_path: Option<CString>,
exhaustive_tune: bool
}
impl MIGraphXExecutionProvider {
@@ -55,6 +56,12 @@ impl MIGraphXExecutionProvider {
self
}
#[must_use]
pub fn with_exhaustive_tune(mut self, enable: bool) -> Self {
self.exhaustive_tune = enable;
self
}
#[must_use]
pub fn build(self) -> ExecutionProviderDispatch {
self.into()
@@ -93,7 +100,8 @@ impl ExecutionProvider for MIGraphXExecutionProvider {
migraphx_load_compiled_model: self.load_model_path.is_some().into(),
migraphx_load_model_path: self.load_model_path.as_ref().map(|c| c.as_ptr()).unwrap_or_else(std::ptr::null),
migraphx_save_compiled_model: self.save_model_path.is_some().into(),
migraphx_save_model_path: self.save_model_path.as_ref().map(|c| c.as_ptr()).unwrap_or_else(std::ptr::null)
migraphx_save_model_path: self.save_model_path.as_ref().map(|c| c.as_ptr()).unwrap_or_else(std::ptr::null),
migraphx_exhaustive_tune: self.exhaustive_tune
};
crate::ortsys![unsafe SessionOptionsAppendExecutionProvider_MIGraphX(session_builder.session_options_ptr.as_ptr(), &options)?];
return Ok(());

View File

@@ -159,6 +159,18 @@ impl QNNExecutionProvider {
self
}
#[must_use]
pub fn with_htp_weight_sharing(mut self, enable: bool) -> Self {
self.options.set("enable_htp_weight_sharing", if enable { "1" } else { "0" });
self
}
#[must_use]
pub fn with_offload_graph_io_quantization(mut self, enable: bool) -> Self {
self.options.set("offload_graph_io_quantization", if enable { "1" } else { "0" });
self
}
#[must_use]
pub fn build(self) -> ExecutionProviderDispatch {
self.into()