[Beignet] [PATCH 1/3] Two changes for android build.

Yang Rong rong.r.yang at intel.com
Sun Aug 31 20:15:32 PDT 2014


1. Do not use ulong, some system don't define this type.
2. Use sA, sB... instead of sa, sb... to access vector 16, because sa, sb will cause clang error.

Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
 backend/src/backend/program.cpp   | 2 +-
 backend/src/gen_builtin_vector.py | 4 ++--
 src/cl_kernel.c                   | 8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index d992f7b..20471f9 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -1000,7 +1000,7 @@ namespace gbe {
 
     switch (value) {
       case GBE_GET_ARG_INFO_ADDRSPACE:
-        return (void*)((ulong)info->addrSpace);
+        return (void*)((unsigned long)info->addrSpace);
       case GBE_GET_ARG_INFO_TYPE:
         return (void *)(info->typeName.c_str());
       case GBE_GET_ARG_INFO_ACCESS:
diff --git a/backend/src/gen_builtin_vector.py b/backend/src/gen_builtin_vector.py
index 5f1c4b7..dd530a0 100755
--- a/backend/src/gen_builtin_vector.py
+++ b/backend/src/gen_builtin_vector.py
@@ -347,9 +347,9 @@ class builtinProto():
                     formatStr += '({0} {1} *)param{2} + {3:2d}'.format(ptype[2], ptype[0], n, j)
                 else:
                     if (self.functionName == 'select' and n == 2):
-                        formatStr += '({0})(param{1}.s{2:x} & (({0})1 << (sizeof({0})*8 - 1)))'.format(ptype[0], n, j)
+                        formatStr += '({0})(param{1}.s{2:X} & (({0})1 << (sizeof({0})*8 - 1)))'.format(ptype[0], n, j)
                     else:
-                        formatStr += 'param{0}.s{1:x}'.format(n, j)
+                        formatStr += 'param{0}.s{1:X}'.format(n, j)
 
             formatStr += ')'
 
diff --git a/src/cl_kernel.c b/src/cl_kernel.c
index 94b834b..5ab9c55 100644
--- a/src/cl_kernel.c
+++ b/src/cl_kernel.c
@@ -225,13 +225,13 @@ cl_get_kernel_arg_info(cl_kernel k, cl_uint arg_index, cl_kernel_arg_info param_
     if (param_value_size_ret)
       *param_value_size_ret = sizeof(cl_kernel_arg_address_qualifier);
     if (!param_value) return CL_SUCCESS;
-    if ((ulong)ret_info == 0) {
+    if ((cl_ulong)ret_info == 0) {
       *(cl_kernel_arg_address_qualifier *)param_value = CL_KERNEL_ARG_ADDRESS_PRIVATE;
-    } else if ((ulong)ret_info == 1 || (ulong)ret_info == 4) {
+    } else if ((cl_ulong)ret_info == 1 || (cl_ulong)ret_info == 4) {
       *(cl_kernel_arg_address_qualifier *)param_value = CL_KERNEL_ARG_ADDRESS_GLOBAL;
-    } else if ((ulong)ret_info == 2) {
+    } else if ((cl_ulong)ret_info == 2) {
       *(cl_kernel_arg_address_qualifier *)param_value = CL_KERNEL_ARG_ADDRESS_CONSTANT;
-    } else if ((ulong)ret_info == 3) {
+    } else if ((cl_ulong)ret_info == 3) {
       *(cl_kernel_arg_address_qualifier *)param_value = CL_KERNEL_ARG_ADDRESS_LOCAL;
     } else {
       /* If no address qualifier is specified, the default address qualifier
-- 
1.8.3.2



More information about the Beignet mailing list