[Mesa-dev] [PATCH 2/2] clover: Query and export int64 atomics

Aaron Watry awatry at gmail.com
Thu Sep 21 00:10:43 UTC 2017


On Wed, Sep 20, 2017 at 3:23 PM, Jan Vesely <jan.vesely at rutgers.edu> wrote:
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
> CC: Francisco Jerez <currojerez at riseup.net>
> This exposes both extensions on GCN+ GPUs.
>
>  src/gallium/state_trackers/clover/api/device.cpp  | 6 ++++--
>  src/gallium/state_trackers/clover/core/device.cpp | 6 ++++++
>  src/gallium/state_trackers/clover/core/device.hpp | 1 +
>  3 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
> index 26e88aadc7..3572bb0c92 100644
> --- a/src/gallium/state_trackers/clover/api/device.cpp
> +++ b/src/gallium/state_trackers/clover/api/device.cpp
> @@ -331,11 +331,13 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
>
>     case CL_DEVICE_EXTENSIONS:
>        buf.as_string() =
> -         "cl_khr_global_int32_base_atomics"
> +         "cl_khr_byte_addressable_store"
> +         " cl_khr_global_int32_base_atomics"
>           " cl_khr_global_int32_extended_atomics"
>           " cl_khr_local_int32_base_atomics"
>           " cl_khr_local_int32_extended_atomics"
> -         " cl_khr_byte_addressable_store"
> +         + std::string(dev.has_int64_atomics() ? " cl_khr_int64_base_atomics" : "")
> +         + std::string(dev.has_int64_atomics() ? " cl_khr_int64_extended_atomics" : "")

Not trying to rain on your parade, but I've been thinking that we
might need to be able to query the installed libclc version or
possibly consider querying the libclc library for information about
which extensions are implemented (possibly even for the specific
device/target and the llvm version it was built against).

I've been slowly working on a printf implementation, and I'll need to
expose that based on some dynamic state of the system as well.

For something that's adding new extension support in libclc, we might
at least want to bump the libclc version number and ask Tom what he
did in the past related to branching off a libclc release, and then
make sure we've got a way to link against libclc (if we're not
already) and get its version number.

--Aaron

>           + std::string(dev.has_doubles() ? " cl_khr_fp64" : "")
>           + std::string(dev.has_halves() ? " cl_khr_fp16" : "");
>        break;
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
> index c0ee0acaaf..9dd7eed3f1 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -197,6 +197,12 @@ device::has_halves() const {
>  }
>
>  bool
> +device::has_int64_atomics() const {
> +   return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE,
> +                                 PIPE_SHADER_CAP_INT64_ATOMICS);
> +}
> +
> +bool
>  device::has_unified_memory() const {
>     return pipe->get_param(pipe, PIPE_CAP_UMA);
>  }
> diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp
> index c61be790a9..85cd031676 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 {
>        bool image_support() const;
>        bool has_doubles() const;
>        bool has_halves() const;
> +      bool has_int64_atomics() const;
>        bool has_unified_memory() const;
>        cl_uint mem_base_addr_align() const;
>
> --
> 2.13.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list