Skip to content
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

Fix clCopyImage 1D buffer images tests with use_pitches flag #2167

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MichaelRizkalla-arm
Copy link
Contributor

This change fixes the following issues when running clCopyImage test with use_pitches flag for 1D buffer images.

  1. Query device version using CL_DEVICE_NUMERIC_VERSION instead of CL_DEVICE_VERSION. Previously, using char may not be enough to store the return value. The change queries the version similar to clFillImage test binary.
  2. Pass host_ptr to clCreateBuffer when creating the buffer for the 1D image. host_ptr may not be nullptr if use_pitches flag is used. Also, buffer_flags will contain CL_MEM_USE_HOST_PTR which requires a host pointer to be passed.
  3. Conditionally use the host_ptr when calling clCreateImage, it will not be used with 1D image buffer. This is made to align with the spec, in which if mem_flags has CL_MEM_USE_HOST_PTR a host pointer must be present, but if the memory flag is not present, host pointer must be nullptr.
  4. Use the correct free function free and align_free based on the allocation function that was used.

This change fixes the following issues when running `clCopyImage` test
with `use_pitches` flag for 1D buffer images.

1. Query device version using `CL_DEVICE_NUMERIC_VERSION` instead of
   `CL_DEVICE_VERSION`. Previously, using `char` may not be enough to
   store the return value. The change queries the version similar to
   `clFillImage` test binary.
2. Pass `host_ptr` to `clCreateBuffer` when creating the buffer for the
   1D image. `host_ptr` may not be `nullptr` if use_pitches flag is
   used.
   Also, `buffer_flags` will contain `CL_MEM_USE_HOST_PTR` which
   requires a host pointer to be passed.
3. Conditionally use the `host_ptr` when calling `clCreateImage`, it
   will not be used with 1D image buffer. This is made to align with the
   spec, in which if `mem_flags` has `CL_MEM_USE_HOST_PTR` a host
   pointer must be present, but if the memory flag is not present, host
   pointer must be `nullptr`.
4. Use the correct free function `free` and `align_free` based on the
   allocation function that was used.

Signed-off-by: Michael Rizkalla <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants