-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CL_MEM_USE_HOST_PTR can result in undefined behaviour #52
Comments
This is an OpenCL issue, it is not a bug that has been introduced by this library. |
I do understand the OpenCL documentation around |
@awused is right. Any OpenCL functions that can lead to undefined behaviour in Rust should be declared Note: they should also be declared |
Changes published to crates.io. |
CL_MEM_USE_HOST_PTR
is useful for performance but has additional requirements that need to be upheld by the program for it to be used safely. Looking at the example in https://github.com/kenba/opencl3/blob/main/examples/basic.rs, switchingx
toCL_MEM_USE_HOST_PTR
like this will result in an error from OpenCL, which is the best case.The allocation pointed to by the host pointer may be too small, unaligned, or of the wrong type, or just not live long enough. There are also a set of alignment rules that need to be checked for this to be safe. See https://registry.khronos.org/OpenCL/sdk/2.0/docs/man/xhtml/dataTypes.html
The text was updated successfully, but these errors were encountered: