Skip to content

Conversation

@serpent213
Copy link

Modernise Ortex, increase robustness and packageability.

Requires ONNX >= 1.23.x (API 23). Linux build defaults for GPU changed!
See commit messages for details.

Tests untouched, except for small fix. Tested manually (a little) on arm64 (Darwin/Nix, devenv.sh, in-build downloads) and amd64 (NixOS, Nix package, sandboxed build).

Most work performed by Codex 5.2 under human supervision.

- replace rustler::resource! load closure with explicit ResourceTypeProvider
  impls and atomic resource type storage to avoid non-local impl warnings
- register OrtexModel/OrtexTensor resource types once in load, using
  compare_exchange to avoid races
- clarify lifetimes in concatenate macro filter helper to silence
  mismatched_lifetime_syntaxes
- annotate initialize_from_raw_ptr return lifetime for the ArrayViewMut to
  match elision rules
- drop unused lifetimes on NIF wrappers for slice/reshape/concatenate
- Validate binary size/shape and copy data safely instead of using raw pointers
- Respect element limits in to_binary and report invalid element sizes
- Convert slice/concat/reshape paths to return NIF errors instead of panics
- Check input counts and missing outputs in model run
- Handle bool tensors and unsupported types without crashing
- Make Elixir backend raise on NIF {:error, msg} responses
- deps update: bump nx/exla/torchx/tokenizers and update mix.lock
- Update rustler crate to 0.37 and refresh Cargo.lock
- Switch resource registration to resource_impl and new init macro
- Mark OrtexModel unwind-safe for NIF returns
- Suppress ORT lib warnings in test env while keeping explicit ORT_LIB_LOCATION errors
- bump ort to 2.0.0-rc.11 and align ndarray/half versions

- adapt NIF to ort rc.11 API (session accessors, inputs/outputs, execution providers)

- rework tensor conversions to use ort Value/Tensor APIs and handle unsupported dtypes

- serialize access to Session to satisfy mutable run API

- drop unused direct deps (rustls, tracing-subscriber, num-traits)
- NIF: require exact binary size for from_binary and return errors for unknown execution providers

- NIF init now surfaces EP mapping errors instead of falling back to CPU

- Backend inspect respects element limits when building binaries

- Serving: use explicit Nx.Defn.Evaluator opts per partition instead of brittle jit_apply defaults

- Docs: explain ORTEX_FEATURES and OS defaults

- HEADS-UP: Linux now defaults to CPU-only unless ORTEX_FEATURES enables GPU providers
- Tests now exercise each concrete dtype instead of defaulting to s16
Gate Rustler crate compilation on ORTEX_SKIP_COMPILE so packagers can use prebuilt NIFs

Document the precompiled-NIF workflow and env var in README for maintainers
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