Re: [Beignet] [PATCH] buildsys: Use CMRT_LIBDIR instead of CMRT_LIBRARY_DIRS

2016-10-09 Thread Guo, Yejun
That's great, thanks.

-Original Message-
From: Armin K. [mailto:kre...@email.com] 
Sent: Monday, October 10, 2016 12:57 AM
To: Guo, Yejun; beignet@lists.freedesktop.org
Subject: Re: [Beignet] [PATCH] buildsys: Use CMRT_LIBDIR instead of 
CMRT_LIBRARY_DIRS

On 09.10.2016 04:34, Guo, Yejun wrote:
> thanks Armin, the patch looks good to me.
> 
> could you also send a patch to fix CMRT_INCLUDE_DIRS? thanks.
> 
> 
> thanks
> yejun
> 

Usage of CMRT_INCLUDE_DIRS is correct. Nothing to fix there.


___
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet


Re: [Beignet] [PATCH] buildsys: Use CMRT_LIBDIR instead of CMRT_LIBRARY_DIRS

2016-10-09 Thread Armin K.
On 09.10.2016 04:34, Guo, Yejun wrote:
> thanks Armin, the patch looks good to me.
> 
> could you also send a patch to fix CMRT_INCLUDE_DIRS? thanks.
> 
> 
> thanks
> yejun
> 

Usage of CMRT_INCLUDE_DIRS is correct. Nothing to fix there.




signature.asc
Description: OpenPGP digital signature
___
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet


[Beignet] [PATCH v2] Fix build with latest libdrm

2016-10-09 Thread Armin K
libdrm-2.4.71 contains drm_intel_get_pooled_eu and
drm_intel_get_min_eu_in_pool with different
signatures.

v2:

 - Fix conditional not to include 0.

Signed-off-by: Armin K 
---
 src/intel/intel_driver.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
index f503b55..cf35f40 100644
--- a/src/intel/intel_driver.c
+++ b/src/intel/intel_driver.c
@@ -958,13 +958,16 @@ intel_update_device_info(cl_device_id device)
 #ifdef HAS_POOLED_EU
   /* BXT pooled eu, 3*6 to 2*9, like sub slice count is 2 */
   unsigned int has_pooled_eu = 0;
-  if(!drm_intel_get_pooled_eu(driver->fd, _pooled_eu) && has_pooled_eu)
+  if (drm_intel_get_pooled_eu(driver->fd) > 0) {
 device->sub_slice_count = 2;
+has_pooled_eu = 1;
+  }
 
 #ifdef HAS_MIN_EU_IN_POOL
-  unsigned int min_eu;
+  int min_eu;
   /* for fused down 2x6 devices, beignet don't support. */
