[Mesa-dev] [PATCH libclc] Implement barrier() builtin

Aaron Watry awatry at gmail.com
Thu Jun 13 15:37:10 PDT 2013


FYI: I've applied your related piglit test and R600 back-end patches
and tested this on a CEDAR (HD5400).

Note: I had some trouble applying patches 4 and 5 of the R600 patches
but after chopping out the unit tests and creating those files by hand
(and using --ignore-whitespace), everything is there and functioning.

For the libclc change:
Reviewed-by: Aaron Watry <awatry at gmail.com>

On Wed, Jun 12, 2013 at 7:31 PM, Tom Stellard <tom at stellard.net> wrote:
> From: Tom Stellard <thomas.stellard at amd.com>
>
> ---
>  r600/lib/SOURCES                         |  2 ++
>  r600/lib/synchronization/barrier.cl      | 15 +++++++++++++++
>  r600/lib/synchronization/barrier_impl.ll | 12 ++++++++++++
>  3 files changed, 29 insertions(+)
>  create mode 100644 r600/lib/synchronization/barrier.cl
>  create mode 100644 r600/lib/synchronization/barrier_impl.ll
>
> diff --git a/r600/lib/SOURCES b/r600/lib/SOURCES
> index af8c8c8..16ef3ac 100644
> --- a/r600/lib/SOURCES
> +++ b/r600/lib/SOURCES
> @@ -2,3 +2,5 @@ workitem/get_group_id.ll
>  workitem/get_local_size.ll
>  workitem/get_local_id.ll
>  workitem/get_global_size.ll
> +synchronization/barrier.cl
> +synchronization/barrier_impl.ll
> diff --git a/r600/lib/synchronization/barrier.cl b/r600/lib/synchronization/barrier.cl
> new file mode 100644
> index 0000000..ac0b4b3
> --- /dev/null
> +++ b/r600/lib/synchronization/barrier.cl
> @@ -0,0 +1,15 @@
> +
> +#include <clc/clc.h>
> +
> +void barrier_local(void);
> +void barrier_global(void);
> +
> +void barrier(cl_mem_fence_flags flags) {
> +  if (flags & CLK_LOCAL_MEM_FENCE) {
> +    barrier_local();
> +  }
> +
> +  if (flags & CLK_GLOBAL_MEM_FENCE) {
> +    barrier_global();
> +  }
> +}
> diff --git a/r600/lib/synchronization/barrier_impl.ll b/r600/lib/synchronization/barrier_impl.ll
> new file mode 100644
> index 0000000..99ac018
> --- /dev/null
> +++ b/r600/lib/synchronization/barrier_impl.ll
> @@ -0,0 +1,12 @@
> +declare void @llvm.AMDGPU.barrier.local() nounwind
> +declare void @llvm.AMDGPU.barrier.global() nounwind
> +
> +define void @barrier_local() nounwind alwaysinline {
> +  call void @llvm.AMDGPU.barrier.local()
> +  ret void
> +}
> +
> +define void @barrier_global() nounwind alwaysinline {
> +  call void @llvm.AMDGPU.barrier.global()
> +  ret void
> +}
> --
> 1.7.11.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list