pub struct RocmBackend { /* private fields */ }Expand description
ROCm backend using hipTENSOR via runtime dlopen.
Status: Not yet implemented. All methods currently return errors.
The type exists to define the intended API surface. plan() and
execute() return Err(DeviceError). load_hiptensor() on
crate::BackendRegistry also returns an error.
When implemented, will be loaded at runtime from a user-provided .so
path with no compile-time ROCm SDK dependency. Will implement
the semiring-family traits for standard arithmetic on AMD GPUs.
hipTENSOR natively supports contraction, reduction, and elementwise
building blocks. Structural permute stays a tensor view, and any required
materialization path is modeled through MakeContiguous. AntiTrace and
AntiDiag will be composed via Contract(eye, dC).
§Examples
// Aspirational API — not yet functional.
use tenferro_prims::{RocmBackend, BackendRegistry};
let mut registry = BackendRegistry::new();
registry.load_hiptensor("/usr/lib/libhiptensor.so").unwrap();Implementations§
Source§impl RocmBackend
impl RocmBackend
Sourcepub fn resolve_conj<T: Scalar + Conjugate>(
_ctx: &mut RocmContext,
src: &Tensor<T>,
) -> Tensor<T>
pub fn resolve_conj<T: Scalar + Conjugate>( _ctx: &mut RocmContext, src: &Tensor<T>, ) -> Tensor<T>
Materialize a lazily-conjugated tensor on GPU.
Status: Stub fallback. If data is CPU-accessible, this materializes
conjugation into a new non-conjugated tensor. Otherwise it returns a
clone of src.
When implemented, will use the analytic/scalar family execution traits
to produce a new tensor with conjugated = false.
Trait Implementations§
Source§impl Drop for RocmBackend
impl Drop for RocmBackend
Source§impl<S: Scalar> TensorAnalyticPrims<Standard<S>> for RocmBackend
impl<S: Scalar> TensorAnalyticPrims<Standard<S>> for RocmBackend
type Plan = ()
type Context = RocmContext
Source§fn plan(
_ctx: &mut Self::Context,
desc: &AnalyticPrimsDescriptor,
_shapes: &[&[usize]],
) -> Result<Self::Plan>
fn plan( _ctx: &mut Self::Context, desc: &AnalyticPrimsDescriptor, _shapes: &[&[usize]], ) -> Result<Self::Plan>
Source§fn execute(
_ctx: &mut Self::Context,
_plan: &Self::Plan,
_alpha: S,
_inputs: &[&Tensor<S>],
_beta: S,
_output: &mut Tensor<S>,
) -> Result<()>
fn execute( _ctx: &mut Self::Context, _plan: &Self::Plan, _alpha: S, _inputs: &[&Tensor<S>], _beta: S, _output: &mut Tensor<S>, ) -> Result<()>
Source§fn has_analytic_support(_desc: AnalyticPrimsDescriptor) -> bool
fn has_analytic_support(_desc: AnalyticPrimsDescriptor) -> bool
Source§impl<Input> TensorComplexRealPrims<Input> for RocmBackend
impl<Input> TensorComplexRealPrims<Input> for RocmBackend
Source§type Real = <Input as ComplexFloat>::Real
type Real = <Input as ComplexFloat>::Real
Source§type Context = RocmContext
type Context = RocmContext
Source§fn plan(
_ctx: &mut Self::Context,
desc: &ComplexRealPrimsDescriptor,
_shapes: &[&[usize]],
) -> Result<Self::Plan>
fn plan( _ctx: &mut Self::Context, desc: &ComplexRealPrimsDescriptor, _shapes: &[&[usize]], ) -> Result<Self::Plan>
Source§fn execute(
_ctx: &mut Self::Context,
_plan: &Self::Plan,
_alpha: Input::Real,
_inputs: &[&Tensor<Input>],
_beta: Input::Real,
_output: &mut Tensor<Self::Real>,
) -> Result<()>
fn execute( _ctx: &mut Self::Context, _plan: &Self::Plan, _alpha: Input::Real, _inputs: &[&Tensor<Input>], _beta: Input::Real, _output: &mut Tensor<Self::Real>, ) -> Result<()>
Source§fn has_complex_real_support(_desc: ComplexRealPrimsDescriptor) -> bool
fn has_complex_real_support(_desc: ComplexRealPrimsDescriptor) -> bool
Source§impl<Input> TensorComplexScalePrims<Input> for RocmBackend
impl<Input> TensorComplexScalePrims<Input> for RocmBackend
Source§type Context = RocmContext
type Context = RocmContext
Source§fn plan(
_ctx: &mut Self::Context,
desc: &ComplexScalePrimsDescriptor,
_shapes: &[&[usize]],
) -> Result<Self::Plan>
fn plan( _ctx: &mut Self::Context, desc: &ComplexScalePrimsDescriptor, _shapes: &[&[usize]], ) -> Result<Self::Plan>
Source§fn execute(
_ctx: &mut Self::Context,
_plan: &Self::Plan,
_alpha: Input,
_lhs: &Tensor<Input>,
_rhs: &Tensor<Input::Real>,
_beta: Input,
_output: &mut Tensor<Input>,
) -> Result<()>
fn execute( _ctx: &mut Self::Context, _plan: &Self::Plan, _alpha: Input, _lhs: &Tensor<Input>, _rhs: &Tensor<Input::Real>, _beta: Input, _output: &mut Tensor<Input>, ) -> Result<()>
Source§fn has_complex_scale_support(_desc: ComplexScalePrimsDescriptor) -> bool
fn has_complex_scale_support(_desc: ComplexScalePrimsDescriptor) -> bool
Source§impl<S: Scalar> TensorIndexingPrims<Standard<S>> for RocmBackend
impl<S: Scalar> TensorIndexingPrims<Standard<S>> for RocmBackend
Source§type Context = RocmContext
type Context = RocmContext
Source§fn plan(
_ctx: &mut Self::Context,
desc: &IndexingPrimsDescriptor,
_shapes: &[&[usize]],
) -> Result<Self::Plan>
fn plan( _ctx: &mut Self::Context, desc: &IndexingPrimsDescriptor, _shapes: &[&[usize]], ) -> Result<Self::Plan>
Source§fn execute(
_ctx: &mut Self::Context,
_plan: &Self::Plan,
_inputs: &[&Tensor<S>],
_indices: &Tensor<i64>,
_output: &mut Tensor<S>,
) -> Result<()>
fn execute( _ctx: &mut Self::Context, _plan: &Self::Plan, _inputs: &[&Tensor<S>], _indices: &Tensor<i64>, _output: &mut Tensor<S>, ) -> Result<()>
Source§fn has_indexing_support(_desc: IndexingPrimsDescriptor) -> bool
fn has_indexing_support(_desc: IndexingPrimsDescriptor) -> bool
Source§impl<S: Scalar + NumCast> TensorMetadataCastPrims<S> for RocmBackend
impl<S: Scalar + NumCast> TensorMetadataCastPrims<S> for RocmBackend
Source§type Plan = MetadataCastPrimsDescriptor
type Plan = MetadataCastPrimsDescriptor
Source§type Context = RocmContext
type Context = RocmContext
Source§fn plan(
_ctx: &mut RocmContext,
desc: &MetadataCastPrimsDescriptor,
_shapes: &[&[usize]],
) -> Result<Self::Plan>
fn plan( _ctx: &mut RocmContext, desc: &MetadataCastPrimsDescriptor, _shapes: &[&[usize]], ) -> Result<Self::Plan>
Source§fn execute(
_ctx: &mut RocmContext,
_plan: &Self::Plan,
_alpha: S,
_inputs: &[MetadataScalarTensorRef<'_, S>],
_beta: S,
_output: &mut Tensor<S>,
) -> Result<()>
fn execute( _ctx: &mut RocmContext, _plan: &Self::Plan, _alpha: S, _inputs: &[MetadataScalarTensorRef<'_, S>], _beta: S, _output: &mut Tensor<S>, ) -> Result<()>
Source§fn has_metadata_cast_support(_desc: MetadataCastPrimsDescriptor) -> bool
fn has_metadata_cast_support(_desc: MetadataCastPrimsDescriptor) -> bool
Source§impl TensorMetadataPrims for RocmBackend
impl TensorMetadataPrims for RocmBackend
Source§type Plan = MetadataPrimsDescriptor
type Plan = MetadataPrimsDescriptor
Source§type Context = RocmContext
type Context = RocmContext
Source§fn plan(
_ctx: &mut RocmContext,
desc: &MetadataPrimsDescriptor,
_inputs: &[MetadataTensorRef<'_>],
_output: MetadataTensorMut<'_>,
) -> Result<Self::Plan>
fn plan( _ctx: &mut RocmContext, desc: &MetadataPrimsDescriptor, _inputs: &[MetadataTensorRef<'_>], _output: MetadataTensorMut<'_>, ) -> Result<Self::Plan>
Source§fn execute(
_ctx: &mut RocmContext,
_plan: &Self::Plan,
_inputs: &[MetadataTensorRef<'_>],
_output: MetadataTensorMut<'_>,
) -> Result<()>
fn execute( _ctx: &mut RocmContext, _plan: &Self::Plan, _inputs: &[MetadataTensorRef<'_>], _output: MetadataTensorMut<'_>, ) -> Result<()>
Source§fn has_metadata_support(_desc: MetadataPrimsDescriptor) -> bool
fn has_metadata_support(_desc: MetadataPrimsDescriptor) -> bool
Source§impl TensorRngPrims<Standard<f64>> for RocmBackend
impl TensorRngPrims<Standard<f64>> for RocmBackend
Source§type Context = RocmContext
type Context = RocmContext
Source§fn plan(
_ctx: &mut Self::Context,
desc: &RngPrimsDescriptor,
_shapes: &[&[usize]],
) -> Result<Self::Plan>
fn plan( _ctx: &mut Self::Context, desc: &RngPrimsDescriptor, _shapes: &[&[usize]], ) -> Result<Self::Plan>
Source§fn execute(
_ctx: &mut Self::Context,
_plan: &Self::Plan,
_generator: &mut Generator,
_output: &mut Tensor<f64>,
) -> Result<()>
fn execute( _ctx: &mut Self::Context, _plan: &Self::Plan, _generator: &mut Generator, _output: &mut Tensor<f64>, ) -> Result<()>
Source§fn has_rng_support(_desc: RngPrimsDescriptor) -> bool
fn has_rng_support(_desc: RngPrimsDescriptor) -> bool
Source§impl TensorRngPrims<Standard<i32>> for RocmBackend
impl TensorRngPrims<Standard<i32>> for RocmBackend
Source§type Context = RocmContext
type Context = RocmContext
Source§fn plan(
_ctx: &mut Self::Context,
desc: &RngPrimsDescriptor,
_shapes: &[&[usize]],
) -> Result<Self::Plan>
fn plan( _ctx: &mut Self::Context, desc: &RngPrimsDescriptor, _shapes: &[&[usize]], ) -> Result<Self::Plan>
Source§fn execute(
_ctx: &mut Self::Context,
_plan: &Self::Plan,
_generator: &mut Generator,
_output: &mut Tensor<i32>,
) -> Result<()>
fn execute( _ctx: &mut Self::Context, _plan: &Self::Plan, _generator: &mut Generator, _output: &mut Tensor<i32>, ) -> Result<()>
Source§fn has_rng_support(_desc: RngPrimsDescriptor) -> bool
fn has_rng_support(_desc: RngPrimsDescriptor) -> bool
Source§impl<S: Scalar> TensorScalarPrims<Standard<S>> for RocmBackend
impl<S: Scalar> TensorScalarPrims<Standard<S>> for RocmBackend
type Plan = ()
type Context = RocmContext
Source§fn plan(
_ctx: &mut Self::Context,
desc: &ScalarPrimsDescriptor,
_shapes: &[&[usize]],
) -> Result<Self::Plan>
fn plan( _ctx: &mut Self::Context, desc: &ScalarPrimsDescriptor, _shapes: &[&[usize]], ) -> Result<Self::Plan>
Source§fn execute(
_ctx: &mut Self::Context,
_plan: &Self::Plan,
_alpha: S,
_inputs: &[&Tensor<S>],
_beta: S,
_output: &mut Tensor<S>,
) -> Result<()>
fn execute( _ctx: &mut Self::Context, _plan: &Self::Plan, _alpha: S, _inputs: &[&Tensor<S>], _beta: S, _output: &mut Tensor<S>, ) -> Result<()>
Source§fn has_scalar_support(_desc: ScalarPrimsDescriptor) -> bool
fn has_scalar_support(_desc: ScalarPrimsDescriptor) -> bool
Source§impl<S: Scalar> TensorSemiringCore<Standard<S>> for RocmBackend
impl<S: Scalar> TensorSemiringCore<Standard<S>> for RocmBackend
Source§type Context = RocmContext
type Context = RocmContext
Source§fn plan(
_ctx: &mut RocmContext,
_desc: &SemiringCoreDescriptor,
_shapes: &[&[usize]],
) -> Result<RocmPlan<S>>
fn plan( _ctx: &mut RocmContext, _desc: &SemiringCoreDescriptor, _shapes: &[&[usize]], ) -> Result<RocmPlan<S>>
Source§impl<S: Scalar> TensorSemiringFastPath<Standard<S>> for RocmBackend
impl<S: Scalar> TensorSemiringFastPath<Standard<S>> for RocmBackend
Source§type Context = RocmContext
type Context = RocmContext
Source§fn plan(
_ctx: &mut RocmContext,
_desc: &SemiringFastPathDescriptor,
_shapes: &[&[usize]],
) -> Result<RocmPlan<S>>
fn plan( _ctx: &mut RocmContext, _desc: &SemiringFastPathDescriptor, _shapes: &[&[usize]], ) -> Result<RocmPlan<S>>
Source§fn execute(
_ctx: &mut RocmContext,
_plan: &RocmPlan<S>,
_alpha: S,
_inputs: &[&Tensor<S>],
_beta: S,
_output: &mut Tensor<S>,
) -> Result<()>
fn execute( _ctx: &mut RocmContext, _plan: &RocmPlan<S>, _alpha: S, _inputs: &[&Tensor<S>], _beta: S, _output: &mut Tensor<S>, ) -> Result<()>
Source§fn has_fast_path(_desc: SemiringFastPathDescriptor) -> bool
fn has_fast_path(_desc: SemiringFastPathDescriptor) -> bool
Source§impl<S: Scalar + PartialOrd> TensorSortPrims<Standard<S>> for RocmBackend
impl<S: Scalar + PartialOrd> TensorSortPrims<Standard<S>> for RocmBackend
Source§type Context = RocmContext
type Context = RocmContext
Source§fn plan(
_ctx: &mut Self::Context,
desc: &SortPrimsDescriptor,
_shapes: &[&[usize]],
) -> Result<Self::Plan>
fn plan( _ctx: &mut Self::Context, desc: &SortPrimsDescriptor, _shapes: &[&[usize]], ) -> Result<Self::Plan>
Source§fn execute(
_ctx: &mut Self::Context,
_plan: &Self::Plan,
_input: &Tensor<S>,
_values_out: &mut Tensor<S>,
_indices_out: &mut Tensor<i64>,
) -> Result<()>
fn execute( _ctx: &mut Self::Context, _plan: &Self::Plan, _input: &Tensor<S>, _values_out: &mut Tensor<S>, _indices_out: &mut Tensor<i64>, ) -> Result<()>
Source§fn has_sort_support(_desc: &SortPrimsDescriptor) -> bool
fn has_sort_support(_desc: &SortPrimsDescriptor) -> bool
impl Send for RocmBackend
§Safety
RocmBackend can be safely sent across threads because:
- The
_handleis an opaque pointer to a hipTENSOR handle - The
_lib(libloading::Library) is thread-safe after loading - The handle is read-only after construction
- Drop clears the handle before the library is unloaded, preventing use-after-free
impl Sync for RocmBackend
§Safety
RocmBackend can be safely shared across threads because:
- The hipTENSOR handle is designed for concurrent use from multiple threads
- The library handle (
_lib) is read-only after construction - Symbol lookup via
dlsymis thread-safe on POSIX systems - Drop uses
&mut self, ensuring exclusive access during cleanup
Auto Trait Implementations§
impl Freeze for RocmBackend
impl RefUnwindSafe for RocmBackend
impl Unpin for RocmBackend
impl UnwindSafe for RocmBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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