[Beignet] [PATCH] Silence compilation warnings when release build.

Zhigang Gong zhigang.gong at linux.intel.com
Wed May 28 00:12:54 PDT 2014


LGTM, will push latter. thanks.
On Wed, May 28, 2014 at 03:37:49PM +0800, Yang Rong wrote:
> Also silence warnings in 32bit system.
> 
> Signed-off-by: Yang Rong <rong.r.yang at intel.com>
> ---
>  backend/src/backend/gen_encoder.cpp        |  3 +--
>  backend/src/backend/gen_insn_selection.cpp |  3 +--
>  backend/src/backend/program.cpp            |  2 +-
>  src/performance.c                          | 10 +++++-----
>  4 files changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/backend/src/backend/gen_encoder.cpp b/backend/src/backend/gen_encoder.cpp
> index a764e9d..8330deb 100644
> --- a/backend/src/backend/gen_encoder.cpp
> +++ b/backend/src/backend/gen_encoder.cpp
> @@ -1015,6 +1015,7 @@ namespace gbe
>  
>    void GenEncoder::patchJMPI(uint32_t insnID, int32_t jumpDistance) {
>      GenNativeInstruction &insn = *(GenNativeInstruction *)&this->store[insnID];
> +    GenNativeInstruction &insn2 = *(GenNativeInstruction *)&this->store[insnID+2];
>      GBE_ASSERT(insnID < this->store.size());
>      GBE_ASSERT(insn.header.opcode == GEN_OPCODE_JMPI ||
>                 insn.header.opcode == GEN_OPCODE_BRD  ||
> @@ -1043,7 +1044,6 @@ namespace gbe
>        // for all the branching instruction. And need to adjust the distance
>        // for those branch instruction's start point and end point contains
>        // this instruction.
> -      GenNativeInstruction &insn2 = *(GenNativeInstruction *)&this->store[insnID+2];
>        GBE_ASSERT(insn2.header.opcode == GEN_OPCODE_NOP);
>        insn.header.opcode = GEN_OPCODE_ADD;
>        this->setDst(&insn, GenRegister::ip());
> @@ -1052,7 +1052,6 @@ namespace gbe
>      } else {
>        insn.header.predicate_inverse ^= 1;
>        this->setSrc1(&insn, GenRegister::immd(2));
> -      GenNativeInstruction &insn2 = *(GenNativeInstruction *)&this->store[insnID+2];
>        GBE_ASSERT(insn2.header.opcode == GEN_OPCODE_NOP);
>        GBE_ASSERT(insnID < this->store.size());
>        insn2.header.predicate_control = GEN_PREDICATE_NONE;
> diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
> index a6b1cec..fcbbccb 100644
> --- a/backend/src/backend/gen_insn_selection.cpp
> +++ b/backend/src/backend/gen_insn_selection.cpp
> @@ -2688,9 +2688,8 @@ namespace gbe
>                           uint32_t bti) const
>      {
>        using namespace ir;
> -      const uint32_t valueNum = insn.getValueNum();
>        const uint32_t simdWidth = sel.isScalarReg(insn.getValue(0)) ? 1 : sel.ctx.getSimdWidth();
> -      GBE_ASSERT(valueNum == 1);
> +      GBE_ASSERT(insn.getValueNum() == 1);
>        GenRegister dst = GenRegister::retype(sel.selReg(insn.getValue(0)), GEN_TYPE_F);
>        // get dword based address
>        GenRegister addrDW = GenRegister::udxgrf(simdWidth, sel.reg(FAMILY_DWORD, simdWidth == 1));
> diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
> index 121e237..ea36f28 100644
> --- a/backend/src/backend/program.cpp
> +++ b/backend/src/backend/program.cpp
> @@ -643,7 +643,7 @@ namespace gbe {
>  
>      while (getline(idirs, pcmFileName, ':')) {
>        if(access(pcmFileName.c_str(), R_OK) == 0) {
> -        findPcm = true;
> +        findPcm |= true;
>          break;
>        }
>      }
> diff --git a/src/performance.c b/src/performance.c
> index 5248bb7..a785460 100644
> --- a/src/performance.c
> +++ b/src/performance.c
> @@ -20,7 +20,7 @@ typedef struct kernel_storage_node
>  
>  typedef struct context_storage_node
>  {
> -  uint64_t context_id;
> +  uintptr_t context_id;
>    kernel_storage_node *kernels_storage;
>    char max_time_kernel_name[MAX_KERNEL_NAME_LENGTH];
>    float kernel_max_time;
> @@ -46,14 +46,14 @@ static context_storage_node * find_context(cl_context context)
>  {
>    if(NULL != prev_context_pointer )
>    {
> -    if(prev_context_pointer->context_id == (uint64_t)context)
> +    if(prev_context_pointer->context_id == (uintptr_t)context)
>        return prev_context_pointer;
>    }
>  
>    if(NULL == record.context_storage)
>    {
>      record.context_storage = (context_storage_node *) malloc(sizeof(context_storage_node));
> -    record.context_storage->context_id = (uint64_t)context;
> +    record.context_storage->context_id = (uintptr_t)context;
>      record.context_storage->kernels_storage = NULL;
>      record.context_storage->kernel_max_time = 0.0f;
>      record.context_storage->next = NULL;
> @@ -63,7 +63,7 @@ static context_storage_node * find_context(cl_context context)
>  
>    context_storage_node *pre = record.context_storage;
>    context_storage_node *cur = record.context_storage;
> -  while(NULL !=cur && (uint64_t)context != cur->context_id )
> +  while(NULL !=cur && (uintptr_t)context != cur->context_id )
>    {
>      pre = cur;
>      cur = cur->next;
> @@ -73,7 +73,7 @@ static context_storage_node * find_context(cl_context context)
>  
>    pre->next = (context_storage_node *)malloc(sizeof(context_storage_node));
>    pre = pre->next;
> -  pre->context_id = (uint64_t)context;
> +  pre->context_id = (uintptr_t)context;
>    pre->kernels_storage = NULL;
>    pre->kernel_max_time = 0.0f;
>    pre->next = NULL;
> -- 
> 1.9.1
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list