[libclc] r219008 - Implement async_work_group_copy builtin v3

Tom Stellard thomas.stellard at amd.com
Fri Oct 3 12:49:40 PDT 2014


Author: tstellar
Date: Fri Oct  3 14:49:39 2014
New Revision: 219008

URL: http://llvm.org/viewvc/llvm-project?rev=219008&view=rev
Log:
Implement async_work_group_copy builtin v3

This is a simple implementation which just copies data synchronously.

v2:
  - Use size_t.

v3:
  - Fix possible race condition by splitting the copy among multiple
    work items.

Added:
    libclc/trunk/generic/include/clc/async/async_work_group_copy.h
    libclc/trunk/generic/include/clc/async/async_work_group_copy.inc
    libclc/trunk/generic/lib/async/async_work_group_copy.cl
    libclc/trunk/generic/lib/async/async_work_group_copy.inc
Modified:
    libclc/trunk/generic/include/clc/clc.h
    libclc/trunk/generic/lib/SOURCES

Added: libclc/trunk/generic/include/clc/async/async_work_group_copy.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/async/async_work_group_copy.h?rev=219008&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/async/async_work_group_copy.h (added)
+++ libclc/trunk/generic/include/clc/async/async_work_group_copy.h Fri Oct  3 14:49:39 2014
@@ -0,0 +1,15 @@
+#define __CLC_DST_ADDR_SPACE local
+#define __CLC_SRC_ADDR_SPACE global
+#define __CLC_BODY <clc/async/async_work_group_copy.inc>
+#include <clc/async/gentype.inc>
+#undef __CLC_DST_ADDR_SPACE
+#undef __CLC_SRC_ADDR_SPACE
+#undef __CLC_BODY
+
+#define __CLC_DST_ADDR_SPACE global
+#define __CLC_SRC_ADDR_SPACE local
+#define __CLC_BODY <clc/async/async_work_group_copy.inc>
+#include <clc/async/gentype.inc>
+#undef __CLC_DST_ADDR_SPACE
+#undef __CLC_SRC_ADDR_SPACE
+#undef __CLC_BODY

Added: libclc/trunk/generic/include/clc/async/async_work_group_copy.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/async/async_work_group_copy.inc?rev=219008&view=auto
==============================================================================
--- libclc/trunk/generic/include/clc/async/async_work_group_copy.inc (added)
+++ libclc/trunk/generic/include/clc/async/async_work_group_copy.inc Fri Oct  3 14:49:39 2014
@@ -0,0 +1,5 @@
+_CLC_OVERLOAD _CLC_DECL event_t async_work_group_copy(
+  __CLC_DST_ADDR_SPACE __CLC_GENTYPE *dst,
+  const __CLC_SRC_ADDR_SPACE __CLC_GENTYPE *src,
+  size_t num_gentypes,
+  event_t event);

Modified: libclc/trunk/generic/include/clc/clc.h
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=219008&r1=219007&r2=219008&view=diff
==============================================================================
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Fri Oct  3 14:49:39 2014
@@ -137,6 +137,7 @@
 #include <clc/synchronization/barrier.h>
 
 /* 6.11.10 Async Copy and Prefetch Functions */
+#include <clc/async/async_work_group_copy.h>
 #include <clc/async/async_work_group_strided_copy.h>
 #include <clc/async/prefetch.h>
 #include <clc/async/wait_group_events.h>

Modified: libclc/trunk/generic/lib/SOURCES
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=219008&r1=219007&r2=219008&view=diff
==============================================================================
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Fri Oct  3 14:49:39 2014
@@ -1,3 +1,4 @@
+async/async_work_group_copy.cl
 async/async_work_group_strided_copy.cl
 async/prefetch.cl
 async/wait_group_events.cl

Added: libclc/trunk/generic/lib/async/async_work_group_copy.cl
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/async/async_work_group_copy.cl?rev=219008&view=auto
==============================================================================
--- libclc/trunk/generic/lib/async/async_work_group_copy.cl (added)
+++ libclc/trunk/generic/lib/async/async_work_group_copy.cl Fri Oct  3 14:49:39 2014
@@ -0,0 +1,9 @@
+#include <clc/clc.h>
+
+#ifdef cl_khr_fp64
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#endif
+
+#define __CLC_BODY <async_work_group_copy.inc>
+#include <clc/async/gentype.inc>
+#undef __CLC_BODY

Added: libclc/trunk/generic/lib/async/async_work_group_copy.inc
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/async/async_work_group_copy.inc?rev=219008&view=auto
==============================================================================
--- libclc/trunk/generic/lib/async/async_work_group_copy.inc (added)
+++ libclc/trunk/generic/lib/async/async_work_group_copy.inc Fri Oct  3 14:49:39 2014
@@ -0,0 +1,17 @@
+_CLC_OVERLOAD _CLC_DEF event_t async_work_group_copy(
+    local __CLC_GENTYPE *dst,
+    const global __CLC_GENTYPE *src,
+    size_t num_gentypes,
+    event_t event) {
+
+  return async_work_group_strided_copy(dst, src, num_gentypes, 1, event);
+}
+
+_CLC_OVERLOAD _CLC_DEF event_t async_work_group_copy(
+    global __CLC_GENTYPE *dst,
+    const local __CLC_GENTYPE *src,
+    size_t num_gentypes,
+    event_t event) {
+
+  return async_work_group_strided_copy(dst, src, num_gentypes, 1, event);
+}





More information about the cfe-commits mailing list