Skip to main content

oneapi_rs/info/
device-info.rs

1//
2// Copyright (C) 2026 Intel Corporation
3//
4// Under the MIT License or the Apache License v2.0.
5// See LICENSE-MIT and LICENSE-APACHE for license information.
6// SPDX-License-Identifier: MIT OR Apache-2.0
7//
8
9use crate::device::Device;
10use oneapi_rs_sys::device::ffi;
11
12pub trait DeviceInfo {
13    type Item;
14    fn get_item(device: &Device) -> Self::Item;
15}
16
17/// Returns the device type associated with the device. May not return `oneapi_rs::info::DeviceType::All`
18pub struct DeviceType;
19impl DeviceInfo for DeviceType {
20    type Item = crate::info::DeviceType;
21    fn get_item(device: &Device) -> Self::Item {
22        ffi::get_device_type(&device.0)
23    }
24}
25
26/// Returns a backend-defined device version.
27pub struct Version;
28impl DeviceInfo for Version {
29    type Item = String;
30    fn get_item(device: &Device) -> Self::Item {
31        ffi::get_version(&device.0)
32    }
33}
34
35/// Returns the device name of this SYCL device.
36pub struct Name;
37impl DeviceInfo for Name {
38    type Item = String;
39    fn get_item(device: &Device) -> Self::Item {
40        ffi::get_name(&device.0)
41    }
42}