arrayfire / arrayfire/arrayfire-rust

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

未關閉
#382 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
Bug
主要語言
Rust
星號
827
分支
59
PR 合併指標
30 天內沒有已合併 PR

描述

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_](https://docs.rs/cl-sys/latest/src/cl_sys/cl_h.rs.html#216) `DeviceType::ALL`. This does not seem to be the intended behaviour.
```rust
///// 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`

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

Start at the get_device_type function shown in the issue and compare its return mapping with the AFCL_DEVICE_TYPE_UNKNOWN value and cl-sys DeviceType definitions linked in the report. Confirm the intended handling of the ArrayFire unknown value and verify that it no longer reports DeviceType::ALL.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
rust
領域
hpc
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。