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: boolTrue 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: boolTrue 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
impl VulkanDevice
Sourcepub fn find_memory_type(
&self,
type_bits: u32,
flags: MemoryPropertyFlags,
) -> Option<u32>
pub fn find_memory_type( &self, type_bits: u32, flags: MemoryPropertyFlags, ) -> Option<u32>
Find a memory type index satisfying type_bits and flags.
Sourcepub fn submit_and_wait<F: FnOnce(CommandBuffer)>(&self, record: F)
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).
Sourcepub fn alloc_primary_cmd(&self) -> CommandBuffer
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].
Sourcepub fn free_cmds(&self, cmds: &[CommandBuffer])
pub fn free_cmds(&self, cmds: &[CommandBuffer])
Free command buffers allocated from the shared pool.
Sourcepub fn create_reusable_fence(&self) -> Fence
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].
Sourcepub fn destroy_fence(&self, fence: Fence)
pub fn destroy_fence(&self, fence: Fence)
Destroy a fence created by [create_reusable_fence].
Sourcepub fn submit_recorded_wait(&self, cmd: CommandBuffer, fence: Fence)
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§
impl Send for VulkanDevice
impl Sync for VulkanDevice
Auto Trait Implementations§
impl !Freeze for VulkanDevice
impl RefUnwindSafe for VulkanDevice
impl Unpin for VulkanDevice
impl UnsafeUnpin for VulkanDevice
impl UnwindSafe for VulkanDevice
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
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