clover/device: Calculate CL_DEVICE_MEM_BASE_ADDR_ALIGN in device
authorAaron Watry <awatry@gmail.com>
Thu, 17 Aug 2017 01:44:41 +0000 (20:44 -0500)
committerAaron Watry <awatry@gmail.com>
Tue, 22 Aug 2017 01:21:52 +0000 (20:21 -0500)
commit5e253fe338c2473553cfb57d3ba85e26e90e1a4e
treeab94459d44f63f321efe800c3dc0f8a09eecd9da
parent19e9bd4c117f9f38f4fdec0467a57f0e29e5c0f3
clover/device: Calculate CL_DEVICE_MEM_BASE_ADDR_ALIGN in device

The CL CTS queries CL_DEVICE_MEM_BASE_ADDR_ALIGN for a device and
then allocates user pointers aligned to that value for its tests.

The minimum value is defined as:
  the size (in bits) of the largest OpenCL built-in data type supported
  by the device (long16 in FULL profile, long16 or int16 in EMBEDDED
  profile) for devices that are not of type CL_DEVICE_TYPE_CUSTOM.

At the moment, all known devices that support user pointers require
CPU page alignment for buffers created from user pointers, so just
query that from sysconf.

v3: Use std::max instead of MAX2 (Francisco)
    Add missing unistd include
v2: Use system page size instead of a new pipe cap

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by (v2): Jan Vesely <jan.vesely@rutgers.edu>
src/gallium/state_trackers/clover/api/device.cpp
src/gallium/state_trackers/clover/core/device.cpp
src/gallium/state_trackers/clover/core/device.hpp