[Mesa-dev] [PATCH] clover: probe pipe for the value of CL_DEVICE_ADDRESS_BITS
Jan Vesely
jan.vesely at rutgers.edu
Mon Aug 29 19:30:46 UTC 2016
On Mon, 2016-08-29 at 20:13 +0200, Vedran Miletić wrote:
> Clover presently reports 32 as CL_DEVICE_ADDRESS_BITS, which is not
> correct for AMD SI and newer chip generations. This patch introduces
> the PIPE_COMPUTE_CAP_ADDRESS_BITS pipe capability queried by Clover
> to r600 pipe and sets the value to 32 for AMD EG/NI chips and 64 for
> SI and newer (chips older than EG will not use this capability).
I pushed my version that handles the PIPE_CAP in other pipes as well.
Jan
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97513
> Signed-off-by: Vedran Miletić <vedran at miletic.net>
> ---
> src/gallium/drivers/radeon/r600_pipe_common.c | 9 +++++++++
> src/gallium/include/pipe/p_defines.h | 3 ++-
> src/gallium/state_trackers/clover/api/device.cpp | 2 +-
> src/gallium/state_trackers/clover/core/device.cpp | 6 ++++++
> src/gallium/state_trackers/clover/core/device.hpp | 1 +
> 5 files changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c
> b/src/gallium/drivers/radeon/r600_pipe_common.c
> index b1da22f..7385715 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -955,6 +955,15 @@ static int r600_get_compute_param(struct
> pipe_screen *screen,
> *subgroup_size =
> r600_wavefront_size(rscreen->family);
> }
> return sizeof(uint32_t);
> + case PIPE_COMPUTE_CAP_ADDRESS_BITS:
> + if (ret) {
> + uint32_t *address_bits = ret;
> + if (rscreen->chip_class >= SI)
> + *address_bits = 64;
> + else
> + *address_bits = 32;
> + }
> + return sizeof(uint32_t);
> }
>
> fprintf(stderr, "unknown PIPE_COMPUTE_CAP %d\n", param);
> diff --git a/src/gallium/include/pipe/p_defines.h
> b/src/gallium/include/pipe/p_defines.h
> index 1e4d802..93e30e8 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -847,7 +847,8 @@ enum pipe_compute_cap
> PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY,
> PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS,
> PIPE_COMPUTE_CAP_IMAGES_SUPPORTED,
> - PIPE_COMPUTE_CAP_SUBGROUP_SIZE
> + PIPE_COMPUTE_CAP_SUBGROUP_SIZE,
> + PIPE_COMPUTE_CAP_ADDRESS_BITS
> };
>
> /**
> diff --git a/src/gallium/state_trackers/clover/api/device.cpp
> b/src/gallium/state_trackers/clover/api/device.cpp
> index 11f21e9..f7bd61b 100644
> --- a/src/gallium/state_trackers/clover/api/device.cpp
> +++ b/src/gallium/state_trackers/clover/api/device.cpp
> @@ -158,7 +158,7 @@ clGetDeviceInfo(cl_device_id d_dev,
> cl_device_info param,
> break;
>
> case CL_DEVICE_ADDRESS_BITS:
> - buf.as_scalar<cl_uint>() = 32;
> + buf.as_scalar<cl_uint>() = dev.address_bits();
> break;
>
> case CL_DEVICE_MAX_READ_IMAGE_ARGS:
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp
> b/src/gallium/state_trackers/clover/core/device.cpp
> index 39f39f4..8825f99 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -193,6 +193,12 @@ device::subgroup_size() const {
> PIPE_COMPUTE_CAP_SUBGROUP_SIZE
> )[0];
> }
>
> +cl_uint
> +device::address_bits() const {
> + return get_compute_param<uint32_t>(pipe, ir_format(),
> + PIPE_COMPUTE_CAP_ADDRESS_BITS)
> [0];
> +}
> +
> std::string
> device::device_name() const {
> return pipe->get_name(pipe);
> diff --git a/src/gallium/state_trackers/clover/core/device.hpp
> b/src/gallium/state_trackers/clover/core/device.hpp
> index 2857847..6cf6c7f 100644
> --- a/src/gallium/state_trackers/clover/core/device.hpp
> +++ b/src/gallium/state_trackers/clover/core/device.hpp
> @@ -68,6 +68,7 @@ namespace clover {
>
> std::vector<size_t> max_block_size() const;
> cl_uint subgroup_size() const;
> + cl_uint address_bits() const;
> std::string device_name() const;
> std::string vendor_name() const;
> enum pipe_shader_ir ir_format() const;
--
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160829/395a3ad8/attachment.sig>
More information about the mesa-dev
mailing list