cubecl-wgpu 0.11.0-pre.4

WGPU runtime for the CubeCL
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use cubecl_ir::{AdapterLuid, PhysicalDevice};
use wgpu::hal;

pub fn describe_card(adapter: &wgpu::Adapter, physical: &mut PhysicalDevice) {
    // SAFETY: the DXGI adapter is only read, while `adapter` keeps it alive.
    let Some(hal_adapter) = (unsafe { adapter.as_hal::<hal::api::Dx12>() }) else {
        return;
    };
    // SAFETY: `GetDesc2` only fills the returned description.
    let Ok(description) = (unsafe { hal_adapter.raw_adapter().GetDesc2() }) else {
        return;
    };
    let luid = description.AdapterLuid;
    physical.luid = Some(AdapterLuid::from_parts(luid.LowPart, luid.HighPart));
}