Skip to content

Commit e7f5cdc

Browse files
Upgrade bindings to v2025.1.0 (#168)
* Update `upstream` submodule to v2025.1.0 This captures (minus some cleanup of now-untracked files): ``` cd crates/openvino-sys/upstream git checkout 2025.1.0 git submodule update --init --recursive ``` This brings the upstream submodule in line with release [2025.1.0]. [2025.1.0]: https://github.com/openvinotoolkit/openvino/releases/tag/2025.1.0 * Update bindings This captures: ``` cargo xtask codegen ``` The key change introduced here--a breaking one--is the rearranging of all of the enum values for `ov_element_type_e`. Like #143, this creates an incompatibility when running a pre-2025.1 OpenVINO with this version of the bindings. * Remove `RwPropertyKey::Affinity` This pulls in work from #159 to remove a now-unknown property. Co-authored-by: Rickvanderveen <[email protected]> * Remove `ElementType::Undefined` OpenVINO 2025.1.0 deprecates `ov_element_type_e::UNDEFINED` ([#28766]), so this change removes it in the Rust bindings. This does create a breaking API change across minor versions of upstream OpenVINO (v2025.0 to v2025.1); we should assume from here on out that the C API is unstable. [#28766]: openvinotoolkit/openvino#28766 * ci: temporarily limit the versions tested in CI --------- Co-authored-by: Rickvanderveen <[email protected]>
1 parent c6b36d3 commit e7f5cdc

File tree

7 files changed

+56
-39
lines changed

7 files changed

+56
-39
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ jobs:
2424
# found ("dyld: Library not loaded; '@rpath/libopenvino.2310.dylib'"). See
2525
# https://github.com/abrown/openvino-rs/actions/runs/6423141936/job/17441022932#step:7:154
2626
os: [ubuntu-22.04, ubuntu-24.04, windows-latest]
27-
version: [2024.4.0, 2024.5.0, 2024.6.0]
27+
version: [2025.1.0]
2828
apt: [false]
2929
# We also spot-check that things work when installing from APT by adding to the matrix: see
3030
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
3131
# APT install and check latest supported version.
3232
include:
3333
- os: ubuntu-24.04
34-
version: 2024.4.0
34+
version: 2025.1.0
3535
apt: true
3636
env:
3737
RUST_LOG: debug

crates/openvino-sys/src/generated/functions.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,5 +1109,17 @@ extern "C" {
11091109
model: *mut *mut ov_model_t,
11101110
) -> ov_status_e;
11111111
}
1112+
extern "C" {
1113+
#[doc = " @brief Add pad preprocess operation. Extends an input tensor on edges with constants.\n\n @param preprocess_input_process_steps A pointer to the ov_preprocess_preprocess_steps_t.\n @param pads_begin Number of padding elements to add at the beginning of each axis.\n @param pads_begin_size Pads begin size (number of axes).\n @param pads_end Number of padding elements to add at the end of each axis.\n @param pads_end_size Pads end size (number of axes).\n @param value Value to be populated in the padded area (mode=CONSTANT)\n @param mode Padding mode."]
1114+
pub fn ov_preprocess_preprocess_steps_pad(
1115+
preprocess_input_process_steps: *const ov_preprocess_preprocess_steps_t,
1116+
pads_begin: *const ::std::os::raw::c_int,
1117+
pads_begin_size: usize,
1118+
pads_end: *const ::std::os::raw::c_int,
1119+
pads_end_size: usize,
1120+
value: f32,
1121+
mode: ov_padding_mode_e,
1122+
) -> ov_status_e;
1123+
}
11121124

11131125
}

