4 Replies Latest reply on Aug 10, 2012 3:19 PM by nou

    enqueueFillBuffer with CL_MEM_HOST_READ_ONLY or CL_MEM_HOST_NO_ACCESS

    settle

      I found in that if a memory object has CL_MEM_HOST_READ_ONLY or CL_MEM_HOST_NO_ACCESS set, then it cannot be written to via enqueueWrite* or enqueueMap*.  Does that also mean that such a memory object cannot be written to via enqueueFillBuffer?

       

      Also just to clarify things for me, can a cpu device (which is the host) and corresponding command queue enqueue a kernel that writes to those kinds of memory objects?

       

      Sorry if I confused the properties of the above host access types, and I'd greatly appreciate any help.

          • Re: enqueueFillBuffer with CL_MEM_HOST_READ_ONLY or CL_MEM_HOST_NO_ACCESS
            settle

            The flags I'm wondering about are from 5.2.1 Creating Buffer Objects in the OpenCL 1.2 Specification:

            cl_mem_flagsDescription
            CL_MEM_HOST_WRITE_ONLY

            This flag specifies that the host will only write to the

            memory object (using OpenCL APIs that enqueue a

            write or a map for write). This can be used to

            optimize write access from the host (e.g. enable writecombined

            allocations for memory objects for devices

            that communicate with the host over a system bus

            such as PCIe).

            CL_MEM_HOST_READ_ONLY

            This flag specifies that the host will only read the

            memory object (using OpenCL APIs that enqueue a

            read or a map for read).

            CL_MEM_HOST_WRITE_ONLY and

            CL_MEM_HOST_READ_ONLY are mutually

            exclusive.

            CL_MEM_HOST_NO_ACCESS

            This flag specifies that the host will not read or write

            the memory object.

            CL_MEM_HOST_WRITE_ONLY or

            CL_MEM_HOST_READ_ONLY and

            CL_MEM_HOST_NO_ACCESS are mutually

            exclusive.

            Table 5.3 List of supported cl_mem_flags values

             

            The enqueueFillBuffer command is from 5.2.3 Filling Buffer Objects.

            The function clEnqueueFillBuffer enqueues a command to fill a buffer object with a pattern of a given pattern size. The usage information which indicates whether the memory object can be read or written by a kernel and/or the host and is given by the cl_mem_flags argument value specified when buffer is created is ignored by clEnqueueFillBuffer.

            So that I guess that answers my question (sorry I didn't see this line earlier).

             

            My remaining question is can a memory object with flags CL_MEM_HOST_READ_ONLY or CL_MEM_HOST_NO_ACCESS be written by a kernel running on a CPU device's command queue (since a CPU device is the host, right?).

             

            I hope that helps clarify my question.  Thanks!