[Beignet] [PATCH 1/3] Rename Intel specific extension functions for ICD

Zhigang Gong zhigang.gong at linux.intel.com
Mon Apr 22 03:00:44 PDT 2013


Hold, I found the root cause, as your patch is based on Homer's unmerged patch.

I will fix that problem, and you don't need to take any action. Thanks.

On Mon, Apr 22, 2013 at 05:57:22PM +0800, Zhigang Gong wrote:
> 
> When I tried to apply this patch to the master branch, I met the following error.
> Could you check and fix it? thx.
> 
> Applying: Rename Intel specific extension functions for ICD
> error: patch failed: include/CL/cl_intel.h:30
> error: include/CL/cl_intel.h: patch does not apply
> error: patch failed: src/cl_api.c:1213
> error: src/cl_api.c: patch does not apply
> Patch failed at 0001 Rename Intel specific extension functions for ICD
> The copy of the patch that failed is found in:
>    /home/gong/git/fdo/beignet/.git/rebase-apply/patch
> When you have resolved this problem run "git am --resolved".
> If you would prefer to skip this patch, instead run "git am --skip".
> To restore the original branch and stop patching run "git am --abort".
> 
> On Mon, Apr 22, 2013 at 11:26:25AM +0200, Simon Richter wrote:
> > 
> > The ICD extension specification requires that extension function names end
> > in the vendor name to allow clGetExtensionFunctionAddress to switch between
> > implementations.
> > 
> > Signed-off-by: Simon Richter <Simon.Richter at hogyros.de>
> > ---
> >  include/CL/cl_intel.h                 |   26 ++++++++++++------------
> >  src/cl_api.c                          |   36 ++++++++++++++++-----------------
> >  utests/runtime_flat_address_space.cpp |    8 ++++----
> >  utests/utest_helper.cpp               |   14 ++++++-------
> >  utests/utest_helper.hpp               |    4 ++--
> >  5 files changed, 44 insertions(+), 44 deletions(-)
> > 
> 
> > diff --git a/include/CL/cl_intel.h b/include/CL/cl_intel.h
> > index ff1860a..bee21e2 100644
> > --- a/include/CL/cl_intel.h
> > +++ b/include/CL/cl_intel.h
> > @@ -30,41 +30,41 @@ extern "C" {
> >  
> >  /* Track allocations and report current number of unfreed allocations */
> >  extern CL_API_ENTRY cl_int CL_API_CALL
> > -clIntelReportUnfreed(void);
> > +clReportUnfreedIntel(void);
> >  
> >  /* 1 to 1 mapping of drm_intel_bo_map */
> >  extern CL_API_ENTRY void* CL_API_CALL
> > -clIntelMapBuffer(cl_mem, cl_int*);
> > +clMapBufferIntel(cl_mem, cl_int*);
> >  
> >  /* 1 to 1 mapping of drm_intel_bo_unmap */
> >  extern CL_API_ENTRY cl_int CL_API_CALL
> > -clIntelUnmapBuffer(cl_mem);
> > +clUnmapBufferIntel(cl_mem);
> >  
> >  /* 1 to 1 mapping of drm_intel_gem_bo_map_gtt */
> >  extern CL_API_ENTRY void* CL_API_CALL
> > -clIntelMapBufferGTT(cl_mem, cl_int*);
> > +clMapBufferGTTIntel(cl_mem, cl_int*);
> >  
> >  /* 1 to 1 mapping of drm_intel_gem_bo_unmap_gtt */
> >  extern CL_API_ENTRY cl_int CL_API_CALL
> > -clIntelUnmapBufferGTT(cl_mem);
> > +clUnmapBufferGTTIntel(cl_mem);
> >  
> >  /* Pin /Unpin the buffer in GPU memory (must be root) */
> >  extern CL_API_ENTRY cl_int CL_API_CALL
> > -clIntelPinBuffer(cl_mem);
> > +clPinBufferIntel(cl_mem);
> >  extern CL_API_ENTRY cl_int CL_API_CALL
> > -clIntelUnpinBuffer(cl_mem);
> > +clUnpinBufferIntel(cl_mem);
> >  
> >  /* Get the generation of the Gen device (used to load the proper binary) */
> >  extern CL_API_ENTRY cl_int CL_API_CALL
> > -clIntelGetGenVersion(cl_device_id device, cl_int *ver);
> > +clGetGenVersionIntel(cl_device_id device, cl_int *ver);
> >  
> >  /* Create a program from a LLVM source file */
> >  extern CL_API_ENTRY cl_program CL_API_CALL
> > -clCreateProgramWithLLVM(cl_context              /* context */,
> > -                        cl_uint                 /* num_devices */,
> > -                        const cl_device_id *    /* device_list */,
> > -                        const char *            /* file */,
> > -                        cl_int *                /* errcode_ret */);
> > +clCreateProgramWithLLVMIntel(cl_context              /* context */,
> > +                             cl_uint                 /* num_devices */,
> > +                             const cl_device_id *    /* device_list */,
> > +                             const char *            /* file */,
> > +                             cl_int *                /* errcode_ret */);
> >  
> >  #ifdef __cplusplus
> >  }
> > diff --git a/src/cl_api.c b/src/cl_api.c
> > index 6d7dd9a..00036da 100644
> > --- a/src/cl_api.c
> > +++ b/src/cl_api.c
> > @@ -793,7 +793,7 @@ clEnqueueReadBuffer(cl_command_queue command_queue,
> >  	cl_int err = CL_SUCCESS;
> >  	assert(ptr != NULL);
> >  	void* temp_ptr = NULL;
> > -	temp_ptr = clIntelMapBuffer(buffer, &err);
> > +	temp_ptr = clMapBufferIntel(buffer, &err);
> >  	assert(err == CL_SUCCESS);
> >  	memcpy(ptr, temp_ptr, cb);
> >  	return err;
> > @@ -833,11 +833,11 @@ clEnqueueWriteBuffer(cl_command_queue    command_queue,
> >    if (blocking_write != CL_TRUE)
> >      NOT_IMPLEMENTED;
> >    cl_int err;
> > -  void *p = clIntelMapBuffer(buffer, &err);
> > +  void *p = clMapBufferIntel(buffer, &err);
> >    if (err != CL_SUCCESS)
> >      return err;
> >    memcpy(p + offset, ptr, cb);
> > -  err = clIntelUnmapBuffer(buffer);
> > +  err = clUnmapBufferIntel(buffer);
> >    return err;
> >  }
> >  
> > @@ -991,7 +991,7 @@ clEnqueueMapBuffer(cl_command_queue  command_queue,
> >       NOT_IMPLEMENTED;
> >    if (offset != 0)
> >       NOT_IMPLEMENTED;
> > -  p = clIntelMapBuffer(buffer, errcode_ret);
> > +  p = clMapBufferIntel(buffer, errcode_ret);
> >    return p;
> >  }
> >  
> > @@ -1021,7 +1021,7 @@ clEnqueueUnmapMemObject(cl_command_queue  command_queue,
> >                          const cl_event *  event_wait_list,
> >                          cl_event *        event)
> >  {
> > -  return clIntelUnmapBuffer(memobj);
> > +  return clUnmapBufferIntel(memobj);
> >  }
> >  
> >  cl_int
> > @@ -1184,13 +1184,13 @@ clGetExtensionFunctionAddress(const char *func_name)
> >  }
> >  
> >  cl_int
> > -clIntelReportUnfreed(void)
> > +clReportUnfreedIntel(void)
> >  {
> >    return cl_report_unfreed();
> >  }
> >  
> >  void*
> > -clIntelMapBuffer(cl_mem mem, cl_int *errcode_ret)
> > +clMapBufferIntel(cl_mem mem, cl_int *errcode_ret)
> >  {
> >    void *ptr = NULL;
> >    cl_int err = CL_SUCCESS;
> > @@ -1203,7 +1203,7 @@ error:
> >  }
> >  
> >  cl_int
> > -clIntelUnmapBuffer(cl_mem mem)
> > +clUnmapBufferIntel(cl_mem mem)
> >  {
> >    cl_int err = CL_SUCCESS;
> >    CHECK_MEM (mem);
> > @@ -1213,7 +1213,7 @@ error:
> >  }
> >  
> >  void*
> > -clIntelMapBufferGTT(cl_mem mem, cl_int *errcode_ret)
> > +clMapBufferGTTIntel(cl_mem mem, cl_int *errcode_ret)
> >  {
> >    void *ptr = NULL;
> >    cl_int err = CL_SUCCESS;
> > @@ -1226,7 +1226,7 @@ error:
> >  }
> >  
> >  cl_int
> > -clIntelUnmapBufferGTT(cl_mem mem)
> > +clUnmapBufferGTTIntel(cl_mem mem)
> >  {
> >    cl_int err = CL_SUCCESS;
> >    CHECK_MEM (mem);
> > @@ -1236,7 +1236,7 @@ error:
> >  }
> >  
> >  cl_int
> > -clIntelPinBuffer(cl_mem mem)
> > +clPinBufferIntel(cl_mem mem)
> >  {
> >    cl_int err = CL_SUCCESS;
> >    CHECK_MEM (mem);
> > @@ -1246,7 +1246,7 @@ error:
> >  }
> >  
> >  cl_int
> > -clIntelUnpinBuffer(cl_mem mem)
> > +clUnpinBufferIntel(cl_mem mem)
> >  {
> >    cl_int err = CL_SUCCESS;
> >    CHECK_MEM (mem);
> > @@ -1256,17 +1256,17 @@ error:
> >  }
> >  
> >  cl_int
> > -clIntelGetGenVersion(cl_device_id device, cl_int *ver)
> > +clGetGenVersionIntel(cl_device_id device, cl_int *ver)
> >  {
> >    return cl_device_get_version(device, ver);
> >  }
> >  
> >  cl_program
> > -clCreateProgramWithLLVM(cl_context              context,
> > -                        cl_uint                 num_devices,
> > -                        const cl_device_id *    devices,
> > -                        const char *            filename,
> > -                        cl_int *                errcode_ret)
> > +clCreateProgramWithLLVMIntel(cl_context              context,
> > +                             cl_uint                 num_devices,
> > +                             const cl_device_id *    devices,
> > +                             const char *            filename,
> > +                             cl_int *                errcode_ret)
> >  {
> >    return cl_program_create_from_llvm(context,
> >                                       num_devices,
> > diff --git a/utests/runtime_flat_address_space.cpp b/utests/runtime_flat_address_space.cpp
> > index 0357cbd..08167c4 100644
> > --- a/utests/runtime_flat_address_space.cpp
> > +++ b/utests/runtime_flat_address_space.cpp
> > @@ -53,7 +53,7 @@ main(int argc, char *argv[])
> >                                    NULL);
> >  
> >      // Be sure that everything run fine
> > -    dst_buffer = (int *) clIntelMapBuffer(dst[j], &status);
> > +    dst_buffer = (int *) clMapBufferIntel(dst[j], &status);
> >      if (status != CL_SUCCESS)
> >        goto error;
> >      for (uint32_t i = 0; i < n; ++i)
> > @@ -61,13 +61,13 @@ main(int argc, char *argv[])
> >          fprintf(stderr, "run-time flat address space failed\n");
> >          exit(-1);
> >        }
> > -    OCL_CALL (clIntelUnmapBuffer, dst[j]);
> > +    OCL_CALL (clUnmapBufferIntel, dst[j]);
> >    }
> >  
> >    for (uint32_t j = 0; j < 24; ++j) OCL_CALL (clReleaseMemObject, dst[j]);
> >    cl_test_destroy();
> > -  printf("%i memory leaks\n", clIntelReportUnfreed());
> > -  assert(clIntelReportUnfreed() == 0);
> > +  printf("%i memory leaks\n", clReportUnfreedIntel());
> > +  assert(clReportUnfreedIntel() == 0);
> >  
> >  error:
> >    return status;
> > diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp
> > index b536598..3e73db3 100644
> > --- a/utests/utest_helper.cpp
> > +++ b/utests/utest_helper.cpp
> > @@ -216,7 +216,7 @@ do_kiss_path(const char *file, cl_device_id device)
> >    if (device == NULL)
> >      sub_path = "";
> >    else {
> > -    if (clIntelGetGenVersion(device, &ver) != CL_SUCCESS)
> > +    if (clGetGenVersionIntel(device, &ver) != CL_SUCCESS)
> >        clpanic("Unable to get Gen version", -1);
> >      sub_path = "";
> >    }
> > @@ -240,7 +240,7 @@ cl_kernel_init(const char *file_name, const char *kernel_name, int format)
> >    /* Load the program and build it */
> >    ker_path = do_kiss_path(file_name, device);
> >    if (format == LLVM)
> > -    program = clCreateProgramWithLLVM(ctx, 1, &device, ker_path, &status);
> > +    program = clCreateProgramWithLLVMIntel(ctx, 1, &device, ker_path, &status);
> >    else if (format == SOURCE) {
> >      cl_file_map_t *fm = cl_file_map_new();
> >      FATAL_IF (cl_file_map_open(fm, ker_path) != CL_FILE_MAP_SUCCESS,
> > @@ -428,8 +428,8 @@ cl_test_destroy(void)
> >  {
> >    cl_kernel_destroy();
> >    cl_ocl_destroy();
> > -  printf("%i memory leaks\n", clIntelReportUnfreed());
> > -  assert(clIntelReportUnfreed() == 0);
> > +  printf("%i memory leaks\n", clReportUnfreedIntel());
> > +  assert(clReportUnfreedIntel() == 0);
> >  }
> >  
> >  void
> > @@ -438,7 +438,7 @@ cl_buffer_destroy(void)
> >    int i;
> >    for (i = 0; i < MAX_BUFFER_N; ++i) {
> >      if (buf_data[i] != NULL) {
> > -      clIntelUnmapBuffer(buf[i]);
> > +      clUnmapBufferIntel(buf[i]);
> >        buf_data[i] = NULL;
> >      }
> >      if (buf[i] != NULL) {
> > @@ -456,7 +456,7 @@ cl_report_perf_counters(cl_mem perf)
> >    uint32_t i;
> >    if (perf == NULL)
> >      return;
> > -  start = (uint32_t*) clIntelMapBuffer(perf, &status);
> > +  start = (uint32_t*) clMapBufferIntel(perf, &status);
> >    assert(status == CL_SUCCESS && start != NULL);
> >    end = start + 128;
> >  
> > @@ -481,7 +481,7 @@ cl_report_perf_counters(cl_mem perf)
> >    }
> >    printf("\n\n");
> >  
> > -  clIntelUnmapBuffer(perf);
> > +  clUnmapBufferIntel(perf);
> >  }
> >  
> >  struct bmphdr {
> > diff --git a/utests/utest_helper.hpp b/utests/utest_helper.hpp
> > index 02249e1..5258416 100644
> > --- a/utests/utest_helper.hpp
> > +++ b/utests/utest_helper.hpp
> > @@ -101,12 +101,12 @@ extern EGLSurface  eglSurface;
> >      OCL_CALL2(clCreateSampler, SAMPLER, ctx, 0, ADDRESS_MODE, FILTER_MODE)
> >  
> >  #define OCL_MAP_BUFFER(ID) \
> > -    OCL_CALL2(clIntelMapBuffer, buf_data[ID], buf[ID])
> > +    OCL_CALL2(clMapBufferIntel, buf_data[ID], buf[ID])
> >  
> >  #define OCL_UNMAP_BUFFER(ID) \
> >    do { \
> >      if (buf[ID] != NULL) { \
> > -      OCL_CALL (clIntelUnmapBuffer, buf[ID]); \
> > +      OCL_CALL (clUnmapBufferIntel, buf[ID]); \
> >        buf_data[ID] = NULL; \
> >      } \
> >    } while (0)
> 
> > _______________________________________________
> > Beignet mailing list
> > Beignet at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/beignet
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list