[Beignet] [PATCH] Fix a negative number alignment bug in RegisterFilePartitioner allocate.
Yang, Rong R
rong.r.yang at intel.com
Thu May 16 22:07:20 PDT 2013
That test case is from Lv meng.
Hi, Meng,
Will you submit downsampling test case?
Thanks,
Yang Rong
-----Original Message-----
From: beignet-bounces+rong.r.yang=intel.com at lists.freedesktop.org [mailto:beignet-bounces+rong.r.yang=intel.com at lists.freedesktop.org] On Behalf Of Zhigang Gong
Sent: Friday, May 17, 2013 1:05 PM
To: Yang, Rong R
Cc: beignet at lists.freedesktop.org
Subject: Re: [Beignet] [PATCH] Fix a negative number alignment bug in RegisterFilePartitioner allocate.
LGTM. Thanks.
BTW, do you have a simple test case in hand to trigger this bug?
If so, you are encourgaged to submit the unit test case also.
On Tue, May 14, 2013 at 10:39:12AM +0800, Yang Rong wrote:
>
> Signed-off-by: Yang Rong <rong.r.yang at intel.com>
> ---
> backend/src/backend/context.cpp | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/backend/src/backend/context.cpp
> b/backend/src/backend/context.cpp index c636b48..0beea1d 100644
> --- a/backend/src/backend/context.cpp
> +++ b/backend/src/backend/context.cpp
> @@ -120,7 +120,12 @@ namespace gbe
> continue;
> }
> } else {
> - aligned = ALIGN(list->offset+list->size-size-(alignment-1), alignment); //alloc from block's tail
> + int16_t unaligned = list->offset + list->size - size - (alignment-1);
> + if(unaligned < 0) {
> + list = list->prev;
> + continue;
> + }
> + aligned = ALIGN(unaligned, alignment); //alloc from block's tail
> spaceOnLeft = aligned - list->offset;
> spaceOnRight = list->size - size - spaceOnLeft;
>
> @@ -196,7 +201,6 @@ namespace gbe
>
> // Track the allocation to retrieve the size later
> allocatedBlocks.insert(std::make_pair(aligned, size));
> -
> // We have a valid offset now
> return aligned;
> }
> --
> 1.7.9.5
>
> _______________________________________________
> 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