[Beignet] [PATCH] enable clGetContextInfo with CL_CONTEXT_DEVICES
Zou, Nanhai
nanhai.zou at intel.com
Mon May 6 01:05:14 PDT 2013
Hi Mario,
Please split the patch into 2 patches, 1 patch for 1 function.
Then send with your signed-off-by.
Thanks
Zou Nanhai
-----Original Message-----
From: Mario Kicherer [mailto:dev at kicherer.org]
Sent: Friday, May 03, 2013 8:38 PM
To: Zou, Nanhai
Cc: Mario Kicherer
Subject: [PATCH] enable clGetContextInfo with CL_CONTEXT_DEVICES
Hello Nanhai,
I just tried beignet and my benchmark was failing due to missing clGetContextInfo functionality. I wrote the following patch to:
- enable querying clGetContextInfo for CL_CONTEXT_DEVICES
- add additional info for the FATAL message in order to easily find missing pieces
Now the benchmark works on my IvyBridge GPU.
Thank you for this tool!
Best regards,
Mario
---
src/cl_api.c | 19 ++++++++++++++++++-
src/cl_utils.h | 2 +-
2 files changed, 19 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/cl_api.c
diff --git a/src/cl_api.c b/src/cl_api.c old mode 100644 new mode 100755 index 03cc0e6..570ba7d
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -159,7 +159,24 @@ clGetContextInfo(cl_context context,
void * param_value,
size_t * param_value_size_ret)
{
- NOT_IMPLEMENTED;
+ switch (param_name) {
+ case CL_CONTEXT_DEVICES:
+ if (param_value) {
+ if (param_value_size < sizeof(cl_device_id))
+ return CL_INVALID_VALUE;
+ cl_device_id *device_list = (cl_device_id*)param_value;
+ device_list[0] = context->device;
+ if (param_value_size_ret)
+ *param_value_size_ret = sizeof(cl_device_id);
+ return CL_SUCCESS;
+ }
+ if (param_value_size_ret) {
+ *param_value_size_ret = sizeof(cl_device_id);
+ return CL_SUCCESS;
+ }
+ default:
+ NOT_IMPLEMENTED;
+ }
return 0;
}
diff --git a/src/cl_utils.h b/src/cl_utils.h index 4493858..85d6684 100644
--- a/src/cl_utils.h
+++ b/src/cl_utils.h
@@ -80,7 +80,7 @@ do { \
#define FATAL(...) \
do { \
- fprintf(stderr, "error: "); \
+ fprintf(stderr, "error %s:%d:", __FILE__, __LINE__ ); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \
assert(0); \
--
1.8.1.5
More information about the Beignet
mailing list