[BUG] opencl-interop `get_device_type` always returns `DeviceType::ALL`

未关闭
#382 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
rust
领域
hpc

调研方向

从 issue 中显示的 get_device_type 函数开始,将其返回值映射与 AFCL_DEVICE_TYPE_UNKNOWN 值以及报告中链接的 cl-sys DeviceType 定义进行比较。确认对 ArrayFire unknown 值的预期处理,并验证它不再报告 DeviceType::ALL。

由索引模型根据 Issue 内容生成。

描述

Bug

Description

The get_device_type function transmutes the value -1 into DeviceType or returns DeviceType::ALL; however, the enum variant that corresponds to the value (-1i32 as u64) is DeviceType::ALL. This does not seem to be the intended behaviour.

///// Fetch Active ArrayFire device's type i.e. CPU/GPU/Accelerator etc.
pub fn get_device_type() -> DeviceType {
    let mut out: i32 = 0;
    let err_val = unsafe { afcl_get_device_type(&mut out as *mut c_int) };
    handle_error_general(AfError::from(err_val));
    match out {
        -1 => unsafe { mem::transmute(out as u64) },
        _ => DeviceType::ALL,
    }
}

The value of -1 corresponds to AFCL_DEVICE_TYPE_UNKNOWN in arrayfire, whilst -1 corresponds to CL_DEVICE_TYPE_ALL in cl-sys

主要语言
Rust
星标
827
派生
59
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

arrayfire/arrayfire-rust 的其他 Issue

查看 arrayfire/arrayfire-rust 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。