Skip to content

litert-sys: add pre-generated bindings for aarch64-unknown-linux-ohos - #2

Open
shubhamg13 wants to merge 1 commit into
offbit-ai:mainfrom
shubhamg13:litert-sys/ohos-bindings
Open

shubhamg13 wants to merge 1 commit into
offbit-ai:mainfrom
shubhamg13:litert-sys/ohos-bindings

Conversation

@shubhamg13

@shubhamg13 shubhamg13 commented Oct 6, 2026 •

Copy link
Copy Markdown

Adds litert-sys bindings for aarch64-unknown-linux-ohos.

The file is byte-identical to x86_64-unknown-linux-gnu.rs.

Testing. cargo check -p litert-sys --target aarch64-unknown-linux-ohos passes with LITERT_LIB_DIR set.

Scope. Bindings only. target_spec() has no OHOS entry, so building requires LITERT_LIB_DIR pointing at a locally built libLiteRt.so — the path locate_library() already directs users to.

Follow-up. Give target_spec(), xtask TARGETS and Cross.toml an OHOS entry once a libLiteRt.so for this target is published — blocked on google-ai-edge/LiteRT#10576 and the XNNPACK platform allowlist.

Used by rustnn.

@shubhamg13
shubhamg13 marked this pull request as draft October 6, 2026 08:41
@shubhamg13
shubhamg13 force-pushed the litert-sys/ohos-bindings branch from 60184b8 to 87756aa Compare October 7, 2026 05:51
Byte-identical to x86_64-unknown-linux-gnu.rs, because that is what the
generator produces: build.rs::generate_bindings() never passes --target to
clang, so the LITERT_HAS_* compile-time constants are selected by the
preprocessor of the machine running the generation, not by the target.
wasm32-unknown-emscripten.rs is in the same position -- it is also
byte-identical to the x86_64 Linux file.

The types are target-resolved Rust types (std::os::raw scalars, usize and
opaque handle pointers) with no libc types; c_char appears only behind
*const/*mut, so its signedness cannot move a byte.

Checked with the OHOS SDK's clang:

  cargo check -p litert-sys --target aarch64-unknown-linux-ohos

passes with LITERT_LIB_DIR set.

Scope: bindings only. target_spec() has no OHOS entry, so building for this
target requires LITERT_LIB_DIR pointing at a locally built libLiteRt.so --
the path locate_library() already directs users to for targets without pinned
prebuilts. xtask TARGETS mirrors target_spec(), so it is not updated here;
Cross.toml, prebuilt checksums and CI are follow-ups.
@shubhamg13
shubhamg13 force-pushed the litert-sys/ohos-bindings branch from 87756aa to 1dc4709 Compare October 7, 2026 05:56
@shubhamg13
shubhamg13 marked this pull request as ready for review October 7, 2026 06:00
shubhamg13 added a commit to shubhamg13/rustnn that referenced this pull request Oct 8, 2026
Pins litert + litert-sys to shubhamg13/offbit-ai-LiteRT branch
litert-sys/litert-2.2.0 (rev e7517df9), which carries both the
OpenHarmony binding file (upstream PR offbit-ai/LiteRT#2) and the LiteRT
2.2.0 / 4-arg migration. Pinned by rev rather than branch so the pin
cannot drift under `cargo update`.

Adjusts the two call sites the 4-arg API requires:
- LiteRtCreateModelFromBuffer now takes the environment first
  (litert.rs, using the existing LiteRt::env() handle)
- LiteRtLayout::set_has_strides takes an integer bit-field value

Verified: cargo check --features litert-runtime on host and for
aarch64-unknown-linux-ohos (LITERT_LIB_DIR pointing at the OHOS build).

Swap the git pin back to a version requirement once a released crate
carries both changes.
shubhamg13 added a commit to shubhamg13/rustnn that referenced this pull request Oct 8, 2026
Pins litert + litert-sys to shubhamg13/offbit-ai-LiteRT branch
litert-sys/litert-2.2.0 (rev e7517df9), which carries both the
OpenHarmony binding file (upstream PR offbit-ai/LiteRT#2) and the LiteRT
2.2.0 / 4-arg migration. Pinned by rev rather than branch so the pin
cannot drift under `cargo update`.

Adjusts the two call sites the 4-arg API requires:
- LiteRtCreateModelFromBuffer now takes the environment first
  (litert.rs, using the existing LiteRt::env() handle)
- LiteRtLayout::set_has_strides takes an integer bit-field value

Verified: cargo check --features litert-runtime on host and for
aarch64-unknown-linux-ohos (LITERT_LIB_DIR pointing at the OHOS build).

Swap the git pin back to a version requirement once a released crate
carries both changes.
shubhamg13 added a commit to shubhamg13/rustnn that referenced this pull request Oct 8, 2026
Pins litert + litert-sys to shubhamg13/offbit-ai-LiteRT branch
litert-sys/litert-2.2.0 (rev e7517df9), which carries both the
OpenHarmony binding file (upstream PR offbit-ai/LiteRT#2) and the LiteRT
2.2.0 / 4-arg migration. Pinned by rev rather than branch so the pin
cannot drift under `cargo update`.

Adjusts the two call sites the 4-arg API requires:
- LiteRtCreateModelFromBuffer now takes the environment first
  (litert.rs, using the existing LiteRt::env() handle)
- LiteRtLayout::set_has_strides takes an integer bit-field value

Verified: cargo check --features litert-runtime on host and for
aarch64-unknown-linux-ohos (LITERT_LIB_DIR pointing at the OHOS build).

Swap the git pin back to a version requirement once a released crate
carries both changes.
shubhamg13 added a commit to shubhamg13/rustnn that referenced this pull request Oct 13, 2026
Pins litert + litert-sys to shubhamg13/offbit-ai-LiteRT branch
litert-sys/litert-2.2.0 (rev e7517df9), which carries both the
OpenHarmony binding file (upstream PR offbit-ai/LiteRT#2) and the LiteRT
2.2.0 / 4-arg migration. Pinned by rev rather than branch so the pin
cannot drift under `cargo update`.

Adjusts the two call sites the 4-arg API requires:
- LiteRtCreateModelFromBuffer now takes the environment first
  (litert.rs, using the existing LiteRt::env() handle)
- LiteRtLayout::set_has_strides takes an integer bit-field value

Verified: cargo check --features litert-runtime on host and for
aarch64-unknown-linux-ohos (LITERT_LIB_DIR pointing at the OHOS build).

Swap the git pin back to a version requirement once a released crate
carries both changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant