2 Replies Latest reply on Oct 25, 2011 3:09 AM by genaganna

    CPU -> GPU zero copy question (APU)

    lupescu_grigore

      Using AMD SDK 2.5 & A6 3650 i have achieved a zero copy from GPU to CPU by allocating a buffer using CL_MEM_ALLOC_HOST_PTR [1] and switching between devices with enqueueMap/Unmap. 

      If i have the information already on CPU mem can i map the memory to the GPU region ? I have looked in the APP SDK programming guide section 4.4 and saw a mention regarding CL_MEM_USE_PERSISTENT_MEM_AMD but if i pass as host_ptr argument in the buffer allocation i get an error saying "INVALID HOST PTR".

      Likewise in the later case how would i map/unmap ? Would i use the same functions with the same arguments ? Does mapping mean something different when applying it to host resident memory or should i use unmap to get the GPU to see the memory ?

      The guide specifies "CL_MEM_ALLOC_HOST_PTR - a zero copy buffer that resides on the host." but using both i get invalid host. With CL_MEM_ALLOC_HOST_PTR i was though able to allocate a region on the GPU and use it map/unmap for zero copy. But first i had to copy the data using map/memcpy/unmap for the GPU to process it - which is very expensive....

       

      [1] http://blogs.amd.com/developer/2011/08/01/cpu-to-gpu-data-transfers-exceed-15gbs-using-apu-zero-copy-path/

        • CPU -> GPU zero copy question (APU)
          nou

          you can't take any arbitrary memory region and make it acesible from GPU. it must be properly aligned and page locked. so answer to you question is no.

          you should make buffer first then map it and after that load data from HDD/network/etc directly into this mapped region.

          • CPU -> GPU zero copy question (APU)
            genaganna

             

            Originally posted by: lupescu_grigore Using AMD SDK 2.5 & A6 3650 i have achieved a zero copy from GPU to CPU by allocating a buffer using CL_MEM_ALLOC_HOST_PTR [1] and switching between devices with enqueueMap/Unmap. 

             

            If i have the information already on CPU mem can i map the memory to the GPU region ?

            Mapped pointers always on host i.e CPU.

            I have looked in the APP SDK programming guide section 4.4 and saw a mention regarding CL_MEM_USE_PERSISTENT_MEM_AMD but if i pass as host_ptr argument in the buffer allocation i get an error saying "INVALID HOST PTR".

            Yes it is an invalid combination.