Skip to main content

Crate hrx

Crate hrx 

Source
Expand description

GPU execution and Loom compilation without a build-time native dependency.

Native libraries are verified and loaded on first use. See bundle for offline setup.

Re-exports§

pub use execution::Access;
pub use execution::Completion;
pub use execution::Runtime;

Modules§

artifacts
Model artifact discovery and parsing.
benchmark
Reusable benchmark distributions and synchronized stage timing.
bundle
Reproducible native provisioning. No build script downloads or native link flags.
execution
Coordinated GPU/NPU execution with inferred memory dependencies. Coordinated execution for GPU and NPU kernels.
gpu
Low-level GPU execution. Kernel dispatch and external memory access require the caller to establish their safety and synchronization contracts.
image
Device-resident image transformations with bounded reusable plans.
inference
Shared model context, owned tensor transfers, and bounded inference slots.
jobs
Bounded host orchestration for asynchronous FFI callers and streaming pipelines. Jobs may block on coordinated GPU completions without occupying the caller’s scheduler. Cancellation never interrupts native work: running work drains.
loom
In-process Loom compilation with reusable indexed modules and verified disk artifacts.
model
Resident Loom workloads built from reusable buffers, kernels and graphs.
npu
XDNA2 programs and fixed instruction specializations.
plan_cache
Bounded, single-flight preparation with idle-only LRU eviction.
residency
Opt-in, byte-budgeted model residency with transactional loader reservations.
runner
hrx run — launch one Loom-compiled kernel on the GPU and dump its buffers.
tensor
Checked tensor metadata and owned views in one coordinated runtime.

Structs§

AccessGraph
A raw GPU graph whose edges are inferred from declared buffer access.
AccessView
One graph binding and the complete access performed through it.
Buffer
An owned device allocation. Use Buffer::binding or Buffer::try_slice to borrow a binding; this API does not expose host pointers. A handle is bound to its device. Any stream on that device may use it; ordering conflicting access is the caller’s, with events.
BufferPool
A bounded free list whose allocations are safe to reuse on one ordered stream.
Constants
Explicit scalar widths, packed in declaration order for HRX binding dispatch. Unlike direct kernargs this format has no implicit alignment or pointer slots. Export metadata gives only the total byte count. Mixed scalar widths must come from the kernel’s argument contract.
Device
A borrowed device registry entry. Opening a stream never acquires ownership of the native device, and dropping a model never shuts down HRX globally.
Event
An immutable stream completion point. Native queues retain its semaphore after a wait is enqueued, so dropping the event never cancels a dependency. This is a synchronization primitive; the pinned runtime has no GPU timestamps.
ExportInfo
Native export metadata used to validate dispatch shapes and arguments. Immutable native export metadata, valid while its kernel is retained.
Graph
A recording of GPU work as a dependency graph, replayed as a unit.
GraphExec
An instantiated graph. Native instantiation retains HAL allocations and executables; the Arc keeps their device and originating stream alive. Recording borrows its inputs until finish; replay no longer borrows them. Drop waits for its last replay, without submitting or waiting for later stream work. A graph that has never been launched is released immediately.
Kernel
A loaded executable export with immutable dispatch metadata. Kernels can be dispatched on any stream on their device; buffer handles belong to individual streams.
Node
A recorded operation, used to declare what later operations depend on.
PooledBuffer
Device storage returned to its BufferPool when the lease drops.
Readback
Owned host-visible destination of a queued download. Dropping it before completion is safe: the native command buffer retains its unmapped storage.
Stream
An ordered command stream. Mutating operations require exclusive access. Prepared kernels and allocations can be reused without a compiler/cache lookup.
Submission
A borrowed submission fence. Waiting also releases completed staging. Drop does not wait; the stream continues to own everything needed by queued work.
Target
An AMDGPU architecture key shared by devices, manifests and compiler profiles.
View
A binding into a device allocation, borrowed from it.

Enums§

Error
A runtime, validation, provisioning or compiler failure.

Constants§

TARGET_FAMILY
The native target family used for executable loading.
TARGET_KEY
Default compiler target; devices report their architecture at runtime.

Traits§

Scalar
A supported fixed-width scalar for little-endian binding constants.

Type Aliases§

Result
The result of an HRX operation.