clover: implement CL_MEM_ALLOC_HOST_PTR
authorGrigori Goronzy <greg@chown.ath.cx>
Tue, 12 May 2015 00:22:12 +0000 (02:22 +0200)
committerGrigori Goronzy <greg@chown.ath.cx>
Sat, 23 May 2015 23:14:48 +0000 (01:14 +0200)
This flag is typically used to request pinned host memory, to avoid
any copies between GPU and CPU.

This improves throughput with an older OpenCL app which I unfortunately
can't publish due to its licensing.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/gallium/state_trackers/clover/core/resource.cpp

index bcf87e15480b8ca68012b03245601a21ecb4ee65..8ed4c4284e1f1056fa45b822c515fdd08be6d2a5 100644 (file)
@@ -137,6 +137,10 @@ root_resource::root_resource(clover::device &dev, memory_obj &obj,
                 PIPE_BIND_TRANSFER_READ |
                 PIPE_BIND_TRANSFER_WRITE);
 
+   if (obj.flags() & CL_MEM_ALLOC_HOST_PTR) {
+      info.usage = PIPE_USAGE_STAGING;
+   }
+
    pipe = dev.pipe->resource_create(dev.pipe, &info);
    if (!pipe)
       throw error(CL_OUT_OF_RESOURCES);