Skip to main content

OnnxRuntimeInstaller

Struct OnnxRuntimeInstaller 

Source
pub struct OnnxRuntimeInstaller { /* private fields */ }
Expand description

The ONNX Runtime installer.

Implementations§

Source§

impl OnnxRuntimeInstaller

Source

pub fn new(config: OnnxRuntimeConfig) -> Self

Create a new ONNX Runtime installer with the given config.

Source

pub fn with_defaults() -> Self

Create with default config.

Source

pub fn dependencies(&self) -> &[&str]

Get the list of required dependencies.

ONNX Runtime depends on ROCm.

Source

pub fn format_rocm_version_for_ort(&self, rocm_version: &str) -> String

Format ROCm version for ONNX Runtime (e.g., “7.2.0” -> “70200”).

The original script formats as Mmmpp: printf "%d%02d%02d" major minor patch.

Source

pub fn build_prebuilt_install_command(&self) -> ShellCommand

Construct the pip install command for prebuilt onnxruntime-rocm wheel.

The original script tries this first: pip install --upgrade --prefer-binary onnxruntime-rocm

Source

pub fn build_migraphx_wheel_url(&self) -> String

Construct the AMD manylinux repo URL for onnxruntime-migraphx.

Pattern: https://repo.radeon.com/rocm/manylinux/rocm-rel-{release}/

The URL points to a specific wheel matching the Python version and ROCm release. ROCm 7.2.4 ships onnxruntime_migraphx 1.23.2.

Source

pub fn build_migraphx_install_command(&self) -> ShellCommand

Construct the pip install command for onnxruntime-migraphx from AMD repo.

This is the default install method — the AMD-provided wheel includes the MIGraphX execution provider and is built against the matching ROCm version, avoiding ABI incompatibility issues with PyPI’s onnxruntime-rocm.

Source

pub fn build_model_optimizer_command(&self, model_path: &str) -> ShellCommand

Construct the Python command to run ORT graph optimization on an ONNX model.

Applies ORT_ENABLE_ALL optimization level which fuses quantized ops (DynamicQuantizeLinear, MatMulInteger, etc.) into custom ops that bypass MIGraphX’s broken kernels. The optimized model is saved alongside the original.

Source

pub fn build_git_clone_command(&self) -> ShellCommand

Construct the git clone command for ONNX Runtime.

The original script clones: git clone --recursive https://github.com/microsoft/onnxruntime.git

Source

pub fn build_git_checkout_command(&self) -> ShellCommand

Construct the git checkout command for the stable tag.

The original script checks out tag v1.20.1.

Source

pub fn build_git_submodule_command(&self) -> ShellCommand

Construct the git submodule update command.

Source

pub fn build_build_command(&self, rocm_env: &RocmEnv) -> ShellCommand

Construct the ONNX Runtime build.sh command with ROCm flags.

The original script runs ./build.sh with many flags:

  • --config Release
  • --build_wheel
  • --parallel $(nproc)-1
  • --use_rocm --rocm_home /opt/rocm
  • --rocm_version 70200
  • --use_migraphx --migraphx_home /opt/rocm
  • --cmake_extra_defines CMAKE_HIP_ARCHITECTURES=...
  • Various CMAKE isolation defines
  • --allow_running_as_root
Source

pub fn build_uninstall_command(&self) -> ShellCommand

Construct the pip uninstall command to remove all onnxruntime variants.

Source

pub fn build_wheel_install_command(&self) -> ShellCommand

Construct the pip install command for the built wheel.

The original script installs from: build/Linux/Release/dist/*.whl

Source

pub fn check_build_output( &self, stdout: &str, stderr: &str, exit_code: i32, ) -> Result<(), String>

Check build output for errors.

Detects common build failure patterns and propagates as an error.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more