[Beignet] [PATCH] GBE: support SLM bool load and store.

Song, Ruiling ruiling.song at intel.com
Tue Jun 10 19:28:56 PDT 2014


LGTM

-----Original Message-----
From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Zhigang Gong
Sent: Wednesday, June 11, 2014 9:40 AM
To: Gong, Zhigang
Cc: beignet at lists.freedesktop.org
Subject: Re: [Beignet] [PATCH] GBE: support SLM bool load and store.

Ping for review.

On Tue, Jun 10, 2014 at 11:01:59AM +0800, Zhigang Gong wrote:
> The OCL spec does allow the use of a i1/BOOL SLM variable, so we have 
> to support the load and store of it. To make things simple, I choose 
> to use S16 to represent
> i1 value.
> 
> Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
> ---
>  backend/src/backend/gen_insn_selection.cpp | 1 +
>  backend/src/ir/instruction.cpp             | 1 -
>  backend/src/llvm/llvm_passes.cpp           | 7 ++++++-
>  3 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/backend/src/backend/gen_insn_selection.cpp 
> b/backend/src/backend/gen_insn_selection.cpp
> index 46d5846..a035982 100644
> --- a/backend/src/backend/gen_insn_selection.cpp
> +++ b/backend/src/backend/gen_insn_selection.cpp
> @@ -2682,6 +2682,7 @@ namespace gbe
>        case TYPE_U32:
>        case TYPE_S32:
>          return GEN_BYTE_SCATTER_DWORD;
> +      case TYPE_BOOL:
>        case TYPE_U16:
>        case TYPE_S16:
>          return GEN_BYTE_SCATTER_WORD; diff --git 
> a/backend/src/ir/instruction.cpp b/backend/src/ir/instruction.cpp 
> index 2d2b34b..3dde2fd 100644
> --- a/backend/src/ir/instruction.cpp
> +++ b/backend/src/ir/instruction.cpp
> @@ -938,7 +938,6 @@ namespace ir {
>          if (UNLIKELY(checkRegisterData(family, regID, fn, whyNot) == false))
>            return false;
>        }
> -      CHECK_TYPE(insn.type, allButBool);
>        return true;
>      }
>  
> diff --git a/backend/src/llvm/llvm_passes.cpp 
> b/backend/src/llvm/llvm_passes.cpp
> index d30a570..16d461d 100644
> --- a/backend/src/llvm/llvm_passes.cpp
> +++ b/backend/src/llvm/llvm_passes.cpp
> @@ -171,7 +171,12 @@ namespace gbe
>      switch (Ty->getTypeID()) {
>        case Type::VoidTyID:    NOT_SUPPORTED;
>        case Type::PointerTyID: return unit.getPointerSize();
> -      case Type::IntegerTyID: return cast<IntegerType>(Ty)->getBitWidth();
> +      case Type::IntegerTyID:
> +      {
> +        // use S16 to represent SLM bool variables.
> +        int bitWidth = cast<IntegerType>(Ty)->getBitWidth();
> +        return (bitWidth == 1) ? 16 : bitWidth;
> +      }
>        case Type::HalfTyID:    return 16;
>        case Type::FloatTyID:   return 32;
>        case Type::DoubleTyID:  return 64;
> --
> 1.8.3.2
> 
> _______________________________________________
> 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