[Mesa-dev] [PATCH] clover: Fix host access validation for sub-buffer creation

Jan Vesely jan.vesely at rutgers.edu
Wed Apr 25 14:03:48 UTC 2018


On Thu, 2018-04-19 at 20:39 -0500, Aaron Watry wrote:
>   From CL 1.2 Section 5.2.1:
>     CL_INVALID_VALUE if buffer was created with CL_MEM_HOST_WRITE_ONLY and
>     flags specify CL_MEM_HOST_READ_ONLY , or if buffer was created with
>     CL_MEM_HOST_READ_ONLY and flags specify CL_MEM_HOST_WRITE_ONLY , or if
>     buffer was created with CL_MEM_HOST_NO_ACCESS and flags specify
>     CL_MEM_HOST_READ_ONLY or CL_MEM_HOST_WRITE_ONLY .
> 
> Fixes CL 1.2 CTS test/api get_buffer_info

Hi Aaron,

there are similar failures in test/mem_host_flags:

test_mem_host_write_only_buffer_RW_Mapping
Mapped host pointer difference found
ERROR: test_mem_host_write_only_buffer_RW_Mapping! ((unknown) from /home/jvesely/OpenCL-CTS/test_conformance/mem_host_flags/mem_host_buffer.cpp:267)
ERROR: test_mem_host_write_only_buffer! ((unknown) from /home/jvesely/OpenCL-CTS/test_conformance/mem_host_flags/mem_host_buffer.cpp:295)
test_mem_host_write_only_buffer FAILED

test_mem_host_write_only_buffer_RW_Mapping
Mapped host pointer difference found
ERROR: test_mem_host_write_only_buffer_RW_Mapping! ((unknown) from /home/jvesely/OpenCL-CTS/test_conformance/mem_host_flags/mem_host_buffer.cpp:267)
ERROR: test_mem_host_write_only_subbuffer! ((unknown) from /home/jvesely/OpenCL-CTS/test_conformance/mem_host_flags/mem_host_buffer.cpp:328)
test_mem_host_write_only_subbuffer FAILED

...
FAILED 2 of 9 tests

Are you looking into those as well?

thanks,
Jan

> 
> v2: Correct host_access_flags check (Francisco)
> 
> Signed-off-by: Aaron Watry <awatry at gmail.com>
> Cc: Francisco Jerez <currojerez at riseup.net>
> ---
>  src/gallium/state_trackers/clover/api/memory.cpp | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/clover/api/memory.cpp b/src/gallium/state_trackers/clover/api/memory.cpp
> index 9b3cd8b1f5..e83be0286a 100644
> --- a/src/gallium/state_trackers/clover/api/memory.cpp
> +++ b/src/gallium/state_trackers/clover/api/memory.cpp
> @@ -57,8 +57,12 @@ namespace {
>                                        parent.flags() & host_access_flags) |
>                                       (parent.flags() & host_ptr_flags));
>  
> -         if (~flags & parent.flags() &
> -             ((dev_access_flags & ~CL_MEM_READ_WRITE) | host_access_flags))
> +         if (~flags & parent.flags() & (dev_access_flags & ~CL_MEM_READ_WRITE))
> +            throw error(CL_INVALID_VALUE);
> +
> +         //Check if new host access flags cause a mismatch between host-read/write-only.
> +         if (!(flags & CL_MEM_HOST_NO_ACCESS) &&
> +             (~flags & parent.flags() & host_access_flags))
>              throw error(CL_INVALID_VALUE);
>  
>           return flags;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180425/8a544400/attachment.sig>


More information about the mesa-dev mailing list