crates/openvino-sys/src/generated/types.rs

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,64 +41,65 @@ pub enum ov_status_e {
4141
#[doc = "!< UNKNOW_EXCEPTION"]
4242
UNKNOW_EXCEPTION = -17,
4343
}
44+
impl ov_element_type_e {
45+
pub const DYNAMIC: ov_element_type_e = ov_element_type_e::UNDEFINED;
46+
}
4447
#[repr(u32)]
4548
#[doc = " @enum ov_element_type_e\n @ingroup ov_base_c_api\n @brief This enum contains codes for element type, which is aligned with ov::element::Type_t in\n src/core/include/openvino/core/type/element_type.hpp"]
4649
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
4750
pub enum ov_element_type_e {
4851
#[doc = "!< Undefined element type"]
4952
UNDEFINED = 0,
50-
#[doc = "!< Dynamic element type"]
51-
DYNAMIC = 1,
5253
#[doc = "!< boolean element type"]
53-
OV_BOOLEAN = 2,
54+
OV_BOOLEAN = 1,
5455
#[doc = "!< bf16 element type"]
55-
BF16 = 3,
56+
BF16 = 2,
5657
#[doc = "!< f16 element type"]
57-
F16 = 4,
58+
F16 = 3,
5859
#[doc = "!< f32 element type"]
59-
F32 = 5,
60+
F32 = 4,
6061
#[doc = "!< f64 element type"]
61-
F64 = 6,
62+
F64 = 5,
6263
#[doc = "!< i4 element type"]
63-
I4 = 7,
64+
I4 = 6,
6465
#[doc = "!< i8 element type"]
65-
I8 = 8,
66+
I8 = 7,
6667
#[doc = "!< i16 element type"]
67-
I16 = 9,
68+
I16 = 8,
6869
#[doc = "!< i32 element type"]
69-
I32 = 10,
70+
I32 = 9,
7071
#[doc = "!< i64 element type"]
71-
I64 = 11,
72+
I64 = 10,
7273
#[doc = "!< binary element type"]
73-
U1 = 12,
74+
U1 = 11,
7475
#[doc = "!< u2 element type"]
75-
U2 = 13,
76+
U2 = 12,
7677
#[doc = "!< u3 element type"]
77-
U3 = 14,
78+
U3 = 13,
7879
#[doc = "!< u4 element type"]
79-
U4 = 15,
80+
U4 = 14,
8081
#[doc = "!< u6 element type"]
81-
U6 = 16,
82+
U6 = 15,
8283
#[doc = "!< u8 element type"]
83-
U8 = 17,
84+
U8 = 16,
8485
#[doc = "!< u16 element type"]
85-
U16 = 18,
86+
U16 = 17,
8687
#[doc = "!< u32 element type"]
87-
U32 = 19,
88+
U32 = 18,
8889
#[doc = "!< u64 element type"]
89-
U64 = 20,
90+
U64 = 19,
9091
#[doc = "!< nf4 element type"]
91-
NF4 = 21,
92+
NF4 = 20,
9293
#[doc = "!< f8e4m3 element type"]
93-
F8E4M3 = 22,
94+
F8E4M3 = 21,
9495
#[doc = "!< f8e5m2 element type"]
95-
F8E5M3 = 23,
96+
F8E5M3 = 22,
9697
#[doc = "!< string element type"]
97-
STRING = 24,
98+
STRING = 23,
9899
#[doc = "!< f4e2m1 element type"]
99-
F4E2M1 = 25,
100+
F4E2M1 = 24,
100101
#[doc = "!< f8e8m0 element type"]
101-
F8E8M0 = 26,
102+
F8E8M0 = 25,
102103
}
103104
#[doc = " @brief encryption_func is a function pointer that encrypt or decrypt the input memory, example of this function is\n codec(const char* input, const size_t in_size, const char* output, size_t* out_size)\n This function needs to be called twice,\n the first call to obtain out_size (the size of output buffer), the second call to obtain output buffer.\n The first call output is nullptr, before the second call, the caller needs to apply for output\n memory based on the out_size returned by the first call.\n the memory of parameter output is allocated and released by the caller.\n @param input The pointer to the input buffer.\n @param in_size The size of input.\n @param output The pointer to the encrypted/decrypted buffer.\n @param out_size The size of output."]
104105
pub type encryption_func = ::std::option::Option<
@@ -486,3 +487,16 @@ pub enum ov_preprocess_resize_algorithm_e {
486487
#[doc = "!< nearest algorithm"]
487488
RESIZE_NEAREST = 2,
488489
}
490+
#[repr(u32)]
491+
#[doc = " @enum ov_padding_mode_e\n @ingroup ov_prepostprocess_c_api\n @brief This enum contains enumeration for padding mode."]
492+
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
493+
pub enum ov_padding_mode_e {
494+
#[doc = "!< Pads with given constant value."]
495+
CONSTANT = 0,
496+
#[doc = "!< Pads with tensor edge values."]
497+
EDGE = 1,
498+
#[doc = "!< Pads with reflection of tensor data along axis. Values on the edges are not duplicated."]
499+
REFLECT = 2,
500+
#[doc = "!< Pads similar like `REFLECT` but values on the edges are duplicated."]
501+
SYMMETRIC = 3,
502+
}

