-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tensor::get_byte_size
returns incorrect result with v2024.4.0
#143
Comments
I investigated this and the cause is the upstream commit at openvinotoolkit/openvino@0d95325972f (PR: openvinotoolkit/openvino#24608). What happened is that three new enum variants ( This raises a versioning problem: a minor version bump should be backwards compatible (like adding enum variants to the end of the list!) but this change was not. But the |
@rahulchaphalkar, thinking about this more, I'm not as worried about a security issue here: there are three parts to this puzzle — the user, the bindings, and the OpenVINO library. If we're using pre-2024.2 bindings with a post-2024.2 library (or vice versa) there is a mismatch between what the user asks for (e.g., |
In intel#143, we discovered that upstream OpenVINO had changed the `ov_element_type_e` enum in a backwards-incompatible way. This means that a mismatch between the Rust bindings (based on the C headers) and the shared library will result in tensors being created with the wrong type (e.g., `U64` instead of `U8`). To avoid this situation, this change reads the OpenVINO library version at runtime (e.g., every time a `Core` is created) and fails with an error if the version is older than 2024.2, when the breaking change was introduced. The effect of merging this change would be that newer bindings will fail when used with older libraries, which could be problematic for users. Users could always use an older version of the library (e.g., `v0.7.*`) instead. And the alternative, letting users create tensors of the wrong type, seems like it would open up the door to a slew of reported issues.
* Check version; fail if pre-2024.2 In #143, we discovered that upstream OpenVINO had changed the `ov_element_type_e` enum in a backwards-incompatible way. This means that a mismatch between the Rust bindings (based on the C headers) and the shared library will result in tensors being created with the wrong type (e.g., `U64` instead of `U8`). To avoid this situation, this change reads the OpenVINO library version at runtime (e.g., every time a `Core` is created) and fails with an error if the version is older than 2024.2, when the breaking change was introduced. The effect of merging this change would be that newer bindings will fail when used with older libraries, which could be problematic for users. Users could always use an older version of the library (e.g., `v0.7.*`) instead. And the alternative, letting users create tensors of the wrong type, seems like it would open up the door to a slew of reported issues. * Add documentation to helper functions * Update CI versions: library + OS This updates CI to test only the latest three OpenVINO versions, since older versions will no longer be accessible due to the new "breaking change version check." It also updates the OS version of the GitHub runner for good measure. * ci: specify ubuntu-24.04 * ci: roll back OS version OpenVINO has not published packages for `ubuntu-24.04`.
Recent changes to OpenVINO's C bindings introduced breaking changes that prevent use of older OpenVINO libraries with newer bindings (see [openvino-rs#143] if you're interested in the details). This updates both the bindings and the version of OpenVINO used to test against. Fixes bytecodealliance#9379. [openvino-rs#143]: intel/openvino-rs#143
* wasi-nn: update OpenVINO bindings Recent changes to OpenVINO's C bindings introduced breaking changes that prevent use of older OpenVINO libraries with newer bindings (see [openvino-rs#143] if you're interested in the details). This updates both the bindings and the version of OpenVINO used to test against. Fixes #9379. [openvino-rs#143]: intel/openvino-rs#143 * vet: certify openvino version updates All of these updates include code I've reviewed. * ci: update `install-openvino-action` prtest:full
TLDR: this issue describes how an breaking change in the upstream C bindings results in incorrect behavior in these Rust bindings; the solution is to use a newer version of OpenVINO (v2024.2 and up) along with a recent version of these bindings (v0.8.0 and up).
#142 adds an easier way to update the bindings to use the latest OpenVINO C headers; as I used it I discovered the
Tensor::get_byte_size
is returning a different result than previously. I ran:And the
memory_safety
test promptly failed with:Interestingly enough,
111651808 / 13956476 = 8
so it could be that some internal data type was unwittingly changed upstream. It's notable that theweights
buffer we pass in contains 13956476 bytes and has had that size since themobilenet
test fixture was added. And I am running the test with the OpenVINO 2024.1.0 library installed; the only thing that changes here is the OpenVINO C header.The text was updated successfully, but these errors were encountered: