[Beignet] [PATCH] Runtime: Use cl_ulong as CL_DEVICE_MAX_MEM_ALLOC_SIZE's return type.
Yang Rong
rong.r.yang at intel.com
Thu Dec 8 07:47:28 UTC 2016
From: Meng Mengmeng <mengmeng.meng at intel.com>
Also memset the param_value to avoid garbage when param_value_size >
filed sz.
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
src/cl_device_id.c | 1 +
src/cl_device_id.h | 2 +-
src/cl_mem.c | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/cl_device_id.c b/src/cl_device_id.c
index 24334fd..71a7be1 100644
--- a/src/cl_device_id.c
+++ b/src/cl_device_id.c
@@ -926,6 +926,7 @@ cl_get_device_ids(cl_platform_id platform,
} \
if (param_value_size < sizeof device->FIELD) \
return CL_INVALID_VALUE; \
+ memset(param_value, 0, param_value_size); \
memcpy(param_value, &device->FIELD, sizeof device->FIELD); \
return CL_SUCCESS;
diff --git a/src/cl_device_id.h b/src/cl_device_id.h
index 69aeeac..58d1d76 100644
--- a/src/cl_device_id.h
+++ b/src/cl_device_id.h
@@ -54,7 +54,7 @@ struct _cl_device_id {
cl_uint native_vector_width_half;
cl_uint max_clock_frequency;
cl_uint address_bits;
- size_t max_mem_alloc_size;
+ cl_ulong max_mem_alloc_size;
cl_device_svm_capabilities svm_capabilities;
cl_uint preferred_platform_atomic_alignment;
cl_uint preferred_global_atomic_alignment;
diff --git a/src/cl_mem.c b/src/cl_mem.c
index afce315..4707f48 100644
--- a/src/cl_mem.c
+++ b/src/cl_mem.c
@@ -141,6 +141,7 @@ cl_get_mem_object_info(cl_mem mem,
break;
case CL_MEM_USES_SVM_POINTER:
*((cl_uint *)param_value) = mem->is_svm;
+ break;
}
return CL_SUCCESS;
--
2.1.4
More information about the Beignet
mailing list