crates/openvino-sys/upstream

Submodule upstream updated 15386 files

crates/openvino/src/core.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ mod core_tests {
261261
let rw_keys = vec![
262262
CacheDir,
263263
NumStreams,
264-
Affinity,
265264
InferenceNumThreads,
266265
HintEnableCpuPinning,
267266
HintEnableHyperThreading,

crates/openvino/src/element_type.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ use std::fmt;
66
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
77
#[repr(u32)]
88
pub enum ElementType {
9-
/// An undefined element type.
10-
Undefined,
119
/// A dynamic element type.
1210
Dynamic,
1311
/// A boolean element type.
@@ -65,7 +63,6 @@ pub enum ElementType {
6563
impl From<ov_element_type_e> for ElementType {
6664
fn from(ty: ov_element_type_e) -> Self {
6765
match ty {
68-
ov_element_type_e::UNDEFINED => Self::Undefined,
6966
ov_element_type_e::DYNAMIC => Self::Dynamic,
7067
ov_element_type_e::OV_BOOLEAN => Self::Boolean,
7168
ov_element_type_e::BF16 => Self::Bf16,
@@ -99,7 +96,6 @@ impl From<ov_element_type_e> for ElementType {
9996
impl From<ElementType> for ov_element_type_e {
10097
fn from(ty: ElementType) -> ov_element_type_e {
10198
match ty {
102-
ElementType::Undefined => ov_element_type_e::UNDEFINED,
10399
ElementType::Dynamic => ov_element_type_e::DYNAMIC,
104100
ElementType::Boolean => ov_element_type_e::OV_BOOLEAN,
105101
ElementType::Bf16 => ov_element_type_e::BF16,
@@ -133,7 +129,6 @@ impl From<ElementType> for ov_element_type_e {
133129
impl fmt::Display for ElementType {
134130
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
135131
match self {
136-
Self::Undefined => write!(f, "Undefined"),
137132
Self::Dynamic => write!(f, "Dynamic"),
138133
Self::Boolean => write!(f, "Boolean"),
139134
Self::Bf16 => write!(f, "BF16"),

crates/openvino/src/property.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ pub enum RwPropertyKey {
4343
CacheMode,
4444
/// The number of executor logical partitions.
4545
NumStreams,
46-
/// CPU affinity per thread.
47-
Affinity,
4846
/// The maximum number of threads that can be used for inference tasks.
4947
InferenceNumThreads,
5048
/// High-level OpenVINO hint for using CPU pinning to bind CPU threads to processors during inference.
@@ -114,7 +112,6 @@ impl AsRef<str> for RwPropertyKey {
114112
RwPropertyKey::CacheDir => "CACHE_DIR",
115113
RwPropertyKey::CacheMode => "CACHE_MODE",
116114
RwPropertyKey::NumStreams => "NUM_STREAMS",
117-
RwPropertyKey::Affinity => "AFFINITY",
118115
RwPropertyKey::InferenceNumThreads => "INFERENCE_NUM_THREADS",
119116
RwPropertyKey::HintEnableCpuPinning => "ENABLE_CPU_PINNING",
120117
RwPropertyKey::HintEnableHyperThreading => "ENABLE_HYPER_THREADING",

0 commit comments

Comments
 (0)