Title: [BUG] opencl-interop `get_device_type` always returns `DeviceType::ALL` · Issue #382 · arrayfire/arrayfire-rust · GitHub
Open Graph Title: [BUG] opencl-interop `get_device_type` always returns `DeviceType::ALL` · Issue #382 · arrayfire/arrayfire-rust
X Title: [BUG] opencl-interop `get_device_type` always returns `DeviceType::ALL` · Issue #382 · arrayfire/arrayfire-rust
Description: 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...
Open Graph Description: 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::AL...
X Description: 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::AL...
Opengraph URL: https://github.com/arrayfire/arrayfire-rust/issues/382
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG] opencl-interop `get_device_type` always returns `DeviceType::ALL`","articleBody":"Description\n===========\nThe `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.\n```rust\n///// Fetch Active ArrayFire device's type i.e. CPU/GPU/Accelerator etc.\npub fn get_device_type() -\u003e DeviceType {\n let mut out: i32 = 0;\n let err_val = unsafe { afcl_get_device_type(\u0026mut out as *mut c_int) };\n handle_error_general(AfError::from(err_val));\n match out {\n -1 =\u003e unsafe { mem::transmute(out as u64) },\n _ =\u003e DeviceType::ALL,\n }\n}\n```\n\nThe value of `-1` corresponds to `AFCL_DEVICE_TYPE_UNKNOWN` in arrayfire, whilst `-1` corresponds to `CL_DEVICE_TYPE_ALL` in `cl-sys`","author":{"url":"https://github.com/nikhilr612","@type":"Person","name":"nikhilr612"},"datePublished":"2025-01-27T11:14:11.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/382/arrayfire-rust/issues/382"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c0d027bf-b890-b045-2a9a-4c9e3e19a5c3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B860:378B25:428D08:5F2960:696E4711 |
| html-safe-nonce | 89b2dd68b672c1cf6b010058c6611b6938de1fab9ae7e2f880f9c2cc0b9db4b8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODYwOjM3OEIyNTo0MjhEMDg6NUYyOTYwOjY5NkU0NzExIiwidmlzaXRvcl9pZCI6IjU5NzU0NjM0MTk2MTE4OTEzNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c709c0dab5aa4ed49a9441a89b3948ef08a77d60fe68b64450e5de75fcdccd58 |
| hovercard-subject-tag | issue:2812730081 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/arrayfire/arrayfire-rust/382/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d3eced5946aab16e0b1573c2a77f9ca06a842cd633af4ba6ad3631de06297585/arrayfire/arrayfire-rust/issues/382 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d3eced5946aab16e0b1573c2a77f9ca06a842cd633af4ba6ad3631de06297585/arrayfire/arrayfire-rust/issues/382 |
| og:image:alt | 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::AL... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nikhilr612 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d96554e55b469c47dbcd31f74dc86278872b170531e84c6ce7f3389673e01d1 |
| turbo-cache-control | no-preview |
| go-import | github.com/arrayfire/arrayfire-rust git https://github.com/arrayfire/arrayfire-rust.git |
| octolytics-dimension-user_id | 5395442 |
| octolytics-dimension-user_login | arrayfire |
| octolytics-dimension-repository_id | 35817370 |
| octolytics-dimension-repository_nwo | arrayfire/arrayfire-rust |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 35817370 |
| octolytics-dimension-repository_network_root_nwo | arrayfire/arrayfire-rust |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ef576694863a4c791d0a5cc9d2b84384d4414bcd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width