[PATCH] D32896: [OpenCL] Make CLK_NULL_RESERVE_ID invalid reserve id.

Egor Churaev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 5 03:40:43 PDT 2017


echuraev created this revision.
Herald added a subscriber: yaxunl.

Make CLK_NULL_RESERVE_ID invalid reserve id.

Rename PIPE_RESERVE_ID_VALID_BIT to avoid user name space pollution.

Current implementation reserve_id_t type assumes that it's a pointer
type whose most significant bit is set to one and the rest of the bits
keep the id value.

This patch increase reserve id size by one bit on 32-bit platforms and
by 33 bits on 64-bit platforms.


https://reviews.llvm.org/D32896

Files:
  lib/Headers/opencl-c.h


Index: lib/Headers/opencl-c.h
===================================================================
--- lib/Headers/opencl-c.h
+++ lib/Headers/opencl-c.h
@@ -16014,8 +16014,10 @@
 
 // OpenCL v2.0 s6.13.16 - Pipe Functions
 #if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
-#define PIPE_RESERVE_ID_VALID_BIT (1U << 30)
-#define CLK_NULL_RESERVE_ID (__builtin_astype(((void*)(__SIZE_MAX__)), reserve_id_t))
+// The most significant bit of valid reserve_id must be set to one.
+#define __PIPE_RESERVE_ID_VALID_BIT ((size_t)1 << (sizeof(size_t) * 8 - 1))
+// The macro CLK_NULL_RESERVE_ID refers to an invalid reservation ID.
+#define CLK_NULL_RESERVE_ID (__builtin_astype((void *)0, reserve_id_t))
 bool __ovld is_valid_reserve_id(reserve_id_t reserve_id);
 #endif //__OPENCL_C_VERSION__ >= CL_VERSION_2_0
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32896.97923.patch
Type: text/x-patch
Size: 798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170505/5bb5913f/attachment.bin>


More information about the cfe-commits mailing list