Skip to main content

Device

Struct Device 

Source
pub struct Device { /* private fields */ }

Implementations§

Source§

impl Device

Source

pub fn new_simulated(id: u64, props: DeviceProperties) -> Self

Source

pub fn open() -> TptrResult<Self>

Open the best available real device backend, falling back to a simulated device when none is present. Mirrors VendorBackend::detect() but at the tpt-gpu-runtime::Device level (currently CUDA only).

Source

pub fn is_real(&self) -> bool

Returns true if this device is backed by real hardware.

Source

pub fn handle(&self) -> DeviceHandle

Source

pub fn info(&self) -> &DeviceInfo

Source

pub fn properties(&self) -> &DeviceProperties

Source

pub fn allocate( &mut self, size: u64, region: MemoryRegion, mem_type: MemType, access: MemAccess, ) -> TptrResult<MemoryAllocation>

Source

pub fn free(&mut self, allocation: &MemoryAllocation) -> TptrResult<()>

Source

pub fn allocator_stats(&self) -> AllocatorStats

Source

pub fn memcpy_htod( &self, dst: &MemoryAllocation, src: &[u8], size: u64, dst_offset: u64, ) -> TptrResult<()>

Source

pub fn memcpy_dtoh( &self, dst: &mut [u8], src: &MemoryAllocation, size: u64, src_offset: u64, ) -> TptrResult<()>

Source

pub fn create_queue( &mut self, _priority: QueuePriority, capacity: usize, ) -> QueueHandle

Source

pub fn submit( &mut self, queue: QueueHandle, command: Command, priority: QueuePriority, ) -> TptrResult<u64>

Source

pub fn scheduler_mut(&mut self) -> &mut CommandScheduler

Source

pub fn create_kernel(&self, name: &str) -> Kernel

Source

pub fn load_module(&self, tptir_text: &str) -> TptrResult<Kernel>

Load a TPTIR text module and compile it into a runnable Kernel.

This is the external-integration entry point: callers pass TPTIR assembly (e.g. emitted by tpt-archon) and receive a Kernel whose compiled code is stored on the handle so that launch_kernel can dispatch against it. Compilation uses layer3_tptc’s compile_native (the tpt-gpu-compiler crate).

Source

pub fn launch_kernel( &self, kernel: &Kernel, config: &KernelConfig, args: &[Vec<u8>], ) -> KernelHandle

Source

pub fn synchronize(&mut self)

Source

pub fn pending_commands(&self) -> usize

Trait Implementations§

Source§

impl Debug for Device

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Device

§

impl !RefUnwindSafe for Device

§

impl !UnwindSafe for Device

§

impl Send for Device

§

impl Sync for Device

§

impl Unpin for Device

§

impl UnsafeUnpin for Device

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.