Re: [Beignet] [PATCH] save host_ptr when create sub buffer from CL_MEM_ALLOC_HOST_PTR

2016-11-30 Thread Pan, Xiuli
LGMT, the test code works fine.


-Original Message-
From: Beignet [mailto:beignet-boun...@lists.freedesktop.org] On Behalf Of Guo, 
Yejun
Sent: Thursday, December 1, 2016 1:42 PM
To: beignet@lists.freedesktop.org
Cc: Guo, Yejun 
Subject: [Beignet] [PATCH] save host_ptr when create sub buffer from 
CL_MEM_ALLOC_HOST_PTR

it fixes issue at https://bugs.freedesktop.org/show_bug.cgi?id=98490

Signed-off-by: Guo, Yejun 
---
 src/cl_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cl_mem.c b/src/cl_mem.c
index 798daaf..afce315 100644
--- a/src/cl_mem.c
+++ b/src/cl_mem.c
@@ -636,7 +636,7 @@ cl_mem_new_sub_buffer(cl_mem buffer,
   mem->bo = buffer->bo;
   mem->size = info->size;
   sub_buf->sub_offset = info->origin;
-  if (buffer->flags & CL_MEM_USE_HOST_PTR || buffer->flags & 
CL_MEM_COPY_HOST_PTR) {
+  if (buffer->flags & CL_MEM_USE_HOST_PTR || buffer->flags & 
CL_MEM_COPY_HOST_PTR || buffer->flags & CL_MEM_ALLOC_HOST_PTR) {
 mem->host_ptr = buffer->host_ptr;
   }
 
-- 
1.9.1

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


[Beignet] [PATCH] save host_ptr when create sub buffer from CL_MEM_ALLOC_HOST_PTR

2016-11-30 Thread Guo, Yejun
it fixes issue at https://bugs.freedesktop.org/show_bug.cgi?id=98490

Signed-off-by: Guo, Yejun 
---
 src/cl_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cl_mem.c b/src/cl_mem.c
index 798daaf..afce315 100644
--- a/src/cl_mem.c
+++ b/src/cl_mem.c
@@ -636,7 +636,7 @@ cl_mem_new_sub_buffer(cl_mem buffer,
   mem->bo = buffer->bo;
   mem->size = info->size;
   sub_buf->sub_offset = info->origin;
-  if (buffer->flags & CL_MEM_USE_HOST_PTR || buffer->flags & 
CL_MEM_COPY_HOST_PTR) {
+  if (buffer->flags & CL_MEM_USE_HOST_PTR || buffer->flags & 
CL_MEM_COPY_HOST_PTR || buffer->flags & CL_MEM_ALLOC_HOST_PTR) {
 mem->host_ptr = buffer->host_ptr;
   }
 
-- 
1.9.1

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


Re: [Beignet] [PATCH] revert clCreateCommandQueue* from ocl2.0 back to 1.2 in utests

2016-11-30 Thread Yang, Rong R
LGTM, pushed, thanks.

> -Original Message-
> From: Beignet [mailto:beignet-boun...@lists.freedesktop.org] On Behalf Of
> Guo, Yejun
> Sent: Monday, November 28, 2016 15:48
> To: beignet@lists.freedesktop.org
> Cc: Guo, Yejun 
> Subject: [Beignet] [PATCH] revert clCreateCommandQueue* from ocl2.0
> back to 1.2 in utests
> 
> since utests is designed to be a general stand-alone application, it is 
> better to
> use ocl1.2 version API, otherwise, link error on some platforms with only
> ocl1.2.
> 
> Signed-off-by: Guo, Yejun 
> ---
>  utests/profiling_exec.cpp | 3 +--
>  utests/utest_helper.cpp   | 4 ++--
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/utests/profiling_exec.cpp b/utests/profiling_exec.cpp index
> 1859134..437a628 100644
> --- a/utests/profiling_exec.cpp
> +++ b/utests/profiling_exec.cpp
> @@ -52,8 +52,7 @@ static void profiling_exec(void)
> 
> 
>  /* Because the profiling prop, we can not use default queue. */
> -const cl_queue_properties properties[] = {CL_QUEUE_PROPERTIES,
> CL_QUEUE_PROFILING_ENABLE, 0};
> -profiling_queue = clCreateCommandQueueWithProperties(ctx, device,
> properties, );
> +profiling_queue = clCreateCommandQueue(ctx, device,
> + CL_QUEUE_PROFILING_ENABLE, );
>  OCL_ASSERT(status == CL_SUCCESS);
> 
>  OCL_CREATE_KERNEL("compiler_fabs");
> diff --git a/utests/utest_helper.cpp b/utests/utest_helper.cpp index
> b713b79..f1a4bdd 100644
> --- a/utests/utest_helper.cpp
> +++ b/utests/utest_helper.cpp
> @@ -511,9 +511,9 @@ cl_ocl_init(void)
>  cl_test_channel_type_string(fmt[i].image_channel_data_type));
> 
>/* We are going to push NDRange kernels here */
> -  queue = clCreateCommandQueueWithProperties(ctx, device, 0, );
> +  queue = clCreateCommandQueue(ctx, device, 0, );
>if (status != CL_SUCCESS) {
> -fprintf(stderr, "error calling clCreateCommandQueueWithProperties\n");
> +fprintf(stderr, "error calling clCreateCommandQueue\n");
>  goto error;
>}
> 
> --
> 1.9.1
> 
> ___
> Beignet mailing list
> Beignet@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet
___
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet


[Beignet] [PATCH V2] disable CMRT as default, since no real case reported

2016-11-30 Thread Guo, Yejun
and this feature also sometimes introduces build issue.

v2: add option INVOKE_CMRT to enable CMRT if necessary
Signed-off-by: Guo, Yejun 
---
 CMakeLists.txt | 4 
 1 file changed, 4 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 713cfa9..503c609 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -176,10 +176,14 @@ ELSE(DRM_INTEL_FOUND)
 ENDIF(DRM_INTEL_FOUND)
 
 # CMRT
+#disable CMRT as default, since we do not see real case,
+#but see build issue of this feature
+IF(INVOKE_CMRT)
 pkg_check_modules(CMRT libcmrt)
 IF(CMRT_FOUND)
 INCLUDE_DIRECTORIES(${CMRT_INCLUDE_DIRS})
 ENDIF(CMRT_FOUND)
+ENDIF(INVOKE_CMRT)
 
 # Threads
 Find_Package(Threads)
-- 
1.9.1

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


Re: [Beignet] [PATCH] disable CMRT as default, since no real case reported

2016-11-30 Thread Guo, Yejun
sure, let me send a v2 patch to add a new cmake option

-Original Message-
From: Yang, Rong R 
Sent: Wednesday, November 30, 2016 4:33 PM
To: Guo, Yejun; beignet@lists.freedesktop.org
Subject: RE: [Beignet] [PATCH] disable CMRT as default, since no real case 
reported

If disable it, can you add an explanation to readme or add a cmake option?

> -Original Message-
> From: Beignet [mailto:beignet-boun...@lists.freedesktop.org] On Behalf 
> Of Guo, Yejun
> Sent: Monday, November 21, 2016 10:55
> To: beignet@lists.freedesktop.org
> Subject: Re: [Beignet] [PATCH] disable CMRT as default, since no real 
> case reported
> 
> ping for review, thanks.
> 
> -Original Message-
> From: Guo, Yejun
> Sent: Tuesday, October 25, 2016 3:33 PM
> To: beignet@lists.freedesktop.org
> Cc: Guo, Yejun
> Subject: [PATCH] disable CMRT as default, since no real case reported
> 
> and this feature also sometimes introduces build issue.
> 
> Signed-off-by: Guo, Yejun 
> ---
>  CMakeLists.txt | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt index d839f3f..039f9cd 
> 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -170,7 +170,9 @@ ELSE(DRM_INTEL_FOUND)
>  ENDIF(DRM_INTEL_FOUND)
> 
>  # CMRT
> -pkg_check_modules(CMRT libcmrt)
> +#disable CMRT as default, since we do not see real case, #while see 
> +build issue of this feature #pkg_check_modules(CMRT libcmrt)
>  IF(CMRT_FOUND)
>  INCLUDE_DIRECTORIES(${CMRT_INCLUDE_DIRS})
>  ENDIF(CMRT_FOUND)
> --
> 1.9.1
> 
> ___
> Beignet mailing list
> Beignet@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet
___
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet


Re: [Beignet] [PATCH] disable CMRT as default, since no real case reported

2016-11-30 Thread Yang, Rong R
If disable it, can you add an explanation to readme or add a cmake option?

> -Original Message-
> From: Beignet [mailto:beignet-boun...@lists.freedesktop.org] On Behalf Of
> Guo, Yejun
> Sent: Monday, November 21, 2016 10:55
> To: beignet@lists.freedesktop.org
> Subject: Re: [Beignet] [PATCH] disable CMRT as default, since no real case
> reported
> 
> ping for review, thanks.
> 
> -Original Message-
> From: Guo, Yejun
> Sent: Tuesday, October 25, 2016 3:33 PM
> To: beignet@lists.freedesktop.org
> Cc: Guo, Yejun
> Subject: [PATCH] disable CMRT as default, since no real case reported
> 
> and this feature also sometimes introduces build issue.
> 
> Signed-off-by: Guo, Yejun 
> ---
>  CMakeLists.txt | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt index d839f3f..039f9cd 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -170,7 +170,9 @@ ELSE(DRM_INTEL_FOUND)
>  ENDIF(DRM_INTEL_FOUND)
> 
>  # CMRT
> -pkg_check_modules(CMRT libcmrt)
> +#disable CMRT as default, since we do not see real case, #while see
> +build issue of this feature #pkg_check_modules(CMRT libcmrt)
>  IF(CMRT_FOUND)
>  INCLUDE_DIRECTORIES(${CMRT_INCLUDE_DIRS})
>  ENDIF(CMRT_FOUND)
> --
> 1.9.1
> 
> ___
> Beignet mailing list
> Beignet@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet
___
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet


Re: [Beignet] [PATCH] Fix getting bitwidth of PointerType of LLVM.

2016-11-30 Thread Yang, Rong R
LGTM, pushed, thanks.

> -Original Message-
> From: Beignet [mailto:beignet-boun...@lists.freedesktop.org] On Behalf Of
> yan.w...@linux.intel.com
> Sent: Friday, November 18, 2016 15:44
> To: beignet@lists.freedesktop.org
> Cc: Yan Wang 
> Subject: [Beignet] [PATCH] Fix getting bitwidth of PointerType of LLVM.
> 
> From: Yan Wang 
> 
> PointerType could not be forced to IntegerTyoe for getting bitwidth.
> With Rong's comments, use getTypeBitSize() instead of
> Type::getIntegerBitWidth().
> ---
>  backend/src/llvm/llvm_gen_backend.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/backend/src/llvm/llvm_gen_backend.cpp
> b/backend/src/llvm/llvm_gen_backend.cpp
> index 397c721..d6b0665 100644
> --- a/backend/src/llvm/llvm_gen_backend.cpp
> +++ b/backend/src/llvm/llvm_gen_backend.cpp
> @@ -1366,7 +1366,7 @@ namespace gbe
>}
>Builder.SetInsertPoint(cast(theUser));
> 
> -  Type *ptyTy = IntegerType::get(ptr->getContext(), ptr->getType()-
> >getIntegerBitWidth());
> +  Type *ptyTy = IntegerType::get(ptr->getContext(),
> + getTypeBitSize(unit, ptr->getType()));
>Value *v1 = Builder.CreatePtrToInt(pointerOp, ptyTy);
> 
>Value *v2 = 
> Builder.CreatePtrToInt(getSinglePointerOrigin(pointerOp),
> ptyTy);
> --
> 2.7.4
> 
> ___
> Beignet mailing list
> Beignet@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet
___
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet


Re: [Beignet] [PATCH v2] Fix bug: Initialize bti of LoadInstuctionPattern::shootByteGatherMsg().

2016-11-30 Thread Yang, Rong R
Pushed, thanks.

> -Original Message-
> From: Beignet [mailto:beignet-boun...@lists.freedesktop.org] On Behalf Of
> Song, Ruiling
> Sent: Thursday, November 24, 2016 14:56
> To: yan.w...@linux.intel.com; beignet@lists.freedesktop.org
> Subject: Re: [Beignet] [PATCH v2] Fix bug: Initialize bti of
> LoadInstuctionPattern::shootByteGatherMsg().
> 
> Looks good. Thanks for the fix.
> 
> - Ruiling
> 
> > -Original Message-
> > From: Beignet [mailto:beignet-boun...@lists.freedesktop.org] On Behalf
> > Of yan.w...@linux.intel.com
> > Sent: Thursday, November 24, 2016 2:55 PM
> > To: beignet@lists.freedesktop.org
> > Cc: Yan Wang 
> > Subject: [Beignet] [PATCH v2] Fix bug: Initialize bti of
> > LoadInstuctionPattern::shootByteGatherMsg().
> >
> > From: Yan Wang 
> >
> > If it isn't initialized, Luxmark hotel scene will display wrong.
> > ---
> >  backend/src/backend/gen_insn_selection.cpp | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/backend/src/backend/gen_insn_selection.cpp
> > b/backend/src/backend/gen_insn_selection.cpp
> > index c14e0bc..c9a5be7 100644
> > --- a/backend/src/backend/gen_insn_selection.cpp
> > +++ b/backend/src/backend/gen_insn_selection.cpp
> > @@ -4487,7 +4487,7 @@ extern bool OCL_DEBUGINFO; // first defined by
> > calling BVAR in program.cpp
> >using namespace ir;
> >unsigned addrBytes = typeSize(addr.type);
> >AddressMode AM = insn.getAddressMode();
> > -  vector btiTemp;
> > +  vector btiTemp = sel.getBTITemps(AM);
> >if (AM == AM_DynamicBti || AM == AM_StaticBti) {
> >  if (AM == AM_DynamicBti) {
> >Register btiReg = insn.getBtiReg();
> > --
> > 2.7.4
> >
> > ___
> > Beignet mailing list
> > Beignet@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/beignet
> ___
> Beignet mailing list
> Beignet@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet
___
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet


Re: [Beignet] [PATCH 1/3] do not touch src1 when setting instruction header

2016-11-30 Thread Yang, Rong R
IVB crash because of don't setSrc1, add it by manual and pushed, thanks.

> -Original Message-
> From: Beignet [mailto:beignet-boun...@lists.freedesktop.org] On Behalf Of
> Song, Ruiling
> Sent: Tuesday, November 29, 2016 13:21
> To: Guo, Yejun ; beignet@lists.freedesktop.org
> Cc: Guo, Yejun 
> Subject: Re: [Beignet] [PATCH 1/3] do not touch src1 when setting instruction
> header
> 
> The patchset LGTM.
> 
> ___
> Beignet mailing list
> Beignet@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet
___
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet


Re: [Beignet] [PATCH 2/2] do not care dst for printf

2016-11-30 Thread Yang, Rong R
Pushed, thanks.

> -Original Message-
> From: Beignet [mailto:beignet-boun...@lists.freedesktop.org] On Behalf Of
> Yan Wang
> Sent: Wednesday, November 30, 2016 14:22
> To: Guo, Yejun ; beignet@lists.freedesktop.org
> Subject: Re: [Beignet] [PATCH 2/2] do not care dst for printf
> 
> LGTM.
> Thanks.
> 
> Yan Wang
> 
> On Mon, 2016-11-21 at 18:16 +0800, Guo, Yejun wrote:
> > acutally, the dst of printf means nothing, don't need to touch it.
> >
> > Signed-off-by: Guo, Yejun 
> > ---
> >  backend/src/backend/gen_context.cpp| 14 ++
> >  backend/src/backend/gen_insn_selection.cpp | 20 +---
> >  2 files changed, 11 insertions(+), 23 deletions(-)
> >
> > diff --git a/backend/src/backend/gen_context.cpp
> > b/backend/src/backend/gen_context.cpp
> > index 186c8d9..a73ccb6 100644
> > --- a/backend/src/backend/gen_context.cpp
> > +++ b/backend/src/backend/gen_context.cpp
> > @@ -3469,9 +3469,8 @@ namespace gbe
> >}
> >
> >void GenContext::emitPrintfInstruction(const SelectionInstruction
> > ) {
> > -const GenRegister dst = ra->genReg(insn.dst(0));
> > -const GenRegister tmp0 = ra->genReg(insn.dst(1));
> > -const GenRegister tmp1 = ra->genReg(insn.dst(2));
> > +const GenRegister tmp0 = ra->genReg(insn.dst(0));
> > +const GenRegister tmp1 = ra->genReg(insn.dst(1));
> >  GenRegister src;
> >  uint32_t srcNum = insn.srcNum;
> >
> > @@ -3518,15 +3517,6 @@ namespace gbe
> >  emitPrintfLongInstruction(addr, data, src,
> > insn.extra.printfBTI);
> >}
> >  }
> > -
> > -if (dst.hstride == GEN_HORIZONTAL_STRIDE_0) {
> > -  p->push();
> > -  p->curr.execWidth = 1;
> > -}
> > -p->MOV(dst, GenRegister::immd(0));
> > -if (dst.hstride == GEN_HORIZONTAL_STRIDE_0) {
> > -  p->pop();
> > -}
> >}
> >
> >void GenContext::setA0Content(uint16_t new_a0[16], uint16_t
> > max_offset, int sz) { diff --git
> > a/backend/src/backend/gen_insn_selection.cpp
> > b/backend/src/backend/gen_insn_selection.cpp
> > index 1808c7b..88fe1a6 100644
> > --- a/backend/src/backend/gen_insn_selection.cpp
> > +++ b/backend/src/backend/gen_insn_selection.cpp
> > @@ -705,7 +705,7 @@ namespace gbe
> >  /*! Store the profiling info */
> >  void STORE_PROFILING(uint32_t profilingType, uint32_t bti,
> > GenRegister tmp0, GenRegister tmp1, GenRegister ts[5], int tsNum);
> >  /*! Printf */
> > -void PRINTF(GenRegister dst, uint8_t bti, GenRegister tmp0,
> > GenRegister tmp1, GenRegister src[8],
> > +void PRINTF(uint8_t bti, GenRegister tmp0, GenRegister tmp1,
> > GenRegister src[8],
> >  int srcNum, uint16_t num, bool isContinue, uint32_t
> > totalSize);
> >  /*! Multiply 64-bit integers */
> >  void I64MUL(Reg dst, Reg src0, Reg src1, GenRegister *tmp, bool
> > native_long); @@ -2129,20 +2129,19 @@ namespace gbe
> >  }
> >}
> >
> > -  void Selection::Opaque::PRINTF(GenRegister dst, uint8_t bti,
> > GenRegister tmp0, GenRegister tmp1,
> > +  void Selection::Opaque::PRINTF(uint8_t bti, GenRegister tmp0,
> > GenRegister tmp1,
> > GenRegister src[8], int srcNum, uint16_t num, bool
> > isContinue, uint32_t totalSize) {
> > -SelectionInstruction *insn = this->appendInsn(SEL_OP_PRINTF, 3,
> > srcNum);
> > +SelectionInstruction *insn = this->appendInsn(SEL_OP_PRINTF, 2,
> > srcNum);
> >  SelectionVector *vector = this->appendVector();
> >
> >  for (int i = 0; i < srcNum; i++)
> >insn->src(i) = src[i];
> >
> > -insn->dst(0) = dst;
> > -insn->dst(1) = tmp0;
> > -insn->dst(2) = tmp1;
> > +insn->dst(0) = tmp0;
> > +insn->dst(1) = tmp1;
> >
> >  vector->regNum = 2;
> > -vector->reg = >dst(1);
> > +vector->reg = >dst(0);
> >  vector->offsetID = 0;
> >  vector->isSrc = 0;
> >
> > @@ -7041,8 +7040,7 @@ extern bool OCL_DEBUGINFO; // first defined by
> > calling BVAR in program.cpp
> >uint8_t BTI = insn.getBti();
> >GenRegister tmp0, tmp1;
> >uint32_t srcNum = insn.getSrcNum();
> > -  GenRegister dst = sel.selReg(insn.getDst(0), TYPE_S32);
> > -  //GBE_ASSERT(srcNum);
> > +
> >uint32_t i = 0;
> >uint32_t totalSize = 0;
> >bool isContinue = false;
> > @@ -7063,14 +7061,14 @@ extern bool OCL_DEBUGINFO; // first defined
> by
> > calling BVAR in program.cpp
> >i = 0;
> >GenRegister regs[8];
> >if (srcNum == 0) {
> > -  sel.PRINTF(dst, BTI, tmp0, tmp1, regs, srcNum, num,
> > isContinue, totalSize);
> > +  sel.PRINTF(BTI, tmp0, tmp1, regs, srcNum, num, isContinue,
> > totalSize);
> >} else {
> >  do {
> >uint32_t s = srcNum < 8 ? srcNum : 8;
> >for (uint32_t j = 0; j < s; j++) {
> >  regs[j] = sel.selReg(insn.getSrc(i + j), insn.getType(i
> > + j));
> >}
> > -  sel.PRINTF(dst, BTI, tmp0, tmp1, regs, s, num,