Skip to main content

VulkanDevice

Struct VulkanDevice 

Source
pub struct VulkanDevice {
    pub entry: Entry,
    pub instance: Instance,
    pub physical: PhysicalDevice,
    pub device: Device,
    pub queue: Queue,
    pub queue_family: u32,
    pub mem_props: PhysicalDeviceMemoryProperties,
    pub limits: PhysicalDeviceLimits,
    pub name: String,
    pub portability: bool,
    pub coop_matmul: bool,
    /* private fields */
}
Expand description

Owned Vulkan context. One per process.

Fields§

§entry: Entry§instance: Instance§physical: PhysicalDevice§device: Device§queue: Queue§queue_family: u32§mem_props: PhysicalDeviceMemoryProperties§limits: PhysicalDeviceLimits§name: String§portability: bool

True when the selected device is a portability driver (MoltenVK on Apple): VK_KHR_portability_subset was required and enabled. The matmul scheduler falls back to the scalar kernel here, since shared-memory tiling regresses under Vulkan→Metal translation (Metal is Apple’s native path anyway).

§coop_matmul: bool

True when the device exposes a usable 16×16×16 f16·f16→f32 subgroup cooperative-matrix (tensor-core) config AND the features its kernel needs were enabled. Gates the matmul_coop fast path. Always false on portability drivers (MoltenVK doesn’t expose VK_KHR_cooperative_matrix).

Implementations§

Source§

impl VulkanDevice

Source

pub fn find_memory_type( &self, type_bits: u32, flags: MemoryPropertyFlags, ) -> Option<u32>

Find a memory type index satisfying type_bits and flags.

Source

pub fn submit_and_wait<F: FnOnce(CommandBuffer)>(&self, record: F)

Record record into a one-shot primary command buffer, submit it to the compute queue, and block until the GPU finishes. Serialized across threads via submit_lock (queue submission needs external synchronization).

Source

pub fn alloc_primary_cmd(&self) -> CommandBuffer

Allocate one reusable primary command buffer from the shared pool. The caller records it once and re-submits it many times via [submit_recorded_wait] (the schedule is static across runs — inputs flow through the host-visible arena, not the command stream — so a single recording is valid for every step). Free it with [free_cmds].

Source

pub fn free_cmds(&self, cmds: &[CommandBuffer])

Free command buffers allocated from the shared pool.

Source

pub fn create_reusable_fence(&self) -> Fence

Create one unsignaled fence, reused across submits (reset after each wait). Avoids the per-step create/destroy of [submit_and_wait].

Source

pub fn destroy_fence(&self, fence: Fence)

Destroy a fence created by [create_reusable_fence].

Source

pub fn submit_recorded_wait(&self, cmd: CommandBuffer, fence: Fence)

Submit an already-recorded command buffer and block until the GPU finishes, then reset fence for reuse. The command buffer must have been recorded WITHOUT ONE_TIME_SUBMIT so it can be resubmitted; since we wait here it is never pending at the next submit. Serialized via submit_lock (queue submission needs external synchronization).

Trait Implementations§

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, 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.