summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@intel.com>2015-03-18 15:06:57 +0800
committerZhigang Gong <zhigang.gong@intel.com>2015-03-18 16:22:13 +0800
commitde8168dbae83c609ff4c12c1ab990109896c4434 (patch)
tree46ad10661bd8aed28131d9707b9b2cfb7c100bf5
parent8c9da35f900900770dab06976d0b31b91d183682 (diff)
runtime: fix a conformance bug in cl_get_kernel_arg_info.
Accordying to OpenCL 1.2 Rev 17: "CL_KERNEL_ARG_TYPE_CONST is returned if the argument is a pointer and the referenced type is declared with the restrict or const qualifier. For example, a kernel argument declared as global int const *x returns CL_KERNEL_ARG_TYPE_CONST but a kernel argument declared as global int * const x does not." So only need to return CL_KERNEL_ARG_TYPE_CONST for pointer arguments. Signed-off-by: Zhigang Gong <zhigang.gong@intel.com> Tested-by: "Weng, Chuanbo" <chuanbo.weng@intel.com>
-rw-r--r--src/cl_kernel.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cl_kernel.c b/src/cl_kernel.c
index 331d250a..28d88b6d 100644
--- a/src/cl_kernel.c
+++ b/src/cl_kernel.c
@@ -221,6 +221,7 @@ cl_get_kernel_arg_info(cl_kernel k, cl_uint arg_index, cl_kernel_arg_info param_
assert(k != NULL);
void *ret_info = interp_kernel_get_arg_info(k->opaque, arg_index,
param_name - CL_KERNEL_ARG_ADDRESS_QUALIFIER);
+ uint32_t arg_type = interp_kernel_get_arg_type(k->opaque, arg_index);
int str_len = 0;
cl_kernel_arg_type_qualifier type_qual = CL_KERNEL_ARG_TYPE_NONE;
@@ -281,7 +282,10 @@ 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_type_qualifier);
if (!param_value) return CL_SUCCESS;
- if (strstr((char*)ret_info, "const"))
+ if (strstr((char*)ret_info, "const") &&
+ (arg_type == GBE_ARG_GLOBAL_PTR ||
+ arg_type == GBE_ARG_CONSTANT_PTR ||
+ arg_type == GBE_ARG_LOCAL_PTR))
type_qual = type_qual | CL_KERNEL_ARG_TYPE_CONST;
if (strstr((char*)ret_info, "volatile"))
type_qual = type_qual | CL_KERNEL_ARG_TYPE_VOLATILE;