-  if (has_pooled_eu && !drm_intel_get_min_eu_in_pool(driver->fd, _eu)) {
+  if (has_pooled_eu) {
+min_eu = drm_intel_get_min_eu_in_pool(driver->fd);
 assert(min_eu == 9); //don't support fuse down device.
   }
 #endif //HAS_MIN_EU_IN_POOL
-- 
2.10.1

___
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet


[Beignet] [PATCH 2/2] Modify program Info using cl_get_info_helper.

2016-10-09 Thread junyan . he
From: Junyan He 

Signed-off-by: Junyan He 
---
 src/CMakeLists.txt   |   1 +
 src/cl_api.c | 122 --
 src/cl_api_program.c | 162 +++
 3 files changed, 163 insertions(+), 122 deletions(-)
 create mode 100644 src/cl_api_program.c

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 18fbcda..d73616e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -76,6 +76,7 @@ set(OPENCL_SRC
 cl_api_event.c
 cl_api_context.c
 cl_api_sampler.c
+cl_api_program.c
 cl_alloc.c
 cl_kernel.c
 cl_program.c
diff --git a/src/cl_api.c b/src/cl_api.c
index 3811842..1c9dbb9 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -837,128 +837,6 @@ clUnloadPlatformCompiler(cl_platform_id platform)
   return CL_SUCCESS;
 }
 
-cl_int
-clGetProgramInfo(cl_program   program,
- cl_program_info  param_name,
- size_t   param_value_size,
- void *   param_value,
- size_t * param_value_size_ret)
-{
-  cl_int err = CL_SUCCESS;
-  char * ret_str = "";
-
-  CHECK_PROGRAM (program);
-
-  if (param_name == CL_PROGRAM_REFERENCE_COUNT) {
-cl_uint ref = CL_OBJECT_GET_REF(program);
-FILL_GETINFO_RET (cl_uint, 1, (), CL_SUCCESS);
-  } else if (param_name == CL_PROGRAM_CONTEXT) {
-cl_context context = program->ctx;
-FILL_GETINFO_RET (cl_context, 1, , CL_SUCCESS);
-  } else if (param_name == CL_PROGRAM_NUM_DEVICES) {
-cl_uint num_dev = 1; // Just 1 dev now.
-FILL_GETINFO_RET (cl_uint, 1, _dev, CL_SUCCESS);
-  } else if (param_name == CL_PROGRAM_DEVICES) {
-cl_device_id dev_id = program->ctx->device;
-FILL_GETINFO_RET (cl_device_id, 1, _id, CL_SUCCESS);
-  } else if (param_name == CL_PROGRAM_NUM_KERNELS) {
-cl_uint kernels_num = program->ker_n;
-FILL_GETINFO_RET (cl_uint, 1, _num, CL_SUCCESS);
-  } else if (param_name == CL_PROGRAM_SOURCE) {
-
-if (!program->source)
-  FILL_GETINFO_RET (char, 1, _str, CL_SUCCESS);
-FILL_GETINFO_RET (char, (strlen(program->source) + 1),
-   program->source, CL_SUCCESS);
-  } else if(param_name == CL_PROGRAM_KERNEL_NAMES) {
-cl_program_get_kernel_names(program, param_value_size, (char 
*)param_value, param_value_size_ret);
-  } else if (param_name == CL_PROGRAM_BINARY_SIZES) {
-if (program->binary == NULL){
-  if( program->binary_type == CL_PROGRAM_BINARY_TYPE_EXECUTABLE) {
-program->binary_sz = 
compiler_program_serialize_to_binary(program->opaque, >binary, 0);
-  }else if( program->binary_type == 
CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT) {
-program->binary_sz = 
compiler_program_serialize_to_binary(program->opaque, >binary, 1);
-  }else if( program->binary_type == CL_PROGRAM_BINARY_TYPE_LIBRARY) {
-program->binary_sz = 
compiler_program_serialize_to_binary(program->opaque, >binary, 2);
-  }else{
-return CL_INVALID_BINARY;
-  }
-}
-
-if (program->binary == NULL || program->binary_sz == 0) {
-  return CL_OUT_OF_RESOURCES;
-}
-FILL_GETINFO_RET (size_t, 1, (>binary_sz), CL_SUCCESS);
-  } else if (param_name == CL_PROGRAM_BINARIES) {
-if (param_value_size_ret)
-  *param_value_size_ret = sizeof(void*);
-if (!param_value)
-  return CL_SUCCESS;
-
-/* param_value points to an array of n
-   pointers allocated by the caller */
-if (program->binary == NULL) {
-  if( program->binary_type == CL_PROGRAM_BINARY_TYPE_EXECUTABLE) {
-program->binary_sz = 
compiler_program_serialize_to_binary(program->opaque, >binary, 0);
-  }else if( program->binary_type == 
CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT) {
-program->binary_sz = 
compiler_program_serialize_to_binary(program->opaque, >binary, 1);
-  }else if( program->binary_type == CL_PROGRAM_BINARY_TYPE_LIBRARY) {
-program->binary_sz = 
compiler_program_serialize_to_binary(program->opaque, >binary, 2);
-  }else{
-return CL_INVALID_BINARY;
-  }
-}
-
-if (program->binary == NULL || program->binary_sz == 0) {
-  return CL_OUT_OF_RESOURCES;
-}
-
-memcpy(*((void **)param_value), program->binary, program->binary_sz);
-return CL_SUCCESS;
-  } else {
-return CL_INVALID_VALUE;
-  }
-
-error:
-return err;
-}
-
-cl_int
-clGetProgramBuildInfo(cl_program program,
-  cl_device_id   device,
-  cl_program_build_info  param_name,
-  size_t param_value_size,
-  void * param_value,
-  size_t *   param_value_size_ret)
-{
-  cl_int err = CL_SUCCESS;
-  char * ret_str = "";
-
-  CHECK_PROGRAM (program);
-  INVALID_DEVICE_IF (device != program->ctx->device);
-
-  if (param_name == CL_PROGRAM_BUILD_STATUS) {
-FILL_GETINFO_RET (cl_build_status, 1, 

[Beignet] [PATCH 1/2] Modify clGetSamplerInfo using cl_get_info_helper.

2016-10-09 Thread junyan . he
From: Junyan He 

Signed-off-by: Junyan He 
---
 src/CMakeLists.txt   |  3 ++-
 src/cl_api.c | 29 --
 src/cl_api_sampler.c | 57 
 3 files changed, 59 insertions(+), 30 deletions(-)
 create mode 100644 src/cl_api_sampler.c

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 42a4d1b..18fbcda 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -74,7 +74,8 @@ set(OPENCL_SRC
 cl_api_kernel.c
 cl_api_command_queue.c
 cl_api_event.c
-   cl_api_context.c
+cl_api_context.c
+cl_api_sampler.c
 cl_alloc.c
 cl_kernel.c
 cl_program.c
diff --git a/src/cl_api.c b/src/cl_api.c
index d9f8ad8..3811842 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -612,35 +612,6 @@ error:
   return err;
 }
 
-cl_int
-clGetSamplerInfo(cl_sampler   sampler,
- cl_sampler_info  param_name,
- size_t   param_value_size,
- void *   param_value,
- size_t * param_value_size_ret)
-{
-  cl_int err = CL_SUCCESS;
-  CHECK_SAMPLER (sampler);
-
-  if (param_name == CL_SAMPLER_REFERENCE_COUNT) {
-cl_uint ref = CL_OBJECT_GET_REF(sampler);
-FILL_GETINFO_RET (cl_uint, 1, , CL_SUCCESS);
-  } else if (param_name == CL_SAMPLER_CONTEXT) {
-FILL_GETINFO_RET (cl_context, 1, >ctx, CL_SUCCESS);
-  } else if (param_name == CL_SAMPLER_NORMALIZED_COORDS) {
-FILL_GETINFO_RET (cl_bool, 1, >normalized_coords, CL_SUCCESS);
-  } else if (param_name == CL_SAMPLER_ADDRESSING_MODE) {
-FILL_GETINFO_RET (cl_addressing_mode, 1, >address, CL_SUCCESS);
-  } else if (param_name == CL_SAMPLER_FILTER_MODE ) {
-FILL_GETINFO_RET (cl_filter_mode, 1, >filter, CL_SUCCESS);
-  } else{
-return CL_INVALID_VALUE;
-  }
-
-error:
-  return err;
-}
-
 cl_program
 clCreateProgramWithSource(cl_context context,
   cl_uintcount,
diff --git a/src/cl_api_sampler.c b/src/cl_api_sampler.c
new file mode 100644
index 000..3172e1e
--- /dev/null
+++ b/src/cl_api_sampler.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright ?? 2012 Intel Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see .
+ *
+ */
+
+#include "cl_sampler.h"
+
+cl_int
+clGetSamplerInfo(cl_sampler sampler,
+ cl_sampler_info param_name,
+ size_t param_value_size,
+ void *param_value,
+ size_t *param_value_size_ret)
+{
+  const void *src_ptr = NULL;
+  size_t src_size = 0;
+
+  if (!CL_OBJECT_IS_SAMPLER(sampler)) {
+return CL_INVALID_SAMPLER;
+  }
+
+  if (param_name == CL_SAMPLER_REFERENCE_COUNT) {
+cl_int ref = CL_OBJECT_GET_REF(sampler);
+src_ptr = 
+src_size = sizeof(cl_int);
+  } else if (param_name == CL_SAMPLER_CONTEXT) {
+src_ptr = >ctx;
+src_size = sizeof(cl_context);
+  } else if (param_name == CL_SAMPLER_NORMALIZED_COORDS) {
+src_ptr = >normalized_coords;
+src_size = sizeof(cl_bool);
+  } else if (param_name == CL_SAMPLER_ADDRESSING_MODE) {
+src_ptr = >address;
+src_size = sizeof(cl_addressing_mode);
+  } else if (param_name == CL_SAMPLER_FILTER_MODE) {
+src_ptr = >filter;
+src_size = sizeof(cl_filter_mode);
+  } else {
+return CL_INVALID_VALUE;
+  }
+
+  return cl_get_info_helper(src_ptr, src_size,
+param_value, param_value_size, 
param_value_size_ret);
+}
-- 
2.7.4



___
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet