[Beignet] [PATCH 2/2] Fix some get image info errors.

Zhigang Gong zhigang.gong at linux.intel.com
Tue Nov 26 23:20:34 PST 2013


good catch. Need to clear the image info if the first round
compilation fails.

Will push latter, thanks.
 
On Wed, Nov 27, 2013 at 02:06:51PM +0800, Yang Rong wrote:
> Get correct grf offset and need clear image set offsets.
> 
> Signed-off-by: Yang Rong <rong.r.yang at intel.com>
> ---
>  backend/src/backend/context.cpp     |  2 +-
>  backend/src/backend/gen_program.cpp |  1 +
>  backend/src/ir/image.cpp            | 13 +++++++++++++
>  backend/src/ir/image.hpp            |  2 ++
>  4 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/backend/src/backend/context.cpp b/backend/src/backend/context.cpp
> index 2609e7a..1bbe700 100644
> --- a/backend/src/backend/context.cpp
> +++ b/backend/src/backend/context.cpp
> @@ -409,7 +409,7 @@ namespace gbe
>    {
>      int32_t offset = fn.getImageSet()->getInfoOffset(key);
>      if (offset >= 0)
> -      return offset;
> +      return offset + GEN_REG_SIZE;
>      newCurbeEntry(GBE_CURBE_IMAGE_INFO, key.data, size, 4);
>      std::sort(kernel->patches.begin(), kernel->patches.end());
>  
> diff --git a/backend/src/backend/gen_program.cpp b/backend/src/backend/gen_program.cpp
> index 67d4cab..e0a6f91 100644
> --- a/backend/src/backend/gen_program.cpp
> +++ b/backend/src/backend/gen_program.cpp
> @@ -108,6 +108,7 @@ namespace gbe {
>          break;
>        }
>        GBE_DELETE(ctx);
> +      fn->getImageSet()->clearInfo();
>      }
>  
>      // XXX spill must be implemented
> diff --git a/backend/src/ir/image.cpp b/backend/src/ir/image.cpp
> index b901a12..af43ac7 100644
> --- a/backend/src/ir/image.cpp
> +++ b/backend/src/ir/image.cpp
> @@ -64,6 +64,19 @@ namespace ir {
>      setInfoOffset4Type(imageInfo, key.type, offset);
>    }
>  
> +  void ImageSet::clearInfo()
> +  {
> +    struct ImageInfo *imageInfo;
> +    for(auto &it : indexMap) {
> +      imageInfo = it.second;
> +      imageInfo->wSlot = -1;
> +      imageInfo->hSlot = -1;
> +      imageInfo->depthSlot = -1;
> +      imageInfo->dataTypeSlot = -1;
> +      imageInfo->channelOrderSlot = -1;
> +    }
> +  }
> +
>    void ImageSet::append(Register imageReg, Context *ctx)
>    {
>      ir::FunctionArgument *arg =  ctx->getFunction().getArg(imageReg);
> diff --git a/backend/src/ir/image.hpp b/backend/src/ir/image.hpp
> index c084c7d..088e479 100644
> --- a/backend/src/ir/image.hpp
> +++ b/backend/src/ir/image.hpp
> @@ -47,6 +47,8 @@ namespace ir {
>      void append(Register imageReg, Context *ctx);
>      /*! Append an image info slot. */
>      void appendInfo(ImageInfoKey key, uint32_t offset);
> +    /*! clear image info. */
> +    void clearInfo();
>      /*! Get the image's index(actual location). */
>      const uint32_t getIdx(const Register imageReg) const;
>      size_t getDataSize(void) { return regMap.size(); }
> -- 
> 1.8.1.2
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list